Skip to content
Snippets Groups Projects
Commit bd7f1d0a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- testing session management
parent 73e0356b
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!34Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
...@@ -32,7 +32,7 @@ device_client = DeviceClient() ...@@ -32,7 +32,7 @@ device_client = DeviceClient()
service_client = ServiceClient() service_client = ServiceClient()
slice_client = SliceClient() slice_client = SliceClient()
logger = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
def process_descriptors(descriptors): def process_descriptors(descriptors):
try: try:
...@@ -74,7 +74,9 @@ def home(): ...@@ -74,7 +74,9 @@ def home():
context_topology_uuid = context_topology_form.context_topology.data context_topology_uuid = context_topology_form.context_topology.data
if len(context_topology_uuid) > 0: if len(context_topology_uuid) > 0:
b64_values = context_topology_uuid.split(',') b64_values = context_topology_uuid.split(',')
LOGGER.warning('b64_values={:s}'.format(str(b64_values)))
raw_values = [base64.b64decode(v.encode('utf-8')).decode('utf-8') for v in b64_values] raw_values = [base64.b64decode(v.encode('utf-8')).decode('utf-8') for v in b64_values]
LOGGER.warning('raw_values={:s}'.format(str(raw_values)))
context_uuid, context_name, topology_uuid, topology_name = raw_values context_uuid, context_name, topology_uuid, topology_name = raw_values
session['context_topology_uuid'] = context_topology_uuid session['context_topology_uuid'] = context_topology_uuid
session['context_uuid'] = context_uuid session['context_uuid'] = context_uuid
...@@ -103,7 +105,7 @@ def home(): ...@@ -103,7 +105,7 @@ def home():
process_descriptors(descriptor_form.descriptors) process_descriptors(descriptor_form.descriptors)
return redirect(url_for("main.home")) return redirect(url_for("main.home"))
except Exception as e: # pylint: disable=broad-except except Exception as e: # pylint: disable=broad-except
logger.exception('Descriptor load failed') LOGGER.exception('Descriptor load failed')
flash(f'Descriptor load failed: `{str(e)}`', 'danger') flash(f'Descriptor load failed: `{str(e)}`', 'danger')
finally: finally:
context_client.close() context_client.close()
...@@ -144,7 +146,7 @@ def topology(): ...@@ -144,7 +146,7 @@ def topology():
if link.link_id.link_uuid.uuid not in topo_link_uuids: continue if link.link_id.link_uuid.uuid not in topo_link_uuids: continue
if len(link.link_endpoint_ids) != 2: if len(link.link_endpoint_ids) != 2:
str_link = grpc_message_to_json_string(link) str_link = grpc_message_to_json_string(link)
logger.warning('Unexpected link with len(endpoints) != 2: {:s}'.format(str_link)) LOGGER.warning('Unexpected link with len(endpoints) != 2: {:s}'.format(str_link))
continue continue
links.append({ links.append({
'id': link.link_id.link_uuid.uuid, 'id': link.link_id.link_uuid.uuid,
...@@ -154,7 +156,7 @@ def topology(): ...@@ -154,7 +156,7 @@ def topology():
return jsonify({'devices': devices, 'links': links}) return jsonify({'devices': devices, 'links': links})
except: except:
logger.exception('Error retrieving topology') LOGGER.exception('Error retrieving topology')
finally: finally:
context_client.close() context_client.close()
......
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