Skip to content
Snippets Groups Projects
Commit 74ac189b authored by izacarias's avatar izacarias
Browse files

Fixing issues on QoS Page, Removing Workflow API and fixing access token to RTR.

parent 95dc5623
No related branches found
No related tags found
No related merge requests found
......@@ -28,10 +28,13 @@ qos_intents_url = config.qos_intents_url
stored_qos_intents_url = config.stored_qos_intents_url
workflow_url = config.workflow_url
access_token = ""
#if connection to rtr is set to true in the config file, then the user registers and logs in
if parameters['to_connect_to_rtr'] == 'true':
connect_rtr.register_rtr(workflow_url)
#access_token = connect_rtr.login_rtr(workflow_url)
# access_token = connect_rtr.login_rtr(workflow_url)
print('cleared')
#clears the existing intent store if you chose that in the config file
......@@ -133,35 +136,35 @@ def replace_qos_intent(qos_intent: qos_Intent):
return qos_intent
#API for sending workflows to the RTR
class Workflow(BaseModel):
command: str
intent_type: str
threat: str
attacked_host: str
mitigation_host: str
action: str
duration: str
intent_id: str
# #API for sending workflows to the RTR
# class Workflow(BaseModel):
# command: str
# intent_type: str
# threat: str
# attacked_host: str
# mitigation_host: str
# action: str
# duration: str
# intent_id: str
workflows = [Workflow(command='', intent_type='', threat='', attacked_host='',
mitigation_host='', action='', duration='', intent_id='')]
# workflows = [Workflow(command='', intent_type='', threat='', attacked_host='',
# mitigation_host='', action='', duration='', intent_id='')]
workflow_endpoint = parameters['to_send_workflow']
@app.get(workflow_endpoint)
def get_workflow():
return workflows
# workflow_endpoint = parameters['to_send_workflow']
# @app.get(workflow_endpoint)
# def get_workflow():
# return workflows
@app.post(workflow_endpoint, status_code=201)
def add_workflow(workflow: Workflow):
workflows.append(workflow)
return workflow
# @app.post(workflow_endpoint, status_code=201)
# def add_workflow(workflow: Workflow):
# workflows.append(workflow)
# return workflow
@app.put(workflow_endpoint)
def replace_workflow(workflow: Workflow):
workflows.clear()
workflows.append(workflow)
return workflow
# @app.put(workflow_endpoint)
# def replace_workflow(workflow: Workflow):
# workflows.clear()
# workflows.append(workflow)
# return workflow
#API for sending what-if question to the SAN
......@@ -395,7 +398,11 @@ def intents_html():
def qos_intents_html():
stored_qos_intents_arr = get_intents_script.get_intent_fun(stored_qos_intents_url)
items = stored_qos_intents_arr[0].items()
if len(stored_qos_intents_arr) > 0:
items = stored_qos_intents_arr[0].items()
else:
items = dict(id=0, intent_type='', name='', value=0.0,
host='', qos_intent_id='').items()
keys = [key for key, value in items]
headings = tuple(keys)
data = ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment