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

NBI component - IETF L2VPN connector:

- Fixed parsing of L2 Site Network Accesses
parent 2ff7f1b5
Loading
Loading
Loading
Loading
+24 −13
Original line number Diff line number Diff line
@@ -128,15 +128,26 @@ def process_site_network_access(

        service_mtu              = network_access_service.get('svc-mtu', DEFAULT_MTU)

        max_bandwidth_gbps = None
        max_e2e_latency_ms = None
        availability       = None

        service_bandwidth_bps = 0
        service_input_bandwidth = network_access_service.get('svc-input-bandwidth')
        service_bandwidth_bps
        if service_input_bandwidth is not None:
            service_input_bandwidth = float(service_input_bandwidth)
            service_bandwidth_bps = max(service_bandwidth_bps, service_input_bandwidth)

        service_output_bandwidth = network_access_service.get('svc-output-bandwidth')
        service_bandwidth_bps    = max(service_input_bandwidth, service_output_bandwidth)
        service_bandwidth_gbps   = service_bandwidth_bps / 1.e9
        if service_output_bandwidth is not None:
            service_output_bandwidth = float(service_output_bandwidth)
            if service_bandwidth_bps is None:
                service_bandwidth_bps = service_output_bandwidth
            else:
                service_bandwidth_bps = max(service_bandwidth_bps, service_output_bandwidth)

        max_e2e_latency_ms = None
        availability       = None
        if service_bandwidth_bps > 1.e-12:
            max_bandwidth_gbps = service_bandwidth_bps / 1.e9

        qos_profile_classes = (
            network_access.get('service', dict())
@@ -156,8 +167,8 @@ def process_site_network_access(
                MSG = 'Site Network Access QoS Class Direction: {:s}'
                raise NotImplementedError(MSG.format(str(qos_profile_class['direction'])))

            max_e2e_latency_ms = qos_profile_class['latency']['latency-boundary']
            availability       = qos_profile_class['bandwidth']['guaranteed-bw-percent']
            max_e2e_latency_ms = float(qos_profile_class['latency']['latency-boundary'])
            availability       = float(qos_profile_class['bandwidth']['guaranteed-bw-percent'])

        network_access_diversity = network_access.get('access-diversity', {})
        diversity_constraints = network_access_diversity.get('constraints', {}).get('constraint', [])
@@ -192,8 +203,8 @@ def process_site_network_access(
        update_constraint_endpoint_location(constraints, endpoint_id, region=site_id)
        if access_priority is not None:
            update_constraint_endpoint_priority(constraints, endpoint_id, access_priority)
        if service_bandwidth_gbps is not None:
            update_constraint_sla_capacity(constraints, service_bandwidth_gbps)
        if max_bandwidth_gbps is not None:
            update_constraint_sla_capacity(constraints, max_bandwidth_gbps)
        if max_e2e_latency_ms is not None:
            update_constraint_sla_latency(constraints, max_e2e_latency_ms)
        if availability is not None:
@@ -280,7 +291,7 @@ def update_site_network_access(network_access : Dict, errors : List[Dict]) -> No
        service_input_bandwidth  = network_access['service']['svc-input-bandwidth']
        service_output_bandwidth = network_access['service']['svc-output-bandwidth']
        service_bandwidth_bps    = max(service_input_bandwidth, service_output_bandwidth)
        service_bandwidth_gbps   = service_bandwidth_bps / 1.e9
        max_bandwidth_gbps   = service_bandwidth_bps / 1.e9

        max_e2e_latency_ms = None
        availability       = None
@@ -294,8 +305,8 @@ def update_site_network_access(network_access : Dict, errors : List[Dict]) -> No
            raise Exception(MSG.format(str(service_uuid)))

        constraints = service.service_constraints
        if service_bandwidth_gbps is not None:
            update_constraint_sla_capacity(constraints, service_bandwidth_gbps)
        if max_bandwidth_gbps is not None:
            update_constraint_sla_capacity(constraints, max_bandwidth_gbps)
        if max_e2e_latency_ms is not None:
            update_constraint_sla_latency(constraints, max_e2e_latency_ms)
        if availability is not None: