Loading deploy/subscription_ws.sh +16 −3 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ # If not already set, set the namespace where CockroackDB will be deployed. export SUBSCRIPTION_WS_NAMESPACE=${SUBSCRIPTION_WS_NAMESPACE:-"tfs"} # If not already set, set the internal port interface will be exposed to. export SUBSCRIPTION_WS_INT_PORT=${SUBSCRIPTION_WS_INT_PORT:-"8765"} # If not already set, set the external port interface will be exposed to. export SUBSCRIPTION_WS_EXT_PORT=${SUBSCRIPTION_WS_EXT_PORT:-"8765"} # If not already set, set the external port interface will be exposed to. export SUBSCRIPTION_WS_INT_PORT=${SUBSCRIPTION_WS_INT_PORT:-"8765"} ######################################################################################################################## # Automated steps start here ######################################################################################################################## Loading @@ -43,3 +43,16 @@ kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress -- echo echo "Subscription WebSocket Port Mapping" echo ">>> ExposeSubscription WebSocket port (${SUBSCRIPTION_WS_INT_PORT}->${SUBSCRIPTION_WS_INT_PORT})" PATCH='{"data": {"'${SUBSCRIPTION_WS_INT_PORT}'": "'${SUBSCRIPTION_WS_NAMESPACE}'/nbiservice:'${SUBSCRIPTION_WS_INT_PORT}'"}}' kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}" PORT_MAP='{"containerPort": '${SUBSCRIPTION_WS_INT_PORT}', "hostPort": '${SUBSCRIPTION_WS_INT_PORT}'}' CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}' PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}' kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}" echo manifests/e2e_orchestratorservice.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ spec: - containerPort: 8765 env: - name: LOG_LEVEL value: "INFO" value: "DEBUG" readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10050"] Loading my_deploy.sh +2 −2 Original line number Diff line number Diff line Loading @@ -57,10 +57,10 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" # Uncomment to activate VNT Manager #export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" Loading src/e2e_orchestrator/service/E2EOrchestratorServiceServicerImpl.py +34 −14 Original line number Diff line number Diff line Loading @@ -21,13 +21,14 @@ from websockets.sync.client import connect import time from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestratorReply from common.proto.context_pb2 import Empty, Connection, EndPointId from common.proto.context_pb2 import Empty, Connection, EndPointId, Link, LinkId from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceServicer from context.client.ContextClient import ContextClient from context.service.database.uuids.EndPoint import endpoint_get_uuid from common.proto.vnt_manager_pb2 import VNTSubscriptionRequest, VNTSubscriptionReply from common.tools.grpc.Tools import grpc_message_to_json_string from websockets.sync.server import serve import json LOGGER = logging.getLogger(__name__) Loading @@ -36,10 +37,6 @@ METRICS_POOL = MetricsPool("E2EOrchestrator", "RPC") context_client: ContextClient = ContextClient() def event_received(websocket): for message in websocket: LOGGER.info("Message received!!!: {}".format(message)) websocket.send(message) class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): Loading @@ -52,7 +49,7 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): LOGGER.info("Requesting subscription") self.RequestSubscription() except Exception as E: LOGGER.info("Exception!: {}".format(E)) LOGGER.info("Exception0!: {}".format(E)) Loading Loading @@ -108,13 +105,17 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): path.connections.append(conn) def RequestSubscription(self): HOST = "10.1.1.83" PORT = str(8765) LOGGER.info("Trying to connect...!!!") OWN_HOST = "10.1.1.83" OWN_PORT = "8765" url = "ws://" + str(HOST) + ":" + str(PORT) EXT_HOST = "10.1.1.83" EXT_PORT = "8765" url = "ws://" + EXT_HOST + ":" + EXT_PORT request = VNTSubscriptionRequest() request.host = HOST request.port = PORT request.host = OWN_HOST request.port = OWN_PORT LOGGER.info("Trying to connect... to {}".format(url)) with connect(url, logger=LOGGER) as websocket: send = grpc_message_to_json_string(request) Loading @@ -132,13 +133,32 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): LOGGER.info('Exception2!: {}'.format(e)) with serve(event_received, HOST, PORT, logger=LOGGER) as server: LOGGER.info("Running subscription server...: {}:{}".format(HOST, str(PORT))) with serve(self._event_received, "0.0.0.0", OWN_PORT, logger=LOGGER) as server: LOGGER.info("Running subscription server...: {}:{}".format("0.0.0.0", OWN_PORT)) server.serve_forever() LOGGER.info("Exiting subscription server...") def _event_received(self, websocket): for message in websocket: LOGGER.info("Message received!!!: {}".format(message)) message_json = json.loads(message) if 'event_type' in message_json: pass elif 'link_id' in message_json: obj = Link(**message_json) if self._check_policies(obj): pass elif 'link_uuid' in message_json: obj = LinkId(**message_json) websocket.send(message) def _check_policies(self, link): return True src/nbi/service/rest_server/nbi_plugins/tfs_api/Resources.py +8 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ from service.client.ServiceClient import ServiceClient from vnt_manager.client.VNTManagerClient import VNTManagerClient from .Tools import ( format_grpc_to_json, grpc_connection_id, grpc_context_id, grpc_device_id, grpc_link_id, grpc_policy_rule_id, format_grpc_to_json, grpc_connection_id, grpc_context_id, grpc_device_id, grpc_link, grpc_link_id, grpc_policy_rule_id, grpc_service_id, grpc_service, grpc_slice_id, grpc_topology_id) class _Resource(Resource): Loading Loading @@ -191,21 +191,21 @@ class Link(_Resource): class VirtualLinkIds(_Resource): def get(self): return format_grpc_to_json(self.vntmanager_client.ListLinkIds(Empty())) return format_grpc_to_json(self.vntmanager_client.ListVirtualLinkIds(Empty())) class VirtualLinks(_Resource): def get(self): return format_grpc_to_json(self.vntmanager_client.ListLinks(Empty())) return format_grpc_to_json(self.vntmanager_client.ListVirtualLinks(Empty())) class VirtualLink(_Resource): def get(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.GetLink(grpc_link_id(link_uuid))) def post(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.GetVirtualLink(grpc_link_id(link_uuid))) def post(self): link = request.get_json() return format_grpc_to_json(self.vntmanager_client.SetLink(grpc_link_id(link))) def put(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(grpc_link(link))) def put(self): link = request.get_json() return format_grpc_to_json(self.vntmanager_client.SetLink(grpc_link_id(link))) return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(grpc_link(link))) def delete(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.RemoveVirtualLink(grpc_link_id(link_uuid))) Loading Loading
deploy/subscription_ws.sh +16 −3 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ # If not already set, set the namespace where CockroackDB will be deployed. export SUBSCRIPTION_WS_NAMESPACE=${SUBSCRIPTION_WS_NAMESPACE:-"tfs"} # If not already set, set the internal port interface will be exposed to. export SUBSCRIPTION_WS_INT_PORT=${SUBSCRIPTION_WS_INT_PORT:-"8765"} # If not already set, set the external port interface will be exposed to. export SUBSCRIPTION_WS_EXT_PORT=${SUBSCRIPTION_WS_EXT_PORT:-"8765"} # If not already set, set the external port interface will be exposed to. export SUBSCRIPTION_WS_INT_PORT=${SUBSCRIPTION_WS_INT_PORT:-"8765"} ######################################################################################################################## # Automated steps start here ######################################################################################################################## Loading @@ -43,3 +43,16 @@ kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress -- echo echo "Subscription WebSocket Port Mapping" echo ">>> ExposeSubscription WebSocket port (${SUBSCRIPTION_WS_INT_PORT}->${SUBSCRIPTION_WS_INT_PORT})" PATCH='{"data": {"'${SUBSCRIPTION_WS_INT_PORT}'": "'${SUBSCRIPTION_WS_NAMESPACE}'/nbiservice:'${SUBSCRIPTION_WS_INT_PORT}'"}}' kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}" PORT_MAP='{"containerPort": '${SUBSCRIPTION_WS_INT_PORT}', "hostPort": '${SUBSCRIPTION_WS_INT_PORT}'}' CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}' PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}' kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}" echo
manifests/e2e_orchestratorservice.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ spec: - containerPort: 8765 env: - name: LOG_LEVEL value: "INFO" value: "DEBUG" readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10050"] Loading
my_deploy.sh +2 −2 Original line number Diff line number Diff line Loading @@ -57,10 +57,10 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" # Uncomment to activate VNT Manager #export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" Loading
src/e2e_orchestrator/service/E2EOrchestratorServiceServicerImpl.py +34 −14 Original line number Diff line number Diff line Loading @@ -21,13 +21,14 @@ from websockets.sync.client import connect import time from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestratorReply from common.proto.context_pb2 import Empty, Connection, EndPointId from common.proto.context_pb2 import Empty, Connection, EndPointId, Link, LinkId from common.proto.e2eorchestrator_pb2_grpc import E2EOrchestratorServiceServicer from context.client.ContextClient import ContextClient from context.service.database.uuids.EndPoint import endpoint_get_uuid from common.proto.vnt_manager_pb2 import VNTSubscriptionRequest, VNTSubscriptionReply from common.tools.grpc.Tools import grpc_message_to_json_string from websockets.sync.server import serve import json LOGGER = logging.getLogger(__name__) Loading @@ -36,10 +37,6 @@ METRICS_POOL = MetricsPool("E2EOrchestrator", "RPC") context_client: ContextClient = ContextClient() def event_received(websocket): for message in websocket: LOGGER.info("Message received!!!: {}".format(message)) websocket.send(message) class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): Loading @@ -52,7 +49,7 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): LOGGER.info("Requesting subscription") self.RequestSubscription() except Exception as E: LOGGER.info("Exception!: {}".format(E)) LOGGER.info("Exception0!: {}".format(E)) Loading Loading @@ -108,13 +105,17 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): path.connections.append(conn) def RequestSubscription(self): HOST = "10.1.1.83" PORT = str(8765) LOGGER.info("Trying to connect...!!!") OWN_HOST = "10.1.1.83" OWN_PORT = "8765" url = "ws://" + str(HOST) + ":" + str(PORT) EXT_HOST = "10.1.1.83" EXT_PORT = "8765" url = "ws://" + EXT_HOST + ":" + EXT_PORT request = VNTSubscriptionRequest() request.host = HOST request.port = PORT request.host = OWN_HOST request.port = OWN_PORT LOGGER.info("Trying to connect... to {}".format(url)) with connect(url, logger=LOGGER) as websocket: send = grpc_message_to_json_string(request) Loading @@ -132,13 +133,32 @@ class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): LOGGER.info('Exception2!: {}'.format(e)) with serve(event_received, HOST, PORT, logger=LOGGER) as server: LOGGER.info("Running subscription server...: {}:{}".format(HOST, str(PORT))) with serve(self._event_received, "0.0.0.0", OWN_PORT, logger=LOGGER) as server: LOGGER.info("Running subscription server...: {}:{}".format("0.0.0.0", OWN_PORT)) server.serve_forever() LOGGER.info("Exiting subscription server...") def _event_received(self, websocket): for message in websocket: LOGGER.info("Message received!!!: {}".format(message)) message_json = json.loads(message) if 'event_type' in message_json: pass elif 'link_id' in message_json: obj = Link(**message_json) if self._check_policies(obj): pass elif 'link_uuid' in message_json: obj = LinkId(**message_json) websocket.send(message) def _check_policies(self, link): return True
src/nbi/service/rest_server/nbi_plugins/tfs_api/Resources.py +8 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ from service.client.ServiceClient import ServiceClient from vnt_manager.client.VNTManagerClient import VNTManagerClient from .Tools import ( format_grpc_to_json, grpc_connection_id, grpc_context_id, grpc_device_id, grpc_link_id, grpc_policy_rule_id, format_grpc_to_json, grpc_connection_id, grpc_context_id, grpc_device_id, grpc_link, grpc_link_id, grpc_policy_rule_id, grpc_service_id, grpc_service, grpc_slice_id, grpc_topology_id) class _Resource(Resource): Loading Loading @@ -191,21 +191,21 @@ class Link(_Resource): class VirtualLinkIds(_Resource): def get(self): return format_grpc_to_json(self.vntmanager_client.ListLinkIds(Empty())) return format_grpc_to_json(self.vntmanager_client.ListVirtualLinkIds(Empty())) class VirtualLinks(_Resource): def get(self): return format_grpc_to_json(self.vntmanager_client.ListLinks(Empty())) return format_grpc_to_json(self.vntmanager_client.ListVirtualLinks(Empty())) class VirtualLink(_Resource): def get(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.GetLink(grpc_link_id(link_uuid))) def post(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.GetVirtualLink(grpc_link_id(link_uuid))) def post(self): link = request.get_json() return format_grpc_to_json(self.vntmanager_client.SetLink(grpc_link_id(link))) def put(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(grpc_link(link))) def put(self): link = request.get_json() return format_grpc_to_json(self.vntmanager_client.SetLink(grpc_link_id(link))) return format_grpc_to_json(self.vntmanager_client.SetVirtualLink(grpc_link(link))) def delete(self, link_uuid : str): return format_grpc_to_json(self.vntmanager_client.RemoveVirtualLink(grpc_link_id(link_uuid))) Loading