Commit bd7f1d0a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- testing session management
parent 73e0356b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ device_client = DeviceClient()
service_client = ServiceClient()
slice_client = SliceClient()

logger = logging.getLogger(__name__)
LOGGER = logging.getLogger(__name__)

def process_descriptors(descriptors):
    try:
@@ -74,7 +74,9 @@ def home():
        context_topology_uuid = context_topology_form.context_topology.data
        if len(context_topology_uuid) > 0:
            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]
            LOGGER.warning('raw_values={:s}'.format(str(raw_values)))
            context_uuid, context_name, topology_uuid, topology_name = raw_values
            session['context_topology_uuid'] = context_topology_uuid
            session['context_uuid'] = context_uuid
@@ -103,7 +105,7 @@ def home():
            process_descriptors(descriptor_form.descriptors)
            return redirect(url_for("main.home"))
    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')
    finally:
        context_client.close()
@@ -144,7 +146,7 @@ def topology():
            if link.link_id.link_uuid.uuid not in topo_link_uuids: continue
            if len(link.link_endpoint_ids) != 2:
                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
            links.append({
                'id': link.link_id.link_uuid.uuid,
@@ -154,7 +156,7 @@ def topology():

        return jsonify({'devices': devices, 'links': links})
    except:
        logger.exception('Error retrieving topology')
        LOGGER.exception('Error retrieving topology')
    finally:
        context_client.close()