Loading src/context/service/database/models/enums/LinkType.pydeleted 100644 → 0 +0 −32 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. import enum, functools from common.proto.context_pb2 import LinkTypeEnum from ._GrpcToEnum import grpc_to_enum # IMPORTANT: Entries of enum class ORM_DeviceDriverEnum should be named as in # the proto files removing the prefixes. For example, proto item # DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG should be included as # OPENCONFIG. If item name does not match, automatic mapping of # proto enums to database enums will fail. class ORM_LinkTypeEnum(enum.Enum): UNKNOWN = LinkTypeEnum.LINKTYPE_UNKNOWN COPPER = LinkTypeEnum.LINKTYPE_COPPER VIRTUAL_COPPER = LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER OPTICAL = LinkTypeEnum.LINKTYPE_OPTICAL VIRTUAL_OPTICAL = LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL grpc_to_enum__link_type_enum = functools.partial( grpc_to_enum, LinkTypeEnum, ORM_LinkTypeEnum) src/nbi/service/rest_server/nbi_plugins/tfs_api/Resources.py +3 −18 Original line number Diff line number Diff line Loading @@ -177,11 +177,6 @@ class Topology(_Resource): def delete(self, context_uuid : str, topology_uuid : str): return format_grpc_to_json(self.context_client.RemoveTopology(grpc_topology_id(context_uuid, topology_uuid))) class TopologyDetails(_Resource): def get(self, context_uuid : str, topology_uuid : str): return format_grpc_to_json(self.context_client.GetTopologyDetails(grpc_topology_id( context_uuid, topology_uuid))) class ServiceIds(_Resource): def get(self, context_uuid : str): return format_grpc_to_json(self.context_client.ListServiceIds(grpc_context_id(context_uuid))) Loading Loading @@ -300,31 +295,21 @@ class Links(_Resource): ] class Link(_Resource): @staticmethod def _virtual_link(link): virtual_types = {LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER, LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL} if link.link_type in virtual_types: return True return False def get(self, link_uuid : str): return format_grpc_to_json(self.context_client.GetLink(grpc_link_id(link_uuid))) def put(self, link_uuid : str): link_json = request.get_json() link = grpc_link(link_json) virtual_types = {LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER, LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL} if link_uuid != link.link_id.link_uuid.uuid: raise BadRequest('Mismatching link_uuid') elif self._virtual_link(link): elif link.link_type in virtual_types: link = grpc_link(link_json) return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(link)) return format_grpc_to_json(self.context_client.SetLink(link)) return format_grpc_to_json(self.context_client.SetLink(grpc_link(link))) def delete(self, link_uuid : str): link = self.context_client.GetLink(grpc_link_id(link_uuid)) if self._virtual_link(link): format_grpc_to_json(self.vntmanager_client.RemoveVirtualLink(grpc_link_id(link_uuid))) return format_grpc_to_json(self.context_client.RemoveLink(grpc_link_id(link_uuid))) class ConnectionIds(_Resource): Loading src/nbi/service/rest_server/nbi_plugins/tfs_api/__init__.py +26 −27 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ from .Resources import ( PolicyRule, PolicyRuleIds, PolicyRules, Service, ServiceIds, Services, Slice, SliceIds, Slices, Topologies, Topology, TopologyIds, TopologyDetails Topologies, Topology, TopologyIds ) URL_PREFIX = '/tfs-api' Loading @@ -38,7 +38,6 @@ RESOURCES = [ ('api.topology_ids', TopologyIds, '/context/<path:context_uuid>/topology_ids'), ('api.topologies', Topologies, '/context/<path:context_uuid>/topologies'), ('api.topology', Topology, '/context/<path:context_uuid>/topology/<path:topology_uuid>'), ('api.topology_details', TopologyDetails, '/context/<path:context_uuid>/topology_details/<path:topology_uuid>'), ('api.service_ids', ServiceIds, '/context/<path:context_uuid>/service_ids'), ('api.services', Services, '/context/<path:context_uuid>/services'), Loading Loading
src/context/service/database/models/enums/LinkType.pydeleted 100644 → 0 +0 −32 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. import enum, functools from common.proto.context_pb2 import LinkTypeEnum from ._GrpcToEnum import grpc_to_enum # IMPORTANT: Entries of enum class ORM_DeviceDriverEnum should be named as in # the proto files removing the prefixes. For example, proto item # DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG should be included as # OPENCONFIG. If item name does not match, automatic mapping of # proto enums to database enums will fail. class ORM_LinkTypeEnum(enum.Enum): UNKNOWN = LinkTypeEnum.LINKTYPE_UNKNOWN COPPER = LinkTypeEnum.LINKTYPE_COPPER VIRTUAL_COPPER = LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER OPTICAL = LinkTypeEnum.LINKTYPE_OPTICAL VIRTUAL_OPTICAL = LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL grpc_to_enum__link_type_enum = functools.partial( grpc_to_enum, LinkTypeEnum, ORM_LinkTypeEnum)
src/nbi/service/rest_server/nbi_plugins/tfs_api/Resources.py +3 −18 Original line number Diff line number Diff line Loading @@ -177,11 +177,6 @@ class Topology(_Resource): def delete(self, context_uuid : str, topology_uuid : str): return format_grpc_to_json(self.context_client.RemoveTopology(grpc_topology_id(context_uuid, topology_uuid))) class TopologyDetails(_Resource): def get(self, context_uuid : str, topology_uuid : str): return format_grpc_to_json(self.context_client.GetTopologyDetails(grpc_topology_id( context_uuid, topology_uuid))) class ServiceIds(_Resource): def get(self, context_uuid : str): return format_grpc_to_json(self.context_client.ListServiceIds(grpc_context_id(context_uuid))) Loading Loading @@ -300,31 +295,21 @@ class Links(_Resource): ] class Link(_Resource): @staticmethod def _virtual_link(link): virtual_types = {LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER, LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL} if link.link_type in virtual_types: return True return False def get(self, link_uuid : str): return format_grpc_to_json(self.context_client.GetLink(grpc_link_id(link_uuid))) def put(self, link_uuid : str): link_json = request.get_json() link = grpc_link(link_json) virtual_types = {LinkTypeEnum.LINKTYPE_VIRTUAL_COPPER, LinkTypeEnum.LINKTYPE_VIRTUAL_OPTICAL} if link_uuid != link.link_id.link_uuid.uuid: raise BadRequest('Mismatching link_uuid') elif self._virtual_link(link): elif link.link_type in virtual_types: link = grpc_link(link_json) return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(link)) return format_grpc_to_json(self.context_client.SetLink(link)) return format_grpc_to_json(self.context_client.SetLink(grpc_link(link))) def delete(self, link_uuid : str): link = self.context_client.GetLink(grpc_link_id(link_uuid)) if self._virtual_link(link): format_grpc_to_json(self.vntmanager_client.RemoveVirtualLink(grpc_link_id(link_uuid))) return format_grpc_to_json(self.context_client.RemoveLink(grpc_link_id(link_uuid))) class ConnectionIds(_Resource): Loading
src/nbi/service/rest_server/nbi_plugins/tfs_api/__init__.py +26 −27 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ from .Resources import ( PolicyRule, PolicyRuleIds, PolicyRules, Service, ServiceIds, Services, Slice, SliceIds, Slices, Topologies, Topology, TopologyIds, TopologyDetails Topologies, Topology, TopologyIds ) URL_PREFIX = '/tfs-api' Loading @@ -38,7 +38,6 @@ RESOURCES = [ ('api.topology_ids', TopologyIds, '/context/<path:context_uuid>/topology_ids'), ('api.topologies', Topologies, '/context/<path:context_uuid>/topologies'), ('api.topology', Topology, '/context/<path:context_uuid>/topology/<path:topology_uuid>'), ('api.topology_details', TopologyDetails, '/context/<path:context_uuid>/topology_details/<path:topology_uuid>'), ('api.service_ids', ServiceIds, '/context/<path:context_uuid>/service_ids'), ('api.services', Services, '/context/<path:context_uuid>/services'), Loading