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

Device component - IETF ACTN / NCE Drivers:

- Added support to discover VLAN tags from IETF Network Topology
parent f99720fe
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import logging, re
from typing import Dict, List, Optional
from common.Constants import DEFAULT_TOPOLOGY_NAME
from common.DeviceTypes import DeviceTypeEnum
@@ -145,6 +145,20 @@ class NetworkTopologyHandler:
                    'mtu'           : '1500',
                    'site_location' : site_location,
                }

                outer_tag_vlan_range : Optional[str] = (
                    tp
                    .get('ietf-eth-te-topology:eth-svc', dict())
                    .get('supported-classification', dict())
                    .get('vlan-classification', dict())
                    .get('outer-tag', dict())
                    .get('vlan-range')
                )
                if outer_tag_vlan_range is not None:
                    RE_NUMBER = re.compile(r'[0-9]+')
                    if RE_NUMBER.match(outer_tag_vlan_range) is not None:
                        endpoint_settings['vlan_tag'] = int(outer_tag_vlan_range)

                endpoint_data = {
                    'device_uuid': node_id,
                    'uuid': tp_id,
+15 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import logging, re
from typing import Dict, List, Optional
from common.Constants import DEFAULT_TOPOLOGY_NAME
from common.DeviceTypes import DeviceTypeEnum
@@ -154,6 +154,20 @@ class NetworkTopologyHandler:
                    'mtu'           : '1500',
                    'site_location' : site_location,
                }

                outer_tag_vlan_range : Optional[str] = (
                    tp
                    .get('ietf-eth-te-topology:eth-svc', dict())
                    .get('supported-classification', dict())
                    .get('vlan-classification', dict())
                    .get('outer-tag', dict())
                    .get('vlan-range')
                )
                if outer_tag_vlan_range is not None:
                    RE_NUMBER = re.compile(r'[0-9]+')
                    if RE_NUMBER.match(outer_tag_vlan_range) is not None:
                        endpoint_settings['vlan_tag'] = int(outer_tag_vlan_range)

                endpoint_data = {
                    'device_uuid': node_id,
                    'uuid': tp_id,