Loading src/nbi/service/app.py +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ from .ietf_hardware import register_ietf_hardware from .ietf_l2vpn import register_ietf_l2vpn from .ietf_l3vpn import register_ietf_l3vpn from .ietf_network import register_ietf_network from .ietf_network_bw import register_ietf_network_bw from .ietf_network_slice import register_ietf_nss from .qkd_app import register_qkd_app from .restconf_root import register_restconf_root Loading Loading @@ -98,6 +99,7 @@ register_qkd_app (nbi_app) #register_topology_updates(nbi_app) # does not work; check if eventlet-grpc side effects register_vntm_recommend (nbi_app) register_camara_qod (nbi_app) register_ietf_network_bw (nbi_app) LOGGER.info('All connectors registered') nbi_app.dump_configuration() Loading src/nbi/service/ietf_network_bw/Networks_bw.py +2 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ from common.proto.context_pb2 import ContextId, Empty from common.tools.context_queries.Topology import get_topology_details from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from nbi.service.rest_server.nbi_plugins.tools.Authentication import HTTP_AUTH from nbi.service.rest_server.nbi_plugins.tools.HttpStatusCodes import HTTP_OK, HTTP_SERVERERROR from nbi.service._tools.Authentication import HTTP_AUTH from nbi.service._tools.HttpStatusCodes import HTTP_OK, HTTP_SERVERERROR from .YangHandler import YangHandler LOGGER = logging.getLogger(__name__) Loading src/nbi/service/ietf_network_bw/__init__.py +3 −8 Original line number Diff line number Diff line Loading @@ -30,15 +30,10 @@ # RFC draft-ietf-ccamp-client-signal-yang-10 - A YANG Data Model for Transport Network Client Signals # Ref: https://datatracker.ietf.org/doc/draft-ietf-ccamp-client-signal-yang/ from flask_restful import Resource from nbi.service.rest_server.RestServer import RestServer from nbi.service.NbiApplication import NbiApplication from .Networks_bw import Networks_bw URL_PREFIX = '/restconf/data/ietf-network:networks-bw' def _add_resource(rest_server : RestServer, resource : Resource, *urls, **kwargs): urls = [(URL_PREFIX + url) for url in urls] rest_server.add_resource(resource, *urls, **kwargs) def register_ietf_network_bw(rest_server : RestServer): _add_resource(rest_server, Networks_bw, '/') def register_ietf_network_bw(nbi_app : NbiApplication): nbi_app.add_rest_api_resource(Networks_bw, URL_PREFIX + '/') src/nbi/service/rest_server/nbi_plugins/ietf_network_bw/NameMapping.pydeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line # Copyright 2022-2024 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 typing import Dict, Tuple from common.proto.context_pb2 import Device, DeviceId, EndPoint, EndPointId class NameMappings: def __init__(self) -> None: self._device_uuid_to_name : Dict[str, str] = dict() self._endpoint_uuid_to_name : Dict[Tuple[str, str], str] = dict() def store_device_name(self, device : Device) -> None: device_uuid = device.device_id.device_uuid.uuid device_name = device.name self._device_uuid_to_name[device_uuid] = device_name self._device_uuid_to_name[device_name] = device_name def store_endpoint_name(self, device : Device, endpoint : EndPoint) -> None: device_uuid = device.device_id.device_uuid.uuid device_name = device.name endpoint_uuid = endpoint.endpoint_id.endpoint_uuid.uuid endpoint_name = endpoint.name self._endpoint_uuid_to_name[(device_uuid, endpoint_uuid)] = endpoint_name self._endpoint_uuid_to_name[(device_name, endpoint_uuid)] = endpoint_name self._endpoint_uuid_to_name[(device_uuid, endpoint_name)] = endpoint_name self._endpoint_uuid_to_name[(device_name, endpoint_name)] = endpoint_name def get_device_name(self, device_id : DeviceId) -> str: device_uuid = device_id.device_uuid.uuid return self._device_uuid_to_name.get(device_uuid, device_uuid) def get_endpoint_name(self, endpoint_id : EndPointId) -> str: device_uuid = endpoint_id.device_id.device_uuid.uuid endpoint_uuid = endpoint_id.endpoint_uuid.uuid return self._endpoint_uuid_to_name.get((device_uuid, endpoint_uuid), endpoint_uuid) src/nbi/service/rest_server/nbi_plugins/ietf_network_bw/NetworkTypeEnum.pydeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line # Copyright 2022-2024 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 enum import Enum from typing import Optional class NetworkTypeEnum(Enum): TE_OTN_TOPOLOGY = 'otn' TE_ETH_TRAN_TOPOLOGY = 'eth-tran' def get_network_topology_type(topology_id : str) -> Optional[NetworkTypeEnum]: return NetworkTypeEnum._value2member_map_.get(topology_id) Loading
src/nbi/service/app.py +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ from .ietf_hardware import register_ietf_hardware from .ietf_l2vpn import register_ietf_l2vpn from .ietf_l3vpn import register_ietf_l3vpn from .ietf_network import register_ietf_network from .ietf_network_bw import register_ietf_network_bw from .ietf_network_slice import register_ietf_nss from .qkd_app import register_qkd_app from .restconf_root import register_restconf_root Loading Loading @@ -98,6 +99,7 @@ register_qkd_app (nbi_app) #register_topology_updates(nbi_app) # does not work; check if eventlet-grpc side effects register_vntm_recommend (nbi_app) register_camara_qod (nbi_app) register_ietf_network_bw (nbi_app) LOGGER.info('All connectors registered') nbi_app.dump_configuration() Loading
src/nbi/service/ietf_network_bw/Networks_bw.py +2 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ from common.proto.context_pb2 import ContextId, Empty from common.tools.context_queries.Topology import get_topology_details from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from nbi.service.rest_server.nbi_plugins.tools.Authentication import HTTP_AUTH from nbi.service.rest_server.nbi_plugins.tools.HttpStatusCodes import HTTP_OK, HTTP_SERVERERROR from nbi.service._tools.Authentication import HTTP_AUTH from nbi.service._tools.HttpStatusCodes import HTTP_OK, HTTP_SERVERERROR from .YangHandler import YangHandler LOGGER = logging.getLogger(__name__) Loading
src/nbi/service/ietf_network_bw/__init__.py +3 −8 Original line number Diff line number Diff line Loading @@ -30,15 +30,10 @@ # RFC draft-ietf-ccamp-client-signal-yang-10 - A YANG Data Model for Transport Network Client Signals # Ref: https://datatracker.ietf.org/doc/draft-ietf-ccamp-client-signal-yang/ from flask_restful import Resource from nbi.service.rest_server.RestServer import RestServer from nbi.service.NbiApplication import NbiApplication from .Networks_bw import Networks_bw URL_PREFIX = '/restconf/data/ietf-network:networks-bw' def _add_resource(rest_server : RestServer, resource : Resource, *urls, **kwargs): urls = [(URL_PREFIX + url) for url in urls] rest_server.add_resource(resource, *urls, **kwargs) def register_ietf_network_bw(rest_server : RestServer): _add_resource(rest_server, Networks_bw, '/') def register_ietf_network_bw(nbi_app : NbiApplication): nbi_app.add_rest_api_resource(Networks_bw, URL_PREFIX + '/')
src/nbi/service/rest_server/nbi_plugins/ietf_network_bw/NameMapping.pydeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line # Copyright 2022-2024 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 typing import Dict, Tuple from common.proto.context_pb2 import Device, DeviceId, EndPoint, EndPointId class NameMappings: def __init__(self) -> None: self._device_uuid_to_name : Dict[str, str] = dict() self._endpoint_uuid_to_name : Dict[Tuple[str, str], str] = dict() def store_device_name(self, device : Device) -> None: device_uuid = device.device_id.device_uuid.uuid device_name = device.name self._device_uuid_to_name[device_uuid] = device_name self._device_uuid_to_name[device_name] = device_name def store_endpoint_name(self, device : Device, endpoint : EndPoint) -> None: device_uuid = device.device_id.device_uuid.uuid device_name = device.name endpoint_uuid = endpoint.endpoint_id.endpoint_uuid.uuid endpoint_name = endpoint.name self._endpoint_uuid_to_name[(device_uuid, endpoint_uuid)] = endpoint_name self._endpoint_uuid_to_name[(device_name, endpoint_uuid)] = endpoint_name self._endpoint_uuid_to_name[(device_uuid, endpoint_name)] = endpoint_name self._endpoint_uuid_to_name[(device_name, endpoint_name)] = endpoint_name def get_device_name(self, device_id : DeviceId) -> str: device_uuid = device_id.device_uuid.uuid return self._device_uuid_to_name.get(device_uuid, device_uuid) def get_endpoint_name(self, endpoint_id : EndPointId) -> str: device_uuid = endpoint_id.device_id.device_uuid.uuid endpoint_uuid = endpoint_id.endpoint_uuid.uuid return self._endpoint_uuid_to_name.get((device_uuid, endpoint_uuid), endpoint_uuid)
src/nbi/service/rest_server/nbi_plugins/ietf_network_bw/NetworkTypeEnum.pydeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line # Copyright 2022-2024 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 enum import Enum from typing import Optional class NetworkTypeEnum(Enum): TE_OTN_TOPOLOGY = 'otn' TE_ETH_TRAN_TOPOLOGY = 'eth-tran' def get_network_topology_type(topology_id : str) -> Optional[NetworkTypeEnum]: return NetworkTypeEnum._value2member_map_.get(topology_id)