Loading my_deploy.sh +6 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene # Uncomment to activate Forecaster #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2eorchestrator" # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" Loading Loading @@ -90,7 +93,7 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" Loading @@ -108,7 +111,7 @@ export NATS_EXT_PORT_CLIENT="4222" export NATS_EXT_PORT_HTTP="8222" # Disable flag for re-deploying NATS from scratch. export NATS_REDEPLOY="YES" export NATS_REDEPLOY="" # ----- QuestDB ---------------------------------------------------------------- Loading Loading @@ -138,7 +141,7 @@ export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" # Disable flag for dropping tables if they exist. export QDB_DROP_TABLES_IF_EXIST="" export QDB_DROP_TABLES_IF_EXIST="YES" # Disable flag for re-deploying QuestDB from scratch. export QDB_REDEPLOY="" Loading src/e2eorchestrator/client/E2EOrchestratorServiceClient.py→src/e2eorchestrator/client/E2EOrchestratorClient.py +6 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceStub from common.Settings import get_service_host, get_service_port_grpc from common.tools.client.RetryDecorator import delay_exponential, retry from common.tools.grpc.Tools import grpc_message_to_json from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestratorReply LOGGER = logging.getLogger(__name__) MAX_RETRIES = 15 Loading @@ -33,7 +34,7 @@ RETRY_DECORATOR = retry( ) class E2EOrchestratorServiceClient: class E2EOrchestratorClient: def __init__(self, host=None, port=None): if not host: host = get_service_host(ServiceNameEnum.E2EORCHESTRATOR) Loading @@ -57,12 +58,12 @@ class E2EOrchestratorServiceClient: self.stub = None @RETRY_DECORATOR def Compute(self, request: Empty) -> Empty: LOGGER.debug( def Compute(self, request: E2EOrchestratorRequest) -> E2EOrchestratorReply: LOGGER.info( "Compute request: {:s}".format(str(grpc_message_to_json(request))) ) response = self.stub.GetPath(request) LOGGER.debug( response = self.stub.Compute(request) LOGGER.info( "Compute result: {:s}".format(str(grpc_message_to_json(response))) ) return response src/e2eorchestrator/service/E2EOrchestratorServiceServicerImpl.py +18 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestr from common.proto.context_pb2 import Empty, Connection, EndPointId from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceServicer from context.client.ContextClient import ContextClient from context.service.database.uuids.EndPoint import endpoint_get_uuid LOGGER = logging.getLogger(__name__) Loading @@ -40,17 +41,17 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def Compute(self, request: E2EOrchestratorRequest, context: grpc.ServicerContext) -> E2EOrchestratorReply: endpoints_ids = [] for endpoint_id in request.service_endpoint_ids: endpoints_ids.append(endpoint_id.endpoint_uuid.uuid) for endpoint_id in request.service.service_endpoint_ids: endpoints_ids.append(endpoint_get_uuid(endpoint_id)[2]) graph = nx.Graph() devices = context_client.ListDevices(Empty()).devices for device in devices: endpoints_uuids = [endpoint.endpoint_uuid.uuid for endpoint in device.device_endpoints] endpoints_uuids = [endpoint.endpoint_id.endpoint_uuid.uuid for endpoint in device.device_endpoints] for ep in endpoints_uuids: graph.add_node(ep) Loading @@ -58,7 +59,7 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): for ep_i in endpoints_uuids: if ep == ep_i: continue graph.add_edge(ep. ep_i) graph.add_edge(ep, ep_i) links = context_client.ListLinks(Empty()).links for link in links: Loading @@ -72,17 +73,20 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): path = E2EOrchestratorReply() path.services.append(copy.deepcopy(request.service)) for i in len(shortest): conn = Connection conn.connection_id.connection_uuid.uuid = str(shortest[i*2]) + '_->_' + str(shortest[i*2+1]) for i in range(0, int(len(shortest)/2)): conn = Connection() ep_a_uuid = str(shortest[i*2]) ep_z_uuid = str(shortest[i*2+1]) conn.connection_id.connection_uuid.uuid = str(ep_a_uuid) + '_->_' + str(ep_z_uuid) ep0 = EndPointId ep0.endpoint_uuid.uuid = ep conn.path_hops_endpoint_ids.append(shortest[i*2]) ep_a_id = EndPointId() ep_a_id.endpoint_uuid.uuid = ep_a_uuid conn.path_hops_endpoint_ids.append(ep_a_id) ep1 = EndPointId ep1.endpoint_uuid.uuid = ep conn.path_hops_endpoint_ids.append(shortest[i*2+1]) ep_z_id = EndPointId() ep_z_id.endpoint_uuid.uuid = ep_z_uuid conn.path_hops_endpoint_ids.append(ep_z_id) path.connections.append(conn) Loading src/service/service/ServiceServiceServicerImpl.py +2 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ from common.proto.service_pb2_grpc import ServiceServiceServicer from common.tools.context_queries.Service import get_service_by_id from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string from context.client.ContextClient import ContextClient from e2eorchestrator.client.E2EOrchestratorServiceClient import E2EOrchestratorServiceClient from e2eorchestrator.client.E2EOrchestratorClient import E2EOrchestratorClient from pathcomp.frontend.client.PathCompClient import PathCompClient from service.service.tools.ConnectionToString import connection_to_string from service.client.TEServiceClient import TEServiceClient Loading Loading @@ -167,7 +167,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): e2e_orch_request = E2EOrchestratorRequest() e2e_orch_request.service.CopyFrom(service_with_uuids) e2e_orch_client = E2EOrchestratorServiceClient() e2e_orch_client = E2EOrchestratorClient() e2e_orch_reply = e2e_orch_client.Compute(e2e_orch_request) # Feed TaskScheduler with this end-to-end orchestrator reply. TaskScheduler identifies Loading src/tests/Fixtures.py +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ import pytest from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient from monitoring.client.MonitoringClient import MonitoringClient from e2eorchestrator.client.E2EOrchestratorClient import E2EOrchestratorClient from service.client.ServiceClient import ServiceClient @pytest.fixture(scope='session') def service_client(): _client = ServiceClient() yield _client _client.close() @pytest.fixture(scope='session') def context_client(): Loading @@ -34,3 +43,9 @@ def monitoring_client(): _client = MonitoringClient() yield _client _client.close() @pytest.fixture(scope='session') def e2eorchestrator_client(): _client = E2EOrchestratorClient() yield _client _client.close() Loading
my_deploy.sh +6 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene # Uncomment to activate Forecaster #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2eorchestrator" # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" Loading Loading @@ -90,7 +93,7 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" Loading @@ -108,7 +111,7 @@ export NATS_EXT_PORT_CLIENT="4222" export NATS_EXT_PORT_HTTP="8222" # Disable flag for re-deploying NATS from scratch. export NATS_REDEPLOY="YES" export NATS_REDEPLOY="" # ----- QuestDB ---------------------------------------------------------------- Loading Loading @@ -138,7 +141,7 @@ export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" # Disable flag for dropping tables if they exist. export QDB_DROP_TABLES_IF_EXIST="" export QDB_DROP_TABLES_IF_EXIST="YES" # Disable flag for re-deploying QuestDB from scratch. export QDB_REDEPLOY="" Loading
src/e2eorchestrator/client/E2EOrchestratorServiceClient.py→src/e2eorchestrator/client/E2EOrchestratorClient.py +6 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceStub from common.Settings import get_service_host, get_service_port_grpc from common.tools.client.RetryDecorator import delay_exponential, retry from common.tools.grpc.Tools import grpc_message_to_json from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestratorReply LOGGER = logging.getLogger(__name__) MAX_RETRIES = 15 Loading @@ -33,7 +34,7 @@ RETRY_DECORATOR = retry( ) class E2EOrchestratorServiceClient: class E2EOrchestratorClient: def __init__(self, host=None, port=None): if not host: host = get_service_host(ServiceNameEnum.E2EORCHESTRATOR) Loading @@ -57,12 +58,12 @@ class E2EOrchestratorServiceClient: self.stub = None @RETRY_DECORATOR def Compute(self, request: Empty) -> Empty: LOGGER.debug( def Compute(self, request: E2EOrchestratorRequest) -> E2EOrchestratorReply: LOGGER.info( "Compute request: {:s}".format(str(grpc_message_to_json(request))) ) response = self.stub.GetPath(request) LOGGER.debug( response = self.stub.Compute(request) LOGGER.info( "Compute result: {:s}".format(str(grpc_message_to_json(response))) ) return response
src/e2eorchestrator/service/E2EOrchestratorServiceServicerImpl.py +18 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestr from common.proto.context_pb2 import Empty, Connection, EndPointId from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceServicer from context.client.ContextClient import ContextClient from context.service.database.uuids.EndPoint import endpoint_get_uuid LOGGER = logging.getLogger(__name__) Loading @@ -40,17 +41,17 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def Compute(self, request: E2EOrchestratorRequest, context: grpc.ServicerContext) -> E2EOrchestratorReply: endpoints_ids = [] for endpoint_id in request.service_endpoint_ids: endpoints_ids.append(endpoint_id.endpoint_uuid.uuid) for endpoint_id in request.service.service_endpoint_ids: endpoints_ids.append(endpoint_get_uuid(endpoint_id)[2]) graph = nx.Graph() devices = context_client.ListDevices(Empty()).devices for device in devices: endpoints_uuids = [endpoint.endpoint_uuid.uuid for endpoint in device.device_endpoints] endpoints_uuids = [endpoint.endpoint_id.endpoint_uuid.uuid for endpoint in device.device_endpoints] for ep in endpoints_uuids: graph.add_node(ep) Loading @@ -58,7 +59,7 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): for ep_i in endpoints_uuids: if ep == ep_i: continue graph.add_edge(ep. ep_i) graph.add_edge(ep, ep_i) links = context_client.ListLinks(Empty()).links for link in links: Loading @@ -72,17 +73,20 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): path = E2EOrchestratorReply() path.services.append(copy.deepcopy(request.service)) for i in len(shortest): conn = Connection conn.connection_id.connection_uuid.uuid = str(shortest[i*2]) + '_->_' + str(shortest[i*2+1]) for i in range(0, int(len(shortest)/2)): conn = Connection() ep_a_uuid = str(shortest[i*2]) ep_z_uuid = str(shortest[i*2+1]) conn.connection_id.connection_uuid.uuid = str(ep_a_uuid) + '_->_' + str(ep_z_uuid) ep0 = EndPointId ep0.endpoint_uuid.uuid = ep conn.path_hops_endpoint_ids.append(shortest[i*2]) ep_a_id = EndPointId() ep_a_id.endpoint_uuid.uuid = ep_a_uuid conn.path_hops_endpoint_ids.append(ep_a_id) ep1 = EndPointId ep1.endpoint_uuid.uuid = ep conn.path_hops_endpoint_ids.append(shortest[i*2+1]) ep_z_id = EndPointId() ep_z_id.endpoint_uuid.uuid = ep_z_uuid conn.path_hops_endpoint_ids.append(ep_z_id) path.connections.append(conn) Loading
src/service/service/ServiceServiceServicerImpl.py +2 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ from common.proto.service_pb2_grpc import ServiceServiceServicer from common.tools.context_queries.Service import get_service_by_id from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string from context.client.ContextClient import ContextClient from e2eorchestrator.client.E2EOrchestratorServiceClient import E2EOrchestratorServiceClient from e2eorchestrator.client.E2EOrchestratorClient import E2EOrchestratorClient from pathcomp.frontend.client.PathCompClient import PathCompClient from service.service.tools.ConnectionToString import connection_to_string from service.client.TEServiceClient import TEServiceClient Loading Loading @@ -167,7 +167,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): e2e_orch_request = E2EOrchestratorRequest() e2e_orch_request.service.CopyFrom(service_with_uuids) e2e_orch_client = E2EOrchestratorServiceClient() e2e_orch_client = E2EOrchestratorClient() e2e_orch_reply = e2e_orch_client.Compute(e2e_orch_request) # Feed TaskScheduler with this end-to-end orchestrator reply. TaskScheduler identifies Loading
src/tests/Fixtures.py +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ import pytest from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient from monitoring.client.MonitoringClient import MonitoringClient from e2eorchestrator.client.E2EOrchestratorClient import E2EOrchestratorClient from service.client.ServiceClient import ServiceClient @pytest.fixture(scope='session') def service_client(): _client = ServiceClient() yield _client _client.close() @pytest.fixture(scope='session') def context_client(): Loading @@ -34,3 +43,9 @@ def monitoring_client(): _client = MonitoringClient() yield _client _client.close() @pytest.fixture(scope='session') def e2eorchestrator_client(): _client = E2EOrchestratorClient() yield _client _client.close()