diff --git a/manifests/e2eorchestratorservice.yaml b/manifests/e2eorchestratorservice.yaml deleted file mode 100644 index acefd44b979fc149906d9af1323b134095c9290c..0000000000000000000000000000000000000000 --- a/manifests/e2eorchestratorservice.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: e2eorchestratorservice -spec: - selector: - matchLabels: - app: e2eorchestratorservice - template: - metadata: - labels: - app: e2eorchestratorservice - spec: - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: labs.etsi.org:5050/tfs/controller/e2eorchestrator:latest - imagePullPolicy: Always - ports: - - containerPort: 10050 - - containerPort: 9192 - env: - - name: LOG_LEVEL - value: "INFO" - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: redis-secrets - key: REDIS_PASSWORD - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:10050"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:10050"] - resources: - requests: - cpu: 250m - memory: 128Mi - limits: - cpu: 1000m - memory: 1024Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: e2eorchestratorservice - labels: - app: e2eorchestratorservice -spec: - type: ClusterIP - selector: - app: e2eorchestratorservice - ports: - - name: grpc - port: 10050 - targetPort: 10050 - - name: metrics - port: 9192 - targetPort: 9192 ---- -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: e2eorchestratorservice-hpa -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: e2eorchestratorservice - minReplicas: 1 - maxReplicas: 20 - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 80 - #behavior: - # scaleDown: - # stabilizationWindowSeconds: 30 diff --git a/my_deploy.sh b/my_deploy.sh index 73eb85fb54fba5a3d76828ecb5abf157253d6701..f1f2d580f2f77b90250715b8dd36e685a2ddef12 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -93,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="YES" +export CRDB_DROP_DATABASE_IF_EXISTS="" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" @@ -141,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="YES" +export QDB_DROP_TABLES_IF_EXIST="" # Disable flag for re-deploying QuestDB from scratch. export QDB_REDEPLOY="" diff --git a/proto/context.proto b/proto/context.proto deleted file mode 100644 index 7570a4596a0abd254d93c77131f03fa432cf09c7..0000000000000000000000000000000000000000 --- a/proto/context.proto +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package context; - -import "acl.proto"; -import "kpi_sample_types.proto"; - -service ContextService { - rpc ListContextIds (Empty ) returns ( ContextIdList ) {} - rpc ListContexts (Empty ) returns ( ContextList ) {} - rpc GetContext (ContextId ) returns ( Context ) {} - rpc SetContext (Context ) returns ( ContextId ) {} - rpc RemoveContext (ContextId ) returns ( Empty ) {} - rpc GetContextEvents (Empty ) returns (stream ContextEvent ) {} - - rpc ListTopologyIds (ContextId ) returns ( TopologyIdList ) {} - rpc ListTopologies (ContextId ) returns ( TopologyList ) {} - rpc GetTopology (TopologyId ) returns ( Topology ) {} - rpc GetTopologyDetails (TopologyId ) returns ( TopologyDetails ) {} - rpc SetTopology (Topology ) returns ( TopologyId ) {} - rpc RemoveTopology (TopologyId ) returns ( Empty ) {} - rpc GetTopologyEvents (Empty ) returns (stream TopologyEvent ) {} - - rpc ListDeviceIds (Empty ) returns ( DeviceIdList ) {} - rpc ListDevices (Empty ) returns ( DeviceList ) {} - rpc GetDevice (DeviceId ) returns ( Device ) {} - rpc SetDevice (Device ) returns ( DeviceId ) {} - rpc RemoveDevice (DeviceId ) returns ( Empty ) {} - rpc GetDeviceEvents (Empty ) returns (stream DeviceEvent ) {} - rpc SelectDevice (DeviceFilter ) returns ( DeviceList ) {} - rpc ListEndPointNames (EndPointIdList) returns ( EndPointNameList) {} - - rpc ListLinkIds (Empty ) returns ( LinkIdList ) {} - rpc ListLinks (Empty ) returns ( LinkList ) {} - rpc GetLink (LinkId ) returns ( Link ) {} - rpc SetLink (Link ) returns ( LinkId ) {} - rpc RemoveLink (LinkId ) returns ( Empty ) {} - rpc GetLinkEvents (Empty ) returns (stream LinkEvent ) {} - - rpc ListServiceIds (ContextId ) returns ( ServiceIdList ) {} - rpc ListServices (ContextId ) returns ( ServiceList ) {} - rpc GetService (ServiceId ) returns ( Service ) {} - rpc SetService (Service ) returns ( ServiceId ) {} - rpc UnsetService (Service ) returns ( ServiceId ) {} - rpc RemoveService (ServiceId ) returns ( Empty ) {} - rpc GetServiceEvents (Empty ) returns (stream ServiceEvent ) {} - rpc SelectService (ServiceFilter ) returns ( ServiceList ) {} - - rpc ListSliceIds (ContextId ) returns ( SliceIdList ) {} - rpc ListSlices (ContextId ) returns ( SliceList ) {} - rpc GetSlice (SliceId ) returns ( Slice ) {} - rpc SetSlice (Slice ) returns ( SliceId ) {} - rpc UnsetSlice (Slice ) returns ( SliceId ) {} - rpc RemoveSlice (SliceId ) returns ( Empty ) {} - rpc GetSliceEvents (Empty ) returns (stream SliceEvent ) {} - rpc SelectSlice (SliceFilter ) returns ( SliceList ) {} - - rpc ListConnectionIds (ServiceId ) returns ( ConnectionIdList) {} - rpc ListConnections (ServiceId ) returns ( ConnectionList ) {} - rpc GetConnection (ConnectionId ) returns ( Connection ) {} - rpc SetConnection (Connection ) returns ( ConnectionId ) {} - rpc RemoveConnection (ConnectionId ) returns ( Empty ) {} - rpc GetConnectionEvents(Empty ) returns (stream ConnectionEvent ) {} -} - -// ----- Generic ------------------------------------------------------------------------------------------------------- -message Empty {} - -message Uuid { - string uuid = 1; -} - -enum EventTypeEnum { - EVENTTYPE_UNDEFINED = 0; - EVENTTYPE_CREATE = 1; - EVENTTYPE_UPDATE = 2; - EVENTTYPE_REMOVE = 3; -} - -message Timestamp { - double timestamp = 1; -} - -message Event { - Timestamp timestamp = 1; - EventTypeEnum event_type = 2; -} - -// ----- Context ------------------------------------------------------------------------------------------------------- -message ContextId { - Uuid context_uuid = 1; -} - -message Context { - ContextId context_id = 1; - string name = 2; - repeated TopologyId topology_ids = 3; - repeated ServiceId service_ids = 4; - repeated SliceId slice_ids = 5; - TeraFlowController controller = 6; -} - -message ContextIdList { - repeated ContextId context_ids = 1; -} - -message ContextList { - repeated Context contexts = 1; -} - -message ContextEvent { - Event event = 1; - ContextId context_id = 2; -} - - -// ----- Topology ------------------------------------------------------------------------------------------------------ -message TopologyId { - ContextId context_id = 1; - Uuid topology_uuid = 2; -} - -message Topology { - TopologyId topology_id = 1; - string name = 2; - repeated DeviceId device_ids = 3; - repeated LinkId link_ids = 4; -} - -message TopologyDetails { - TopologyId topology_id = 1; - string name = 2; - repeated Device devices = 3; - repeated Link links = 4; -} - -message TopologyIdList { - repeated TopologyId topology_ids = 1; -} - -message TopologyList { - repeated Topology topologies = 1; -} - -message TopologyEvent { - Event event = 1; - TopologyId topology_id = 2; -} - - -// ----- Device -------------------------------------------------------------------------------------------------------- -message DeviceId { - Uuid device_uuid = 1; -} - -message Device { - DeviceId device_id = 1; - string name = 2; - string device_type = 3; - DeviceConfig device_config = 4; - DeviceOperationalStatusEnum device_operational_status = 5; - repeated DeviceDriverEnum device_drivers = 6; - repeated EndPoint device_endpoints = 7; - repeated Component components = 8; // Used for inventory - DeviceId controller_id = 9; // Identifier of node controlling the actual device -} - -message Component { //Defined previously to this section - Tested OK - Uuid component_uuid = 1; - string name = 2; - string type = 3; - - map<string, string> attributes = 4; // dict[attr.name => json.dumps(attr.value)] - string parent = 5; -} - -message DeviceConfig { - repeated ConfigRule config_rules = 1; -} - -enum DeviceDriverEnum { - DEVICEDRIVER_UNDEFINED = 0; // also used for emulated - DEVICEDRIVER_OPENCONFIG = 1; - DEVICEDRIVER_TRANSPORT_API = 2; - DEVICEDRIVER_P4 = 3; - DEVICEDRIVER_IETF_NETWORK_TOPOLOGY = 4; - DEVICEDRIVER_ONF_TR_532 = 5; - DEVICEDRIVER_XR = 6; - DEVICEDRIVER_IETF_L2VPN = 7; - DEVICEDRIVER_GNMI_OPENCONFIG = 8; - DEVICEDRIVER_FLEXSCALE = 9; -} - -enum DeviceOperationalStatusEnum { - DEVICEOPERATIONALSTATUS_UNDEFINED = 0; - DEVICEOPERATIONALSTATUS_DISABLED = 1; - DEVICEOPERATIONALSTATUS_ENABLED = 2; -} - -message DeviceIdList { - repeated DeviceId device_ids = 1; -} - -message DeviceList { - repeated Device devices = 1; -} - -message DeviceFilter { - DeviceIdList device_ids = 1; - bool include_endpoints = 2; - bool include_config_rules = 3; - bool include_components = 4; -} - -message DeviceEvent { - Event event = 1; - DeviceId device_id = 2; - DeviceConfig device_config = 3; -} - - -// ----- Link ---------------------------------------------------------------------------------------------------------- -message LinkId { - Uuid link_uuid = 1; -} - -message LinkAttributes { - float total_capacity_gbps = 1; - float used_capacity_gbps = 2; -} - -message Link { - LinkId link_id = 1; - string name = 2; - repeated EndPointId link_endpoint_ids = 3; - LinkAttributes attributes = 4; -} - -message LinkIdList { - repeated LinkId link_ids = 1; -} - -message LinkList { - repeated Link links = 1; -} - -message LinkEvent { - Event event = 1; - LinkId link_id = 2; -} - - -// ----- Service ------------------------------------------------------------------------------------------------------- -message ServiceId { - ContextId context_id = 1; - Uuid service_uuid = 2; -} - -message Service { - ServiceId service_id = 1; - string name = 2; - ServiceTypeEnum service_type = 3; - repeated EndPointId service_endpoint_ids = 4; - repeated Constraint service_constraints = 5; - ServiceStatus service_status = 6; - ServiceConfig service_config = 7; - Timestamp timestamp = 8; -} - -enum ServiceTypeEnum { - SERVICETYPE_UNKNOWN = 0; - SERVICETYPE_L3NM = 1; - SERVICETYPE_L2NM = 2; - SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3; - SERVICETYPE_TE = 4; - SERVICETYPE_E2E = 5; -} - -enum ServiceStatusEnum { - SERVICESTATUS_UNDEFINED = 0; - SERVICESTATUS_PLANNED = 1; - SERVICESTATUS_ACTIVE = 2; - SERVICESTATUS_UPDATING = 3; - SERVICESTATUS_PENDING_REMOVAL = 4; - SERVICESTATUS_SLA_VIOLATED = 5; -} - -message ServiceStatus { - ServiceStatusEnum service_status = 1; -} - -message ServiceConfig { - repeated ConfigRule config_rules = 1; -} - -message ServiceIdList { - repeated ServiceId service_ids = 1; -} - -message ServiceList { - repeated Service services = 1; -} - -message ServiceFilter { - ServiceIdList service_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_config_rules = 4; -} - -message ServiceEvent { - Event event = 1; - ServiceId service_id = 2; -} - -// ----- Slice --------------------------------------------------------------------------------------------------------- -message SliceId { - ContextId context_id = 1; - Uuid slice_uuid = 2; -} - -message Slice { - SliceId slice_id = 1; - string name = 2; - repeated EndPointId slice_endpoint_ids = 3; - repeated Constraint slice_constraints = 4; - repeated ServiceId slice_service_ids = 5; - repeated SliceId slice_subslice_ids = 6; - SliceStatus slice_status = 7; - SliceConfig slice_config = 8; - SliceOwner slice_owner = 9; - Timestamp timestamp = 10; -} - -message SliceOwner { - Uuid owner_uuid = 1; - string owner_string = 2; -} - -enum SliceStatusEnum { - SLICESTATUS_UNDEFINED = 0; - SLICESTATUS_PLANNED = 1; - SLICESTATUS_INIT = 2; - SLICESTATUS_ACTIVE = 3; - SLICESTATUS_DEINIT = 4; - SLICESTATUS_SLA_VIOLATED = 5; -} - -message SliceStatus { - SliceStatusEnum slice_status = 1; -} - -message SliceConfig { - repeated ConfigRule config_rules = 1; -} - -message SliceIdList { - repeated SliceId slice_ids = 1; -} - -message SliceList { - repeated Slice slices = 1; -} - -message SliceFilter { - SliceIdList slice_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_service_ids = 4; - bool include_subslice_ids = 5; - bool include_config_rules = 6; -} - -message SliceEvent { - Event event = 1; - SliceId slice_id = 2; -} - -// ----- Connection ---------------------------------------------------------------------------------------------------- -message ConnectionId { - Uuid connection_uuid = 1; -} - -message ConnectionSettings_L0 { - string lsp_symbolic_name = 1; -} - -message ConnectionSettings_L2 { - string src_mac_address = 1; - string dst_mac_address = 2; - uint32 ether_type = 3; - uint32 vlan_id = 4; - uint32 mpls_label = 5; - uint32 mpls_traffic_class = 6; -} - -message ConnectionSettings_L3 { - string src_ip_address = 1; - string dst_ip_address = 2; - uint32 dscp = 3; - uint32 protocol = 4; - uint32 ttl = 5; -} - -message ConnectionSettings_L4 { - uint32 src_port = 1; - uint32 dst_port = 2; - uint32 tcp_flags = 3; - uint32 ttl = 4; -} - -message ConnectionSettings { - ConnectionSettings_L0 l0 = 1; - ConnectionSettings_L2 l2 = 2; - ConnectionSettings_L3 l3 = 3; - ConnectionSettings_L4 l4 = 4; -} - -message Connection { - ConnectionId connection_id = 1; - ServiceId service_id = 2; - repeated EndPointId path_hops_endpoint_ids = 3; - repeated ServiceId sub_service_ids = 4; - ConnectionSettings settings = 5; -} - -message ConnectionIdList { - repeated ConnectionId connection_ids = 1; -} - -message ConnectionList { - repeated Connection connections = 1; -} - -message ConnectionEvent { - Event event = 1; - ConnectionId connection_id = 2; -} - - -// ----- Endpoint ------------------------------------------------------------------------------------------------------ -message EndPointId { - TopologyId topology_id = 1; - DeviceId device_id = 2; - Uuid endpoint_uuid = 3; -} - -message EndPoint { - EndPointId endpoint_id = 1; - string name = 2; - string endpoint_type = 3; - repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4; - Location endpoint_location = 5; -} - -message EndPointName { - EndPointId endpoint_id = 1; - string device_name = 2; - string endpoint_name = 3; - string endpoint_type = 4; -} - -message EndPointIdList { - repeated EndPointId endpoint_ids = 1; -} - -message EndPointNameList { - repeated EndPointName endpoint_names = 1; -} - - -// ----- Configuration ------------------------------------------------------------------------------------------------- -enum ConfigActionEnum { - CONFIGACTION_UNDEFINED = 0; - CONFIGACTION_SET = 1; - CONFIGACTION_DELETE = 2; -} - -message ConfigRule_Custom { - string resource_key = 1; - string resource_value = 2; -} - -message ConfigRule_ACL { - EndPointId endpoint_id = 1; - acl.AclRuleSet rule_set = 2; -} - -message ConfigRule { - ConfigActionEnum action = 1; - oneof config_rule { - ConfigRule_Custom custom = 2; - ConfigRule_ACL acl = 3; - } -} - - -// ----- Constraint ---------------------------------------------------------------------------------------------------- -enum ConstraintActionEnum { - CONSTRAINTACTION_UNDEFINED = 0; - CONSTRAINTACTION_SET = 1; - CONSTRAINTACTION_DELETE = 2; -} - -message Constraint_Custom { - string constraint_type = 1; - string constraint_value = 2; -} - -message Constraint_Schedule { - float start_timestamp = 1; - float duration_days = 2; -} - -message GPS_Position { - float latitude = 1; - float longitude = 2; -} - -message Location { - oneof location { - string region = 1; - GPS_Position gps_position = 2; - } -} - -message Constraint_EndPointLocation { - EndPointId endpoint_id = 1; - Location location = 2; -} - -message Constraint_EndPointPriority { - EndPointId endpoint_id = 1; - uint32 priority = 2; -} - -message Constraint_SLA_Latency { - float e2e_latency_ms = 1; -} - -message Constraint_SLA_Capacity { - float capacity_gbps = 1; -} - -message Constraint_SLA_Availability { - uint32 num_disjoint_paths = 1; - bool all_active = 2; - float availability = 3; // 0.0 .. 100.0 percentage of availability -} - -enum IsolationLevelEnum { - NO_ISOLATION = 0; - PHYSICAL_ISOLATION = 1; - LOGICAL_ISOLATION = 2; - PROCESS_ISOLATION = 3; - PHYSICAL_MEMORY_ISOLATION = 4; - PHYSICAL_NETWORK_ISOLATION = 5; - VIRTUAL_RESOURCE_ISOLATION = 6; - NETWORK_FUNCTIONS_ISOLATION = 7; - SERVICE_ISOLATION = 8; -} - -message Constraint_SLA_Isolation_level { - repeated IsolationLevelEnum isolation_level = 1; -} - -message Constraint_Exclusions { - bool is_permanent = 1; - repeated DeviceId device_ids = 2; - repeated EndPointId endpoint_ids = 3; - repeated LinkId link_ids = 4; -} - -message Constraint { - ConstraintActionEnum action = 1; - oneof constraint { - Constraint_Custom custom = 2; - Constraint_Schedule schedule = 3; - Constraint_EndPointLocation endpoint_location = 4; - Constraint_EndPointPriority endpoint_priority = 5; - Constraint_SLA_Capacity sla_capacity = 6; - Constraint_SLA_Latency sla_latency = 7; - Constraint_SLA_Availability sla_availability = 8; - Constraint_SLA_Isolation_level sla_isolation = 9; - Constraint_Exclusions exclusions = 10; - } -} - - -// ----- Miscellaneous ------------------------------------------------------------------------------------------------- -message TeraFlowController { - ContextId context_id = 1; - string ip_address = 2; - uint32 port = 3; -} - -message AuthenticationResult { - ContextId context_id = 1; - bool authenticated = 2; -} diff --git a/proto/e2eorchestrator.proto b/proto/e2eorchestrator.proto deleted file mode 100644 index 9eed8523e52faa32d4397bb4635a1cf0c56aa4d5..0000000000000000000000000000000000000000 --- a/proto/e2eorchestrator.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -// protocol buffers documentation: https://developers.google.com/protocol-buffers/docs/proto3 -syntax = "proto3"; -package orchestrator; - -import "context.proto"; - - -service E2EOrchestratorService { - rpc Compute(E2EOrchestratorRequest) returns (E2EOrchestratorReply) {} -} - -message E2EOrchestratorRequest { - context.Service service = 1; -} - -message E2EOrchestratorReply { - // Service requested completed with possible missing fields, and - // sub-services required for supporting requested service on the - // underlying layers. - repeated context.Service services = 1; - - // Connections supporting the requested service and sub-services - // required for the underlying layers. - repeated context.Connection connections = 2; -} \ No newline at end of file diff --git a/scripts/show_logs_e2eorchestrator.sh b/scripts/show_logs_e2eorchestrator.sh deleted file mode 100755 index 84951ed8dc24c145715c971b76cd22b79a920f98..0000000000000000000000000000000000000000 --- a/scripts/show_logs_e2eorchestrator.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -######################################################################################################################## -# Define your deployment settings here -######################################################################################################################## - -# If not already set, set the name of the Kubernetes namespace to deploy to. -export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} - -######################################################################################################################## -# Automated steps start here -######################################################################################################################## - -kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/e2eorchestratorservice -c server diff --git a/src/common/Constants.py b/src/common/Constants.py index 30aa09b4caa34a54dd54126195b3f322c07c932e..79d5bb3b5675dfda8f31d84a935c6d16ee3791f7 100644 --- a/src/common/Constants.py +++ b/src/common/Constants.py @@ -58,7 +58,6 @@ class ServiceNameEnum(Enum): CACHING = 'caching' TE = 'te' FORECASTER = 'forecaster' - E2EORCHESTRATOR = 'e2eorchestrator' # Used for test and debugging only DLT_GATEWAY = 'dltgateway' @@ -85,7 +84,6 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.PATHCOMP .value : 10020, ServiceNameEnum.TE .value : 10030, ServiceNameEnum.FORECASTER .value : 10040, - ServiceNameEnum.E2EORCHESTRATOR .value : 10050, # Used for test and debugging only ServiceNameEnum.DLT_GATEWAY .value : 50051, diff --git a/src/e2eorchestrator/.gitlab-ci.yml b/src/e2eorchestrator/.gitlab-ci.yml deleted file mode 100644 index a14a215afc33067e923a7064b8f4617c61f4de9d..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/.gitlab-ci.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -# build, tag and push the Docker image to the gitlab registry -build e2eorchestrator: - variables: - IMAGE_NAME: 'e2eorchestrator' # name of the microservice - IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) - stage: build - before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - script: - - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile . - - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - after_script: - - docker images --filter="dangling=true" --quiet | xargs -r docker rmi - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' - - changes: - - src/$IMAGE_NAME/**/*.{py,in,yml} - - src/$IMAGE_NAME/Dockerfile - - src/$IMAGE_NAME/tests/*.py - - src/$IMAGE_NAME/tests/Dockerfile - - manifests/${IMAGE_NAME}service.yaml - - .gitlab-ci.yml diff --git a/src/e2eorchestrator/Config.py b/src/e2eorchestrator/Config.py deleted file mode 100644 index 38d04994fb0fa1951fb465bc127eb72659dc2eaf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/Config.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. diff --git a/src/e2eorchestrator/Dockerfile b/src/e2eorchestrator/Dockerfile deleted file mode 100644 index 52bd806f5c52c4033fb4fa54a0ee4ff773e901b4..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/Dockerfile +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -FROM python:3.9-slim - -# Install dependencies -RUN apt-get --yes --quiet --quiet update && \ - apt-get --yes --quiet --quiet install wget g++ && \ - rm -rf /var/lib/apt/lists/* - -# Set Python to show logs as they occur -ENV PYTHONUNBUFFERED=0 -ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python - -# Download the gRPC health probe -RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \ - wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ - chmod +x /bin/grpc_health_probe - -# Creating a user for security reasons -RUN groupadd -r teraflow && useradd -u 1001 --no-log-init -r -m -g teraflow teraflow -USER teraflow - -# set working directory -RUN mkdir -p /home/teraflow/controller/common/ -WORKDIR /home/teraflow/controller - -# Get Python packages per module -ENV VIRTUAL_ENV=/home/teraflow/venv -RUN python3 -m venv ${VIRTUAL_ENV} -ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" - -# Get generic Python packages -RUN python3 -m pip install --upgrade pip -RUN python3 -m pip install --upgrade setuptools wheel -RUN python3 -m pip install --upgrade pip-tools - -# Get common Python packages -# Note: this step enables sharing the previous Docker build steps among all the Python components -COPY --chown=teraflow:teraflow common_requirements.in common_requirements.in -RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in -RUN python3 -m pip install -r common_requirements.txt - -# Add common files into working directory -WORKDIR /home/teraflow/controller/common -COPY --chown=teraflow:teraflow src/common/. ./ -RUN rm -rf proto - -# Create proto sub-folder, copy .proto files, and generate Python code -RUN mkdir -p /home/teraflow/controller/common/proto -WORKDIR /home/teraflow/controller/common/proto -RUN touch __init__.py -COPY --chown=teraflow:teraflow proto/*.proto ./ -RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto -RUN rm *.proto -RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \; - -# Create module sub-folders -RUN mkdir -p /home/teraflow/controller/e2eorchestrator -WORKDIR /home/teraflow/controller - -# Get Python packages per module -COPY --chown=teraflow:teraflow ./src/e2eorchestrator/requirements.in e2eorchestrator/requirements.in -# consider common and specific requirements to avoid inconsistencies with dependencies -RUN pip-compile --quiet --output-file=e2eorchestrator/requirements.txt e2eorchestrator/requirements.in common_requirements.in -RUN python3 -m pip install -r e2eorchestrator/requirements.txt - -# Add component files into working directory -COPY --chown=teraflow:teraflow ./src/context/. context -COPY --chown=teraflow:teraflow ./src/e2eorchestrator/. e2eorchestrator - -# Start the service -ENTRYPOINT ["python", "-m", "e2eorchestrator.service"] diff --git a/src/e2eorchestrator/__init__.py b/src/e2eorchestrator/__init__.py deleted file mode 100644 index 38d04994fb0fa1951fb465bc127eb72659dc2eaf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. diff --git a/src/e2eorchestrator/client/E2EOrchestratorClient.py b/src/e2eorchestrator/client/E2EOrchestratorClient.py deleted file mode 100644 index 10f183a51a64671a3cc97cc2c13d23ffd55c03fb..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/client/E2EOrchestratorClient.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging - -import grpc - -from common.Constants import ServiceNameEnum -from common.proto.context_pb2 import Empty -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 -DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) -RETRY_DECORATOR = retry( - max_retries=MAX_RETRIES, - delay_function=DELAY_FUNCTION, - prepare_method_name="connect", -) - - -class E2EOrchestratorClient: - def __init__(self, host=None, port=None): - if not host: - host = get_service_host(ServiceNameEnum.E2EORCHESTRATOR) - if not port: - port = get_service_port_grpc(ServiceNameEnum.E2EORCHESTRATOR) - self.endpoint = "{:s}:{:s}".format(str(host), str(port)) - LOGGER.debug("Creating channel to {:s}...".format(str(self.endpoint))) - self.channel = None - self.stub = None - self.connect() - LOGGER.debug("Channel created") - - def connect(self): - self.channel = grpc.insecure_channel(self.endpoint) - self.stub = E2EOrchestratorServiceStub(self.channel) - - def close(self): - if self.channel is not None: - self.channel.close() - self.channel = None - self.stub = None - - @RETRY_DECORATOR - def Compute(self, request: E2EOrchestratorRequest) -> E2EOrchestratorReply: - LOGGER.info( - "Compute request: {:s}".format(str(grpc_message_to_json(request))) - ) - response = self.stub.Compute(request) - LOGGER.info( - "Compute result: {:s}".format(str(grpc_message_to_json(response))) - ) - return response diff --git a/src/e2eorchestrator/client/__init__.py b/src/e2eorchestrator/client/__init__.py deleted file mode 100644 index 38d04994fb0fa1951fb465bc127eb72659dc2eaf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/client/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. diff --git a/src/e2eorchestrator/requirements.in b/src/e2eorchestrator/requirements.in deleted file mode 100644 index 4c4720a2df4482faeda1ad99f9d383ebb5c0f848..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/requirements.in +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -networkx \ No newline at end of file diff --git a/src/e2eorchestrator/service/E2EOrchestratorService.py b/src/e2eorchestrator/service/E2EOrchestratorService.py deleted file mode 100644 index 4d6125d4a11210786de5cb83970743f480d4c8cf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/service/E2EOrchestratorService.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging - -from common.Constants import ServiceNameEnum -from common.proto.e2eorchestrator_pb2_grpc import add_E2EOrchestratorServiceServicer_to_server -from common.Settings import get_service_port_grpc -from common.tools.service.GenericGrpcService import GenericGrpcService -from .E2EOrchestratorServiceServicerImpl import E2EOrchestratorServiceServicerImpl - -LOGGER = logging.getLogger(__name__) - - -class E2EOrchestratorService(GenericGrpcService): - def __init__(self, cls_name: str = __name__): - port = get_service_port_grpc(ServiceNameEnum.E2EORCHESTRATOR) - super().__init__(port, cls_name=cls_name) - self.e2eorchestrator_servicer = E2EOrchestratorServiceServicerImpl() - - def install_servicers(self): - add_E2EOrchestratorServiceServicer_to_server( - self.e2eorchestrator_servicer, self.server - ) diff --git a/src/e2eorchestrator/service/E2EOrchestratorServiceServicerImpl.py b/src/e2eorchestrator/service/E2EOrchestratorServiceServicerImpl.py deleted file mode 100644 index d233f2e17a6485d425013ab4064501bc0bad84bf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/service/E2EOrchestratorServiceServicerImpl.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging - -import networkx as nx -import grpc -import copy - -from common.Constants import ServiceNameEnum -from common.method_wrappers.Decorator import (MetricsPool, MetricTypeEnum, 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.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__) - -METRICS_POOL = MetricsPool("E2EOrchestrator", "RPC") - -context_client: ContextClient = ContextClient() - - -class E2EOrchestratorServiceServicerImpl(E2EOrchestratorServiceServicer): - def __init__(self): - LOGGER.debug("Creating Servicer...") - LOGGER.debug("Servicer Created") - - @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.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_id.endpoint_uuid.uuid - for endpoint in device.device_endpoints] - for ep in endpoints_uuids: - graph.add_node(ep) - - for ep in endpoints_uuids: - for ep_i in endpoints_uuids: - if ep == ep_i: - continue - graph.add_edge(ep, ep_i) - - links = context_client.ListLinks(Empty()).links - for link in links: - eps = [] - for endpoint_id in link.link_endpoint_ids: - eps.append(endpoint_id.endpoint_uuid.uuid) - graph.add_edge(eps[0], eps[1]) - - - shortest = nx.shortest_path(graph, endpoints_ids[0], endpoints_ids[1]) - - path = E2EOrchestratorReply() - path.services.append(copy.deepcopy(request.service)) - 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) - - ep_a_id = EndPointId() - ep_a_id.endpoint_uuid.uuid = ep_a_uuid - conn.path_hops_endpoint_ids.append(ep_a_id) - - 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) - - return path diff --git a/src/e2eorchestrator/service/__init__.py b/src/e2eorchestrator/service/__init__.py deleted file mode 100644 index 38d04994fb0fa1951fb465bc127eb72659dc2eaf..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/service/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. diff --git a/src/e2eorchestrator/service/__main__.py b/src/e2eorchestrator/service/__main__.py deleted file mode 100644 index a586543a7078d9b7f868967ad7eea7d228985086..0000000000000000000000000000000000000000 --- a/src/e2eorchestrator/service/__main__.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging -import signal -import sys -import threading - -from prometheus_client import start_http_server - -from common.Constants import ServiceNameEnum -from common.Settings import (ENVVAR_SUFIX_SERVICE_HOST, - ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, - get_log_level, get_metrics_port, - wait_for_environment_variables) - -from .E2EOrchestratorService import E2EOrchestratorService - -terminate = threading.Event() -LOGGER = None - - -def signal_handler(signal, frame): # pylint: disable=redefined-outer-name - LOGGER.warning("Terminate signal received") - terminate.set() - - -def main(): - global LOGGER # pylint: disable=global-statement - - log_level = get_log_level() - logging.basicConfig(level=log_level) - LOGGER = logging.getLogger(__name__) - - wait_for_environment_variables( - [ - get_env_var_name(ServiceNameEnum.E2EORCHESTRATOR, ENVVAR_SUFIX_SERVICE_HOST), - get_env_var_name(ServiceNameEnum.E2EORCHESTRATOR, ENVVAR_SUFIX_SERVICE_PORT_GRPC), - ] - ) - - signal.signal(signal.SIGINT, signal_handler) - signal.signal(signal.SIGTERM, signal_handler) - - LOGGER.info("Starting...") - - # Start metrics server - metrics_port = get_metrics_port() - start_http_server(metrics_port) - - # Starting CentralizedCybersecurity service - grpc_service = E2EOrchestratorService() - grpc_service.start() - LOGGER.info("Started...") - # Wait for Ctrl+C or termination signal - - while not terminate.wait(timeout=1): - pass - - - LOGGER.info("Terminating...") - grpc_service.stop() - - LOGGER.info("Bye") - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/src/service/Dockerfile b/src/service/Dockerfile index 3926770f887d20d7c6bb93ce787bf7550bc38f92..fc431decabe2e1c90b6dcd0dfcfcc72090571751 100644 --- a/src/service/Dockerfile +++ b/src/service/Dockerfile @@ -66,7 +66,6 @@ COPY src/context/. context/ COPY src/device/. device/ COPY src/pathcomp/frontend/. pathcomp/frontend/ COPY src/service/. service/ -COPY src/e2eorchestrator/. e2eorchestrator/ # Start the service ENTRYPOINT ["python", "-m", "service.service"] diff --git a/src/service/service/ServiceServiceServicerImpl.py b/src/service/service/ServiceServiceServicerImpl.py index c5d305141c282c2f567855ba645a1ad6bf1c8e2a..f79e3e5f3aa983aacda3163682737cdf0ff6be03 100644 --- a/src/service/service/ServiceServiceServicerImpl.py +++ b/src/service/service/ServiceServiceServicerImpl.py @@ -21,12 +21,10 @@ from common.method_wrappers.ServiceExceptions import ( from common.proto.context_pb2 import ( Connection, Empty, Service, ServiceId, ServiceStatusEnum, ServiceTypeEnum, ConstraintActionEnum) from common.proto.pathcomp_pb2 import PathCompRequest -from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest, E2EOrchestratorReply 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.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 @@ -34,7 +32,6 @@ from .service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory from .task_scheduler.TaskScheduler import TasksScheduler from .tools.GeodesicDistance import gps_distance - LOGGER = logging.getLogger(__name__) METRICS_POOL = MetricsPool('Service', 'RPC') @@ -156,32 +153,6 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): str_service_status = ServiceStatusEnum.Name(service_status.service_status) raise Exception(MSG.format(service_key, str_service_status)) - if service.service_type == ServiceTypeEnum.SERVICETYPE_E2E: - # End-to-End service: - service_id_with_uuids = context_client.SetService(request) - - service_with_uuids = get_service_by_id( - context_client, service_id_with_uuids, rw_copy=False, - include_config_rules=True, include_constraints=True, include_endpoint_ids=True) - - e2e_orch_request = E2EOrchestratorRequest() - e2e_orch_request.service.CopyFrom(service_with_uuids) - - 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 - # inter-dependencies among the services and connections retrieved and produces a - # schedule of tasks (an ordered list of tasks to be executed) to implement the - # requested create/update operation. - tasks_scheduler = TasksScheduler(self.service_handler_factory) - # e2e_orch_reply should be compatible with pathcomp_reply - # TODO: if we extend e2e_orch_reply, implement method TasksScheduler::compose_from_e2eorchreply() - tasks_scheduler.compose_from_pathcompreply(e2e_orch_reply, is_delete=False) - tasks_scheduler.execute_all() - return service_with_uuids.service_id - - # Normal service del service.service_endpoint_ids[:] # pylint: disable=no-member for endpoint_id in request.service_endpoint_ids: diff --git a/src/service/service/service_handler_api/FilterFields.py b/src/service/service/service_handler_api/FilterFields.py index 35c45c99699b5bc640639cde3054ef72bbb6de50..f4a14a5a537a9e0e990b2996c9721107b71d3360 100644 --- a/src/service/service/service_handler_api/FilterFields.py +++ b/src/service/service/service_handler_api/FilterFields.py @@ -38,7 +38,6 @@ DEVICE_DRIVER_VALUES = { DeviceDriverEnum.DEVICEDRIVER_XR, DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN, DeviceDriverEnum.DEVICEDRIVER_GNMI_OPENCONFIG, - DeviceDriverEnum.DEVICEDRIVER_FLEXSCALE, } # Map allowed filter fields to allowed values per Filter field. If no restriction (free text) None is specified diff --git a/src/service/service/service_handlers/__init__.py b/src/service/service/service_handlers/__init__.py index dd96db2af43c65673ea871f1da1ac371d39e8a11..32df661a241bd1045e92960d16ce63c4dfc1758d 100644 --- a/src/service/service/service_handlers/__init__.py +++ b/src/service/service/service_handlers/__init__.py @@ -88,10 +88,4 @@ SERVICE_HANDLERS = [ FilterFieldEnum.DEVICE_DRIVER : [DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN], } ]), - (E2EOrchestratorServiceHandler, [ - { - FilterFieldEnum.SERVICE_TYPE : ServiceTypeEnum.SERVICETYPE_E2E, - FilterFieldEnum.DEVICE_DRIVER : [DeviceDriverEnum.DEVICEDRIVER_FLEXSCALE], - } - ]), ] diff --git a/src/service/service/service_handlers/e2e_orch/E2EOrchestratorServiceHandler.py b/src/service/service/service_handlers/e2e_orch/E2EOrchestratorServiceHandler.py deleted file mode 100644 index 5a068bb515793179e5f4c9169fb00dc0ce292384..0000000000000000000000000000000000000000 --- a/src/service/service/service_handlers/e2e_orch/E2EOrchestratorServiceHandler.py +++ /dev/null @@ -1,176 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 json, logging -from typing import Any, Dict, List, Optional, Tuple, Union -from common.method_wrappers.Decorator import MetricsPool, metered_subclass_method -from common.proto.context_pb2 import ConfigRule, DeviceId, Service -from common.tools.object_factory.ConfigRule import json_config_rule_set -from common.tools.object_factory.Device import json_device_id -from common.type_checkers.Checkers import chk_type -from service.service.service_handler_api.Tools import get_device_endpoint_uuids -from service.service.service_handler_api._ServiceHandler import _ServiceHandler -from service.service.service_handler_api.SettingsHandler import SettingsHandler -from service.service.task_scheduler.TaskExecutor import TaskExecutor - -LOGGER = logging.getLogger(__name__) - -METRICS_POOL = MetricsPool('Service', 'Handler', labels={'handler': 'e2e_orch'}) - -class E2EOrchestratorServiceHandler(_ServiceHandler): - def __init__( # pylint: disable=super-init-not-called - self, service : Service, task_executor : TaskExecutor, **settings - ) -> None: - self.__service = service - self.__task_executor = task_executor - self.__settings_handler = SettingsHandler(service.service_config, **settings) - - @metered_subclass_method(METRICS_POOL) - def SetEndpoint( - self, endpoints : List[Tuple[str, str, Optional[str]]], connection_uuid : Optional[str] = None - ) -> List[Union[bool, Exception]]: - - chk_type('endpoints', endpoints, list) - if len(endpoints) < 2: return [] - - service_uuid = self.__service.service_id.service_uuid.uuid - settings = self.__settings_handler.get('/settings') - json_settings : Dict = {} if settings is None else settings.value - bitrate = json_settings.get('bitrate', 1000) - - results = [] - try: - src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) - src_device = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) - src_controller = self.__task_executor.get_device_controller(src_device) - if src_controller is None: src_controller = src_device - - dst_device_uuid, dst_endpoint_uuid = get_device_endpoint_uuids(endpoints[-1]) - dst_device = self.__task_executor.get_device(DeviceId(**json_device_id(dst_device_uuid))) - dst_controller = self.__task_executor.get_device_controller(dst_device) - if dst_controller is None: dst_controller = dst_device - - controller = src_controller - - json_config_rule = json_config_rule_set('/services/service[{:s}]'.format(service_uuid), { - 'uuid' : service_uuid, - 'src_node' : src_endpoint_uuid, - 'dst_node' : dst_endpoint_uuid, - 'bitrate' : bitrate - }) - del controller.device_config.config_rules[:] - controller.device_config.config_rules.append(ConfigRule(**json_config_rule)) - self.__task_executor.configure_device(controller) - results.append(True) - except Exception as e: # pylint: disable=broad-except - LOGGER.exception('Unable to SetEndpoint for Service({:s})'.format(str(service_uuid))) - results.append(e) - - return results - - @metered_subclass_method(METRICS_POOL) - def DeleteEndpoint( - self, endpoints : List[Tuple[str, str, Optional[str]]], connection_uuid : Optional[str] = None - ) -> List[Union[bool, Exception]]: - - chk_type('endpoints', endpoints, list) - if len(endpoints) < 2: return [] - - service_uuid = self.__service.service_id.service_uuid.uuid - settings = self.__settings_handler.get('/settings') - json_settings : Dict = {} if settings is None else settings.value - flow_id = json_settings.get('flow_id', 100) - bitrate = json_settings.get('bitrate', 1000) - - results = [] - try: - src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) - src_device = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) - src_controller = self.__task_executor.get_device_controller(src_device) - if src_controller is None: src_controller = src_device - - dst_device_uuid, dst_endpoint_uuid = get_device_endpoint_uuids(endpoints[1]) - dst_device = self.__task_executor.get_device(DeviceId(**json_device_id(dst_device_uuid))) - dst_controller = self.__task_executor.get_device_controller(dst_device) - if dst_controller is None: dst_controller = dst_device - - controller = src_controller - - json_config_rule = json_config_rule_set('/services/service[{:s}]'.format(service_uuid), { - 'uuid' : service_uuid, - 'flow_id' : flow_id, - 'src_node' : src_endpoint_uuid, - 'dst_node' : dst_endpoint_uuid, - 'bitrate' : bitrate - }) - - del controller.device_config.config_rules[:] - controller.device_config.config_rules.append(ConfigRule(**json_config_rule)) - self.__task_executor.configure_device(controller) - results.append(True) - except Exception as e: # pylint: disable=broad-except - LOGGER.exception('Unable to DeleteEndpoint for Service({:s})'.format(str(service_uuid))) - results.append(e) - - return results - - @metered_subclass_method(METRICS_POOL) - def SetConstraint(self, constraints : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: - chk_type('constraints', constraints, list) - if len(constraints) == 0: return [] - - msg = '[SetConstraint] Method not implemented. Constraints({:s}) are being ignored.' - LOGGER.warning(msg.format(str(constraints))) - return [True for _ in range(len(constraints))] - - @metered_subclass_method(METRICS_POOL) - def DeleteConstraint(self, constraints : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: - chk_type('constraints', constraints, list) - if len(constraints) == 0: return [] - - msg = '[DeleteConstraint] Method not implemented. Constraints({:s}) are being ignored.' - LOGGER.warning(msg.format(str(constraints))) - return [True for _ in range(len(constraints))] - - @metered_subclass_method(METRICS_POOL) - def SetConfig(self, resources : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: - chk_type('resources', resources, list) - if len(resources) == 0: return [] - - results = [] - for resource in resources: - try: - resource_value = json.loads(resource[1]) - self.__settings_handler.set(resource[0], resource_value) - results.append(True) - except Exception as e: # pylint: disable=broad-except - LOGGER.exception('Unable to SetConfig({:s})'.format(str(resource))) - results.append(e) - - return results - - @metered_subclass_method(METRICS_POOL) - def DeleteConfig(self, resources : List[Tuple[str, Any]]) -> List[Union[bool, Exception]]: - chk_type('resources', resources, list) - if len(resources) == 0: return [] - - results = [] - for resource in resources: - try: - self.__settings_handler.delete(resource[0]) - except Exception as e: # pylint: disable=broad-except - LOGGER.exception('Unable to DeleteConfig({:s})'.format(str(resource))) - results.append(e) - - return results diff --git a/src/service/service/service_handlers/e2e_orch/__init__.py b/src/service/service/service_handlers/e2e_orch/__init__.py deleted file mode 100644 index 1549d9811aa5d1c193a44ad45d0d7773236c0612..0000000000000000000000000000000000000000 --- a/src/service/service/service_handlers/e2e_orch/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - diff --git a/src/tests/Fixtures.py b/src/tests/Fixtures.py index 78a470b54e61bd09b6b4587f3077d3651b6e99c0..55ef90340dd3f32460ca30fd4a64801f7bf45974 100644 --- a/src/tests/Fixtures.py +++ b/src/tests/Fixtures.py @@ -16,16 +16,8 @@ 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(): _client = ContextClient() @@ -44,8 +36,3 @@ def monitoring_client(): yield _client _client.close() -@pytest.fixture(scope='session') -def e2eorchestrator_client(): - _client = E2EOrchestratorClient() - yield _client - _client.close() diff --git a/src/tests/e2e_orchestrator/__init__.py b/src/tests/e2e_orchestrator/__init__.py deleted file mode 100644 index 1549d9811aa5d1c193a44ad45d0d7773236c0612..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - diff --git a/src/tests/e2e_orchestrator/deploy_specs.sh b/src/tests/e2e_orchestrator/deploy_specs.sh deleted file mode 100755 index e938419177474a77f4dc702c5c1b6236a3d6c2f9..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/deploy_specs.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - - -# ----- TeraFlowSDN ------------------------------------------------------------ - -# Set the URL of the internal MicroK8s Docker registry where the images will be uploaded to. -export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" - -# Set the list of components, separated by spaces, you want to build images for, and deploy. -#export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" -export TFS_COMPONENTS="context device pathcomp service slice nbi webui" - -# Uncomment to activate Monitoring -# export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" - -# Uncomment to activate ZTP and Policy Manager -#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp policy" -# export TFS_COMPONENTS="${TFS_COMPONENTS} ztp" - -# Uncomment to activate Optical CyberSecurity -#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager" - -# Uncomment to activate L3 CyberSecurity -#export TFS_COMPONENTS="${TFS_COMPONENTS} l3_attackmitigator l3_centralizedattackdetector" - -# Uncomment to activate TE -#export TFS_COMPONENTS="${TFS_COMPONENTS} te" - -# 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" - -# Set the name of the Kubernetes namespace to deploy TFS to. -export TFS_K8S_NAMESPACE="tfs" - -# Set additional manifest files to be applied after the deployment -export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" - -# Uncomment to monitor performance of components -export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/servicemonitors.yaml" - -# Uncomment when deploying Optical CyberSecurity -#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/cachingservice.yaml" - -# Set the new Grafana admin password -export TFS_GRAFANA_PASSWORD="admin123+" - -# Disable skip-build flag to rebuild the Docker images. -export TFS_SKIP_BUILD="" - - -# ----- CockroachDB ------------------------------------------------------------ - -# Set the namespace where CockroackDB will be deployed. -export CRDB_NAMESPACE="crdb" - -# Set the external port CockroackDB Postgre SQL interface will be exposed to. -export CRDB_EXT_PORT_SQL="26257" - -# Set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to. -export CRDB_EXT_PORT_HTTP="8081" - -# Set the database username to be used by Context. -export CRDB_USERNAME="tfs" - -# Set the database user's password to be used by Context. -export CRDB_PASSWORD="tfs123" - -# Set the database name to be used by Context. -export CRDB_DATABASE="tfs" - -# Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. -# See ./deploy/all.sh or ./deploy/crdb.sh for additional details -export CRDB_DEPLOY_MODE="single" - -# Disable flag for dropping database, if it exists. -export CRDB_DROP_DATABASE_IF_EXISTS="YES" - -# Disable flag for re-deploying CockroachDB from scratch. -export CRDB_REDEPLOY="" - - -# ----- NATS ------------------------------------------------------------------- - -# Set the namespace where NATS will be deployed. -export NATS_NAMESPACE="nats" - -# Set the external port NATS Client interface will be exposed to. -export NATS_EXT_PORT_CLIENT="4222" - -# Set the external port NATS HTTP Mgmt GUI interface will be exposed to. -export NATS_EXT_PORT_HTTP="8222" - -# Disable flag for re-deploying NATS from scratch. -export NATS_REDEPLOY="" - - -# ----- QuestDB ---------------------------------------------------------------- - -# Set the namespace where QuestDB will be deployed. -export QDB_NAMESPACE="qdb" - -# Set the external port QuestDB Postgre SQL interface will be exposed to. -export QDB_EXT_PORT_SQL="8812" - -# Set the external port QuestDB Influx Line Protocol interface will be exposed to. -export QDB_EXT_PORT_ILP="9009" - -# Set the external port QuestDB HTTP Mgmt GUI interface will be exposed to. -export QDB_EXT_PORT_HTTP="9000" - -# Set the database username to be used for QuestDB. -export QDB_USERNAME="admin" - -# Set the database user's password to be used for QuestDB. -export QDB_PASSWORD="quest" - -# Set the table name to be used by Monitoring for KPIs. -export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" - -# Set the table name to be used by Slice for plotting groups. -export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" - -# Disable flag for dropping tables if they exist. -export QDB_DROP_TABLES_IF_EXIST="YES" - -# Disable flag for re-deploying QuestDB from scratch. -export QDB_REDEPLOY="" - - -# ----- K8s Observability ------------------------------------------------------ - -# Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to. -export PROM_EXT_PORT_HTTP="9090" - -# Set the external port Grafana HTTP Dashboards will be exposed to. -export GRAF_EXT_PORT_HTTP="3000" diff --git a/src/tests/e2e_orchestrator/descriptors_emulated.json b/src/tests/e2e_orchestrator/descriptors_emulated.json deleted file mode 100644 index a2918ace990550cac63d5eb7cd0cf69bf5da5538..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/descriptors_emulated.json +++ /dev/null @@ -1,250 +0,0 @@ -{ - "contexts": [ - { - "context_id": {"context_uuid": {"uuid": "admin"}}, - "topology_ids": [], "service_ids": [] - } - ], - "topologies": [ - { - "topology_id": { - "context_id": {"context_uuid": {"uuid": "admin"}}, - "topology_uuid": {"uuid": "admin"} - }, - "device_ids": [ - {"device_uuid": {"uuid": "R1"}}, - {"device_uuid": {"uuid": "R2"}}, - {"device_uuid": {"uuid": "T1"}}, - {"device_uuid": {"uuid": "T2"}}, - {"device_uuid": {"uuid": "M1"}}, - {"device_uuid": {"uuid": "M2"}} - ], - "link_ids": [ - {"link_uuid": {"uuid": "R1==T1"}}, - {"link_uuid": {"uuid": "T1==R1"}}, - {"link_uuid": {"uuid": "R2==T2"}}, - {"link_uuid": {"uuid": "T2==R2"}}, - - {"link_uuid": {"uuid": "T1==M1"}}, - {"link_uuid": {"uuid": "M1==T1"}}, - {"link_uuid": {"uuid": "T2==M2"}}, - {"link_uuid": {"uuid": "M2==T2"}}, - - {"link_uuid": {"uuid": "M1==M2"}}, - {"link_uuid": {"uuid": "M2==M1"}} - - - ] - } - ], - "devices": [ - { - "device_id": {"device_uuid": {"uuid": "R1"}}, "device_type": "emu-packet-router", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - }, - { - "device_id": {"device_uuid": {"uuid": "R2"}}, "device_type": "emu-packet-router", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - }, - { - "device_id": {"device_uuid": {"uuid": "T1"}}, "device_type": "emu-optical-transponder", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - }, - { - "device_id": {"device_uuid": {"uuid": "T2"}}, "device_type": "emu-optical-transponder", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - }, - - { - "device_id": {"device_uuid": {"uuid": "M1"}}, "device_type": "emu-optical-roadm", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - }, - - - { - "device_id": {"device_uuid": {"uuid": "M2"}}, "device_type": "emu-optical-roadm", "device_drivers": [0], - "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, - {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ - {"sample_types": [], "type": "copper", "uuid": "1/1"}, - {"sample_types": [], "type": "copper", "uuid": "1/2"}, - {"sample_types": [], "type": "copper", "uuid": "1/3"}, - {"sample_types": [], "type": "copper", "uuid": "1/4"}, - {"sample_types": [], "type": "copper", "uuid": "2/1"}, - {"sample_types": [], "type": "copper", "uuid": "2/2"}, - {"sample_types": [], "type": "copper", "uuid": "2/3"}, - {"sample_types": [], "type": "copper", "uuid": "2/4"}, - {"sample_types": [], "type": "copper", "uuid": "3/1"}, - {"sample_types": [], "type": "copper", "uuid": "3/2"}, - {"sample_types": [], "type": "copper", "uuid": "3/3"}, - {"sample_types": [], "type": "copper", "uuid": "3/4"} - ]}}} - ]} - } - - - ], - "links": [ - { - "link_id": {"link_uuid": {"uuid": "R1==T1"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "1/1"}}, - {"device_id": {"device_uuid": {"uuid": "T1"}}, "endpoint_uuid": {"uuid": "1/1"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "T1==R1"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "T1"}}, "endpoint_uuid": {"uuid": "1/1"}}, - {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "1/1"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "R2==T2"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "1/2"}}, - {"device_id": {"device_uuid": {"uuid": "T2"}}, "endpoint_uuid": {"uuid": "1/2"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "T2==R2"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "T2"}}, "endpoint_uuid": {"uuid": "1/2"}}, - {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "1/2"}} - ] - }, - - - { - "link_id": {"link_uuid": {"uuid": "T1==M1"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "T1"}}, "endpoint_uuid": {"uuid": "2/1"}}, - {"device_id": {"device_uuid": {"uuid": "M1"}}, "endpoint_uuid": {"uuid": "2/1"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "M1==T1"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "M1"}}, "endpoint_uuid": {"uuid": "2/1"}}, - {"device_id": {"device_uuid": {"uuid": "T1"}}, "endpoint_uuid": {"uuid": "2/1"}} - ] - }, - - { - "link_id": {"link_uuid": {"uuid": "T2==M2"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "T2"}}, "endpoint_uuid": {"uuid": "2/2"}}, - {"device_id": {"device_uuid": {"uuid": "M2"}}, "endpoint_uuid": {"uuid": "2/2"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "M2==T2"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "M2"}}, "endpoint_uuid": {"uuid": "2/2"}}, - {"device_id": {"device_uuid": {"uuid": "T2"}}, "endpoint_uuid": {"uuid": "2/2"}} - ] - }, - - { - "link_id": {"link_uuid": {"uuid": "M1==M2"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "M1"}}, "endpoint_uuid": {"uuid": "3/1"}}, - {"device_id": {"device_uuid": {"uuid": "M2"}}, "endpoint_uuid": {"uuid": "3/1"}} - ] - }, - { - "link_id": {"link_uuid": {"uuid": "M2==M1"}}, - "link_endpoint_ids": [ - {"device_id": {"device_uuid": {"uuid": "M2"}}, "endpoint_uuid": {"uuid": "3/1"}}, - {"device_id": {"device_uuid": {"uuid": "M1"}}, "endpoint_uuid": {"uuid": "3/1"}} - ] - } - - ] -} \ No newline at end of file diff --git a/src/tests/e2e_orchestrator/redeploy.sh b/src/tests/e2e_orchestrator/redeploy.sh deleted file mode 100755 index 5e851992670ff32f79d3bae328d28d63dd546041..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/redeploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -source e2e_orchestrator/deploy_specs.sh -./deploy/all.sh -source tfs_runtime_env_vars.sh diff --git a/src/tests/e2e_orchestrator/run_test_01_bootstrap.sh b/src/tests/e2e_orchestrator/run_test_01_bootstrap.sh deleted file mode 100755 index 78c76def83ed8391a971793b420d786ff6476480..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/run_test_01_bootstrap.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -source tfs_runtime_env_vars.sh -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_bootstrap.py diff --git a/src/tests/e2e_orchestrator/run_test_02_compute_path.sh b/src/tests/e2e_orchestrator/run_test_02_compute_path.sh deleted file mode 100755 index 83191464aa25e0b5459cfe4faa906941ee55994c..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/run_test_02_compute_path.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -source tfs_runtime_env_vars.sh -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_compute_path.py diff --git a/src/tests/e2e_orchestrator/run_test_03_cleanup.sh b/src/tests/e2e_orchestrator/run_test_03_cleanup.sh deleted file mode 100755 index f3ab6c68daa81d2b8cbe46d8c88fc2786302176d..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/run_test_03_cleanup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -source tfs_runtime_env_vars.sh -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_cleanup.py diff --git a/src/tests/e2e_orchestrator/run_tests.sh b/src/tests/e2e_orchestrator/run_tests.sh deleted file mode 100755 index 2c177259a1bfc404256b83fd0317e15d10caf4d1..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/run_tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -# Run functional tests -source tfs_runtime_env_vars.sh -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_bootstrap.py -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_compute_path.py -pytest --verbose --log-level=INFO src/tests/e2e_orchestrator/tests/test_functional_cleanup.py diff --git a/src/tests/e2e_orchestrator/tests/Fixtures.py b/src/tests/e2e_orchestrator/tests/Fixtures.py deleted file mode 100644 index 38d04994fb0fa1951fb465bc127eb72659dc2eaf..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/Fixtures.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. diff --git a/src/tests/e2e_orchestrator/tests/Objects.py b/src/tests/e2e_orchestrator/tests/Objects.py deleted file mode 100644 index 1748efec9325e0651ee7fc8dcfa62454aa29e385..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/Objects.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 os -from typing import Dict, List, Tuple -from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME -from common.tools.object_factory.Context import json_context, json_context_id -from common.tools.object_factory.Device import ( - json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_connect_rules, json_device_id, json_device_p4_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) -from common.tools.object_factory.Service import ( - get_service_uuid, json_service_l3nm_planned,json_service_p4_planned) -from common.tools.object_factory.ConfigRule import ( - json_config_rule_set, json_config_rule_delete) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_ids, json_endpoints, json_endpoint_id -from common.tools.object_factory.EndPoint import json_endpoint_descriptor - - - -DEVICE_R1_UUID = 'R1' -DEVICE_R2_UUID = 'R2' - -DEVICE_R1_ID = json_device_id(DEVICE_R1_UUID) -DEVICE_R1_ENDPOINT_DEFS = [json_endpoint_descriptor('2/2', 'port')] -DEVICE_R2_ID = json_device_id(DEVICE_R2_UUID) -DEVICE_R2_ENDPOINT_DEFS = [json_endpoint_descriptor('2/2', 'port')] - -DEVICE_R1_ENDPOINTS = json_endpoints(DEVICE_R1_ID, DEVICE_R1_ENDPOINT_DEFS) -DEVICE_R2_ENDPOINTS = json_endpoints(DEVICE_R2_ID, DEVICE_R2_ENDPOINT_DEFS) - - -DEVICE_R1_ENDPOINT_IDS = json_endpoint_ids(DEVICE_R1_ID, DEVICE_R1_ENDPOINT_DEFS) -ENDPOINT_ID_R1 = DEVICE_R1_ENDPOINTS[0]['endpoint_id'] -DEVICE_R2_ENDPOINT_IDS = json_endpoint_ids(DEVICE_R2_ID, DEVICE_R2_ENDPOINT_DEFS) -ENDPOINT_ID_R2 = DEVICE_R2_ENDPOINTS[0]['endpoint_id'] - - -# ----- Service ---------------------------------------------------------------------------------------------------------- - - -SERVICE_R1_R2_UUID = get_service_uuid(ENDPOINT_ID_R1, ENDPOINT_ID_R2) -SERVICE_R1_R2 = json_service_p4_planned(SERVICE_R1_R2_UUID) -SERVICE_R1_R2_ENDPOINT_IDS = [DEVICE_R1_ENDPOINT_IDS[0], DEVICE_R2_ENDPOINT_IDS[0]] - - -SERVICES = [ - (SERVICE_R1_R2, SERVICE_R1_R2_ENDPOINT_IDS) -] diff --git a/src/tests/e2e_orchestrator/tests/__init__.py b/src/tests/e2e_orchestrator/tests/__init__.py deleted file mode 100644 index 1549d9811aa5d1c193a44ad45d0d7773236c0612..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - diff --git a/src/tests/e2e_orchestrator/tests/test_functional_bootstrap.py b/src/tests/e2e_orchestrator/tests/test_functional_bootstrap.py deleted file mode 100644 index 36c3b09183f573c4789e9ede26c4130c2ba8ff46..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/test_functional_bootstrap.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging, time -from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty -from common.proto.monitoring_pb2 import KpiDescriptorList -from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario -from common.tools.object_factory.Context import json_context_id -from context.client.ContextClient import ContextClient -from device.client.DeviceClient import DeviceClient -from monitoring.client.MonitoringClient import MonitoringClient -from tests.Fixtures import context_client, device_client, monitoring_client # pylint: disable=unused-import - -LOGGER = logging.getLogger(__name__) -LOGGER.setLevel(logging.DEBUG) - -DESCRIPTOR_FILE = 'src/tests/e2e_orchestrator/descriptors_emulated.json' -ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) - -def test_scenario_bootstrap( - context_client : ContextClient, # pylint: disable=redefined-outer-name - device_client : DeviceClient, # pylint: disable=redefined-outer-name -) -> None: - LOGGER.info(context_client) - validate_empty_scenario(context_client) - - descriptor_loader = DescriptorLoader( - descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client) - results = descriptor_loader.process() - check_descriptor_load_results(results, descriptor_loader) - descriptor_loader.validate() - - # Verify the scenario has no services/slices - response = context_client.GetContext(ADMIN_CONTEXT_ID) - assert len(response.service_ids) == 0 - assert len(response.slice_ids) == 0 - -def test_scenario_devices_enabled( - context_client : ContextClient, # pylint: disable=redefined-outer-name -) -> None: - """ - This test validates that the devices are enabled. - """ - DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED - - num_devices = -1 - num_devices_enabled, num_retry = 0, 0 - while (num_devices != num_devices_enabled) and (num_retry < 1): - time.sleep(1.0) - response = context_client.ListDevices(Empty()) - num_devices = len(response.devices) - num_devices_enabled = 0 - for device in response.devices: - if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue - num_devices_enabled += 1 - LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices)) - num_retry += 1 - assert num_devices_enabled == num_devices - - diff --git a/src/tests/e2e_orchestrator/tests/test_functional_cleanup.py b/src/tests/e2e_orchestrator/tests/test_functional_cleanup.py deleted file mode 100644 index e661e177cb502f90f4ab46847bf8909b95ce8460..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/test_functional_cleanup.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging -from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId -from common.tools.descriptor.Loader import DescriptorLoader, validate_empty_scenario -from common.tools.object_factory.Context import json_context_id -from context.client.ContextClient import ContextClient -from device.client.DeviceClient import DeviceClient -from tests.Fixtures import context_client, device_client # pylint: disable=unused-import - -LOGGER = logging.getLogger(__name__) -LOGGER.setLevel(logging.DEBUG) - -DESCRIPTOR_FILE = 'src/tests/e2e_orchestrator/descriptors_emulated.json' -ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) - -def test_scenario_cleanup( - context_client : ContextClient, # pylint: disable=redefined-outer-name - device_client : DeviceClient, # pylint: disable=redefined-outer-name -) -> None: - # Verify the scenario has no services/slices - response = context_client.GetContext(ADMIN_CONTEXT_ID) - assert len(response.service_ids) == 0 - assert len(response.slice_ids) == 0 - - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader( - descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client) - descriptor_loader.validate() - descriptor_loader.unload() - validate_empty_scenario(context_client) diff --git a/src/tests/e2e_orchestrator/tests/test_functional_compute_path.py b/src/tests/e2e_orchestrator/tests/test_functional_compute_path.py deleted file mode 100644 index e95a325aa8c906e1a16e0d34cf556c7c3b50a4d2..0000000000000000000000000000000000000000 --- a/src/tests/e2e_orchestrator/tests/test_functional_compute_path.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 logging, random -from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, Empty, ServiceTypeEnum, Service -from common.proto.e2eorchestrator_pb2 import E2EOrchestratorRequest -from common.proto.kpi_sample_types_pb2 import KpiSampleType -from common.tools.descriptor.Loader import DescriptorLoader -from common.tools.grpc.Tools import grpc_message_to_json_string -from common.tools.object_factory.Context import json_context_id -from context.client.ContextClient import ContextClient -from service.client.ServiceClient import ServiceClient -from tests.Fixtures import service_client, context_client, e2eorchestrator_client # pylint: disable=unused-import -from e2eorchestrator.client.E2EOrchestratorClient import E2EOrchestratorClient -from .Objects import SERVICES -import copy - -LOGGER = logging.getLogger(__name__) -LOGGER.setLevel(logging.DEBUG) - -DESCRIPTOR_FILE = 'src/tests/e2e_orchestrator/descriptors_emulated.json' -ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) - - -def test_orchestration(service_client : ServiceClient, context_client : ContextClient, e2eorchestrator_client : E2EOrchestratorClient): # pylint: disable=redefined-outer-name - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) - descriptor_loader.validate() - - # Verify the scenario has no services/slices - response = context_client.GetContext(ADMIN_CONTEXT_ID) - assert len(response.service_ids) == 0 - assert len(response.slice_ids) == 0 - - # Create Connectivity Service - - - # ----- Create Services --------------------------------------------------------------- - for service, endpoints in SERVICES: - LOGGER.info(service) - # Insert Service (table entries) - service_uuid = service['service_id']['service_uuid']['uuid'] - print('Creating Service {:s}'.format(service_uuid)) - service_p4 = copy.deepcopy(service) - # service_client.CreateService(Service(**service_p4)) - LOGGER.info(type(service_p4)) - service_p4['service_endpoint_ids'].extend(endpoints) - # service_client.UpdateService(Service(**service_p4)) - request = E2EOrchestratorRequest() - request.service.MergeFrom(Service(**service_p4)) - reply = e2eorchestrator_client.Compute(request) - LOGGER.info(reply) -