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

NBI component - IETF Network Slice:

- Fixed discovery of SDP IP Address
- Fixed discovery of SDP VLAN tag
parent 0bf91659
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
@@ -347,18 +347,36 @@ class IETFSliceHandler:
            endpoint.endpoint_uuid.uuid = endpoint_uuid
            list_endpoints.append(endpoint)

            match_criteria = sdp["service-match-criteria"]["match-criterion"]
            if len(match_criteria) != 1:
                raise Exception('Each SDP must have exactly 1 service-match-criteria/match-criterion')
            match_criterion = match_criteria[0]

            # Keep track of connection-group-id from each SDP
            connection_group_ids.add(
                sdp["service-match-criteria"]["match-criterion"][0][
                    "target-connection-group-id"
                ]
                match_criterion['target-connection-group-id']
            )

            sdp_ip_addresses = sdp['sdp-ip-address']
            if len(sdp_ip_addresses) != 1:
                raise Exception('Each SDP must have exactly 1 sdp-ip-address')
            sdp_ip_address = sdp_ip_addresses[0]

            vlan_tag = None
            match_type = match_criterion['match-type']
            for match_type_item in match_type:
                item_type = match_type_item['type']
                if item_type != 'ietf-network-slice-service:vlan': continue
                vlan_tag = int(match_type_item['value'][0])
                break

            # Endpoint-specific config rule fields
            endpoint_config_rule_fields = {
                "address_ip": (endpoint_uuid, RAISE_IF_DIFFERS),
                "address_prefix": (ADDRESS_PREFIX, RAISE_IF_DIFFERS),
                'address_ip': (sdp_ip_address, RAISE_IF_DIFFERS),
                'address_prefix': (ADDRESS_PREFIX, RAISE_IF_DIFFERS),
            }
            if vlan_tag is not None:
                endpoint_config_rule_fields['vlan_tag'] = vlan_tag
            endpoint_config_rules.append(
                (
                    f"/device[{device_uuid}]/endpoint[{endpoint_uuid}]/settings",