Skip to content
Snippets Groups Projects
Commit 3b82181e authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

PathComp component:

- updated definition of constant DEFAULT_CONTEXT_UUID to DEFAULT_CONTEXT_NAME
- updated definition of constant DEFAULT_TOPOLOGY_UUID to DEFAULT_TOPOLOGY_NAME
- updated definition of constant INTERDOMAIN_TOPOLOGY_UUID to INTERDOMAIN_TOPOLOGY_NAME
parent 53b95b8e
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!34Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import grpc, logging, threading import grpc, logging, threading
from common.Constants import DEFAULT_CONTEXT_UUID, INTERDOMAIN_TOPOLOGY_UUID from common.Constants import DEFAULT_CONTEXT_NAME, INTERDOMAIN_TOPOLOGY_NAME
from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method
from common.proto.context_pb2 import ContextId, Empty from common.proto.context_pb2 import ContextId, Empty
from common.proto.pathcomp_pb2 import PathCompReply, PathCompRequest from common.proto.pathcomp_pb2 import PathCompReply, PathCompRequest
...@@ -30,7 +30,7 @@ LOGGER = logging.getLogger(__name__) ...@@ -30,7 +30,7 @@ LOGGER = logging.getLogger(__name__)
METRICS_POOL = MetricsPool('PathComp', 'RPC') METRICS_POOL = MetricsPool('PathComp', 'RPC')
ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_UUID)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME))
class PathCompServiceServicerImpl(PathCompServiceServicer): class PathCompServiceServicerImpl(PathCompServiceServicer):
def __init__(self) -> None: def __init__(self) -> None:
...@@ -45,8 +45,8 @@ class PathCompServiceServicerImpl(PathCompServiceServicer): ...@@ -45,8 +45,8 @@ class PathCompServiceServicerImpl(PathCompServiceServicer):
context_client = ContextClient() context_client = ContextClient()
if (len(request.services) == 1) and is_inter_domain(context_client, request.services[0].service_endpoint_ids): if (len(request.services) == 1) and is_inter_domain(context_client, request.services[0].service_endpoint_ids):
devices = get_devices_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_UUID) devices = get_devices_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_NAME)
links = get_links_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_UUID) links = get_links_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_NAME)
else: else:
# TODO: improve filtering of devices and links # TODO: improve filtering of devices and links
# TODO: add contexts, topologies, and membership of devices/links in topologies # TODO: add contexts, topologies, and membership of devices/links in topologies
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import logging import logging
from typing import Dict from typing import Dict
from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
from common.proto.context_pb2 import Constraint, Device, EndPointId, Link, Service, ServiceId, TopologyId from common.proto.context_pb2 import Constraint, Device, EndPointId, Link, Service, ServiceId, TopologyId
from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string
from .ConstantsMappings import ( from .ConstantsMappings import (
...@@ -28,17 +28,17 @@ def compose_topology_id(topology_id : TopologyId) -> Dict: ...@@ -28,17 +28,17 @@ def compose_topology_id(topology_id : TopologyId) -> Dict:
context_uuid = topology_id.context_id.context_uuid.uuid context_uuid = topology_id.context_id.context_uuid.uuid
topology_uuid = topology_id.topology_uuid.uuid topology_uuid = topology_id.topology_uuid.uuid
if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_UUID if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_UUID if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_NAME
return {'contextId': context_uuid, 'topology_uuid': topology_uuid} return {'contextId': context_uuid, 'topology_uuid': topology_uuid}
def compose_service_id(service_id : ServiceId) -> Dict: def compose_service_id(service_id : ServiceId) -> Dict:
# force context_uuid to be always DEFAULT_CONTEXT_UUID for simplicity # force context_uuid to be always DEFAULT_CONTEXT_NAME for simplicity
# for interdomain contexts are managed in a particular way # for interdomain contexts are managed in a particular way
#context_uuid = service_id.context_id.context_uuid.uuid #context_uuid = service_id.context_id.context_uuid.uuid
#if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_UUID #if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
context_uuid = DEFAULT_CONTEXT_UUID context_uuid = DEFAULT_CONTEXT_NAME
service_uuid = service_id.service_uuid.uuid service_uuid = service_id.service_uuid.uuid
return {'contextId': context_uuid, 'service_uuid': service_uuid} return {'contextId': context_uuid, 'service_uuid': service_uuid}
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
from common.tools.object_factory.Constraint import json_constraint_custom from common.tools.object_factory.Constraint import json_constraint_custom
from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Context import json_context, json_context_id
from common.tools.object_factory.Device import json_device_emulated_packet_router_disabled, json_device_id from common.tools.object_factory.Device import json_device_emulated_packet_router_disabled, json_device_id
...@@ -41,11 +41,11 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]): ...@@ -41,11 +41,11 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
return service return service
# ----- Context -------------------------------------------------------------------------------------------------------- # ----- Context --------------------------------------------------------------------------------------------------------
CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID) CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
CONTEXT = json_context(DEFAULT_CONTEXT_UUID) CONTEXT = json_context(DEFAULT_CONTEXT_NAME)
# ----- Domains -------------------------------------------------------------------------------------------------------- # ----- Domains --------------------------------------------------------------------------------------------------------
TOPOLOGY_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID TOPOLOGY_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
TOPOLOGY_ADMIN_ID = json_topology_id(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID) TOPOLOGY_ADMIN_ID = json_topology_id(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID)
TOPOLOGY_ADMIN = json_topology(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID) TOPOLOGY_ADMIN = json_topology(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
from common.tools.object_factory.Constraint import json_constraint_custom from common.tools.object_factory.Constraint import json_constraint_custom
from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Context import json_context, json_context_id
from common.tools.object_factory.Device import ( from common.tools.object_factory.Device import (
...@@ -58,12 +58,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]): ...@@ -58,12 +58,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
return service return service
# ----- Context -------------------------------------------------------------------------------------------------------- # ----- Context --------------------------------------------------------------------------------------------------------
CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID) CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
CONTEXT = json_context(DEFAULT_CONTEXT_UUID) CONTEXT = json_context(DEFAULT_CONTEXT_NAME)
# ----- Domains -------------------------------------------------------------------------------------------------------- # ----- Domains --------------------------------------------------------------------------------------------------------
# Overall network topology # Overall network topology
TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
TOPO_ADMIN_ID = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID) TOPO_ADMIN_ID = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
TOPO_ADMIN = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_ID) TOPO_ADMIN = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import uuid import uuid
from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
from common.tools.object_factory.Constraint import json_constraint_custom from common.tools.object_factory.Constraint import json_constraint_custom
from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Context import json_context, json_context_id
from common.tools.object_factory.Device import ( from common.tools.object_factory.Device import (
...@@ -68,12 +68,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]): ...@@ -68,12 +68,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
return service return service
# ----- Context -------------------------------------------------------------------------------------------------------- # ----- Context --------------------------------------------------------------------------------------------------------
CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID) CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
CONTEXT = json_context(DEFAULT_CONTEXT_UUID) CONTEXT = json_context(DEFAULT_CONTEXT_NAME)
# ----- Domains -------------------------------------------------------------------------------------------------------- # ----- Domains --------------------------------------------------------------------------------------------------------
# Overall network topology # Overall network topology
TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
TOPO_ADMIN_ID = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID) TOPO_ADMIN_ID = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
TOPO_ADMIN = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_ID) TOPO_ADMIN = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment