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

Service component - L3NM IETF Slice:

- Bug fixes
- Moved old Tools to old folder
parent e6a11302
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ class L3NM_IETFSlice_ServiceHandler(_ServiceHandler):

            del controller.device_config.config_rules[:]
            controller.device_config.config_rules.append(ConfigRule(**json_config_rule_set(
                '/service[{:s}]/IETFSlice'.format(self.__service.name), slice_data_model
                '/service[{:s}]/IETFSlice'.format(slice_name), slice_data_model
            )))
            self.__task_executor.configure_device(controller)
        except Exception as e:
+0 −32
Original line number Diff line number Diff line
@@ -13,8 +13,6 @@
# limitations under the License.


from dataclasses import dataclass
from typing import Dict, TypedDict
from common.proto.context_pb2 import Device


@@ -31,33 +29,3 @@ def get_device_endpoint_name(device_obj : Device, endpoint_uuid : str) -> str:
    device_name = str(device_obj.name)
    MSG = 'Device({:s},{:s})/Endpoint({:s}) not found'
    raise Exception(MSG.format(device_uuid, device_name, str(endpoint_uuid)))


@dataclass
class Ipv4Info:
    src_prefix : str = ''
    dst_prefix : str = ''
    src_port   : str = ''
    dst_port   : str = ''
    vlan       : str = ''


def extract_match_criterion_ipv4_info(match_criterion : Dict) -> Ipv4Info:
    ipv4_info = Ipv4Info()

    for type_value in match_criterion['match-type']:
        match_type = type_value['type']
        value = type_value['value'][0]

        if match_type == 'ietf-network-slice-service:source-ip-prefix':
            ipv4_info.src_prefix = value
        elif match_type == 'ietf-network-slice-service:destination-ip-prefix':
            ipv4_info.dst_prefix = value
        elif match_type == 'ietf-network-slice-service:source-tcp-port':
            ipv4_info.src_port = value
        elif match_type == 'ietf-network-slice-service:destination-tcp-port':
            ipv4_info.dst_port = value
        elif match_type == 'ietf-network-slice-service:vlan':
            ipv4_info.vlan = value

    return ipv4_info
+47 −0
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from dataclasses import dataclass
from typing import Dict


@dataclass
class Ipv4Info:
    src_prefix : str = ''
    dst_prefix : str = ''
    src_port   : str = ''
    dst_port   : str = ''
    vlan       : str = ''


def extract_match_criterion_ipv4_info(match_criterion : Dict) -> Ipv4Info:
    ipv4_info = Ipv4Info()

    for type_value in match_criterion['match-type']:
        match_type = type_value['type']
        value = type_value['value'][0]

        if match_type == 'ietf-network-slice-service:source-ip-prefix':
            ipv4_info.src_prefix = value
        elif match_type == 'ietf-network-slice-service:destination-ip-prefix':
            ipv4_info.dst_prefix = value
        elif match_type == 'ietf-network-slice-service:source-tcp-port':
            ipv4_info.src_port = value
        elif match_type == 'ietf-network-slice-service:destination-tcp-port':
            ipv4_info.dst_port = value
        elif match_type == 'ietf-network-slice-service:vlan':
            ipv4_info.vlan = value

    return ipv4_info