From c05075fe4f73b62e27ff8782dc96f380ac3e6b41 Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Fri, 20 Jan 2023 13:59:00 +0000
Subject: [PATCH] Code Cleanup

---
 .../nbi_plugins/ietf_l2vpn/L2VPN_Service.py   |  1 -
 .../ietf_l2vpn/L2VPN_SiteNetworkAccesses.py   |  1 -
 .../ietf_l2vpn/tools/ContextMethods.py        | 39 -------------------
 3 files changed, 41 deletions(-)
 delete mode 100644 src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/tools/ContextMethods.py

diff --git a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_Service.py b/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_Service.py
index f6fd7d518..e3d120881 100644
--- a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_Service.py
+++ b/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_Service.py
@@ -21,7 +21,6 @@ from common.tools.context_queries.Slice import get_slice
 from context.client.ContextClient import ContextClient
 from slice.client.SliceClient import SliceClient
 from .tools.Authentication import HTTP_AUTH
-from .tools.ContextMethods import get_service, get_slice
 from .tools.HttpStatusCodes import HTTP_GATEWAYTIMEOUT, HTTP_NOCONTENT, HTTP_OK, HTTP_SERVERERROR
 
 LOGGER = logging.getLogger(__name__)
diff --git a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_SiteNetworkAccesses.py b/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_SiteNetworkAccesses.py
index 771968d88..819d8995d 100644
--- a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_SiteNetworkAccesses.py
+++ b/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/L2VPN_SiteNetworkAccesses.py
@@ -31,7 +31,6 @@ from context.client.ContextClient import ContextClient
 from slice.client.SliceClient import SliceClient
 from .schemas.site_network_access import SCHEMA_SITE_NETWORK_ACCESS
 from .tools.Authentication import HTTP_AUTH
-from .tools.ContextMethods import get_service, get_slice
 from .tools.HttpStatusCodes import HTTP_NOCONTENT, HTTP_SERVERERROR
 from .tools.Validator import validate_message
 from .Constants import (
diff --git a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/tools/ContextMethods.py b/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/tools/ContextMethods.py
deleted file mode 100644
index 79e73a28d..000000000
--- a/src/compute/service/rest_server/nbi_plugins/ietf_l2vpn/tools/ContextMethods.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import grpc, logging
-from typing import Optional
-from common.Constants import DEFAULT_CONTEXT_UUID
-from context.client.ContextClient import ContextClient
-from context.proto.context_pb2 import Service, ServiceId, Slice, SliceId
-
-LOGGER = logging.getLogger(__name__)
-
-def get_service(
-        context_client : ContextClient, service_uuid : str, context_uuid : str = DEFAULT_CONTEXT_UUID
-    ) -> Optional[Service]:
-    try:
-        # pylint: disable=no-member
-        service_id = ServiceId()
-        service_id.context_id.context_uuid.uuid = context_uuid
-        service_id.service_uuid.uuid = service_uuid
-        service_readonly = context_client.GetService(service_id)
-        service = Service()
-        service.CopyFrom(service_readonly)
-        return service
-    except grpc.RpcError:
-        #LOGGER.exception('Unable to get service({:s} / {:s})'.format(str(context_uuid), str(service_uuid)))
-        return None
-
-def get_slice(
-        context_client : ContextClient, slice_uuid : str, context_uuid : str = DEFAULT_CONTEXT_UUID
-    ) -> Optional[Slice]:
-    try:
-        # pylint: disable=no-member
-        slice_id = SliceId()
-        slice_id.context_id.context_uuid.uuid = context_uuid
-        slice_id.slice_uuid.uuid = slice_uuid
-        slice_readonly = context_client.GetSlice(slice_id)
-        slice_ = Slice()
-        slice_.CopyFrom(slice_readonly)
-        return slice_
-    except grpc.RpcError:
-        #LOGGER.exception('Unable to get slice({:s} / {:s})'.format(str(context_uuid), str(slice_uuid)))
-        return None
-- 
GitLab