diff --git a/src/tests/oeccpsc22/deploy_in_kubernetes.sh b/src/tests/oeccpsc22/deploy_in_kubernetes.sh index f40257f341c006e24e24ed961f5d1a0367ef5a11..e350b835501400f7aaa6bf99ffe25aa6ae4620a4 100755 --- a/src/tests/oeccpsc22/deploy_in_kubernetes.sh +++ b/src/tests/oeccpsc22/deploy_in_kubernetes.sh @@ -17,7 +17,7 @@ # OECC/PSC 22 deployment settings export REGISTRY_IMAGE="" -export COMPONENTS="context device service compute monitoring interdomain webui" # slice +export COMPONENTS="context device monitoring service slice interdomain compute" # webui export IMAGE_TAG="oeccpsc22" export K8S_HOSTNAME="kubernetes-master" #export GRAFANA_PASSWORD="admin123+" diff --git a/src/tests/oeccpsc22/run_test_01_bootstrap.sh b/src/tests/oeccpsc22/run_test_01_bootstrap.sh index 7b816984a17f7f5a30ce8eaafc6d831c615ce3e0..e8df6ffb67f6756f9f757ae12c6a438d0c609853 100755 --- a/src/tests/oeccpsc22/run_test_01_bootstrap.sh +++ b/src/tests/oeccpsc22/run_test_01_bootstrap.sh @@ -41,11 +41,15 @@ export D1_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonp export D1_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') export D1_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export D1_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D1_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') export D2_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export D2_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') export D2_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') export D2_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D2_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') # Useful flags for pytest: #-o log_cli=true -o log_file=device.log -o log_file_level=DEBUG diff --git a/src/tests/oeccpsc22/run_test_02_create_service.sh b/src/tests/oeccpsc22/run_test_02_create_service.sh index c01f64741fe54e4e5a889080f4e680660435c093..5101336ba7925d0ab9af45ffccc753f7b9214974 100755 --- a/src/tests/oeccpsc22/run_test_02_create_service.sh +++ b/src/tests/oeccpsc22/run_test_02_create_service.sh @@ -21,16 +21,24 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc COVERAGEFILE=$PROJECTDIR/coverage/.coverage # Set the name of the Kubernetes namespace and hostname to use. -K8S_NAMESPACE="oeccpsc22" +K8S_NAMESPACE_D1="oeccpsc22-1" +K8S_NAMESPACE_D2="oeccpsc22-2" # dynamically gets the name of the K8s master node K8S_HOSTNAME=`kubectl get nodes --selector=node-role.kubernetes.io/master | tr -s " " | cut -f1 -d" " | sed -n '2 p'` -export CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') -export DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') -export COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') +export D1_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D1_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D1_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') + +export D2_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D2_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D2_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') # Useful flags for pytest: #-o log_cli=true -o log_file=device.log -o log_file_level=DEBUG diff --git a/src/tests/oeccpsc22/run_test_03_delete_service.sh b/src/tests/oeccpsc22/run_test_03_delete_service.sh index 1782a143bdf6b3257ae8dbf75d94803dcde2275c..e8549a3708d56b1cdafb19de65ba966268c59355 100755 --- a/src/tests/oeccpsc22/run_test_03_delete_service.sh +++ b/src/tests/oeccpsc22/run_test_03_delete_service.sh @@ -21,16 +21,24 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc COVERAGEFILE=$PROJECTDIR/coverage/.coverage # Set the name of the Kubernetes namespace and hostname to use. -K8S_NAMESPACE="oeccpsc22" +K8S_NAMESPACE_D1="oeccpsc22-1" +K8S_NAMESPACE_D2="oeccpsc22-2" # dynamically gets the name of the K8s master node K8S_HOSTNAME=`kubectl get nodes --selector=node-role.kubernetes.io/master | tr -s " " | cut -f1 -d" " | sed -n '2 p'` -export CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') -export DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') -export COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') +export D1_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D1_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D1_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') + +export D2_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D2_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D2_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') # Useful flags for pytest: #-o log_cli=true -o log_file=device.log -o log_file_level=DEBUG diff --git a/src/tests/oeccpsc22/run_test_04_cleanup.sh b/src/tests/oeccpsc22/run_test_04_cleanup.sh index 14b4024be28dba06add413fb775b0a6ed090af74..d0420820c487862e5faa469dc4000dda3da71be6 100755 --- a/src/tests/oeccpsc22/run_test_04_cleanup.sh +++ b/src/tests/oeccpsc22/run_test_04_cleanup.sh @@ -21,16 +21,24 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc COVERAGEFILE=$PROJECTDIR/coverage/.coverage # Set the name of the Kubernetes namespace and hostname to use. -K8S_NAMESPACE="oeccpsc22" +K8S_NAMESPACE_D1="oeccpsc22-1" +K8S_NAMESPACE_D2="oeccpsc22-2" # dynamically gets the name of the K8s master node K8S_HOSTNAME=`kubectl get nodes --selector=node-role.kubernetes.io/master | tr -s " " | cut -f1 -d" " | sed -n '2 p'` -export CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') -export DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') -export COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') -export COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') +export D1_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D1_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D1_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D1_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D1 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') + +export D2_CONTEXTSERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service contextservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==1010)].nodePort}') +export D2_DEVICESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_DEVICESERVICE_SERVICE_PORT_GRPC=$(kubectl get service deviceservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==2020)].nodePort}') +export D2_COMPUTESERVICE_SERVICE_HOST=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}') +export D2_COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service computeservice-public --namespace $K8S_NAMESPACE_D2 -o 'jsonpath={.spec.ports[?(@.port==8080)].nodePort}') # Useful flags for pytest: #-o log_cli=true -o log_file=device.log -o log_file_level=DEBUG diff --git a/src/tests/oeccpsc22/tests/Objects_Domain_1.py b/src/tests/oeccpsc22/tests/Objects_Domain_1.py index af353c6e9ca3c863387e5d72dbef005fcb516a5a..6fefc2d822680bc1173d6d0544eb31d54e4f92ff 100644 --- a/src/tests/oeccpsc22/tests/Objects_Domain_1.py +++ b/src/tests/oeccpsc22/tests/Objects_Domain_1.py @@ -30,7 +30,7 @@ D1_TOPOLOGY = json_topology(DEFAULT_TOPOLOGY_UUID, context_id=D1_CONTEXT_ID) # ----- Devices -------------------------------------------------------------------------------------------------------- # Assume all devices have the same architecture of endpoints -DEVICE_ENDPOINT_DEFS = [ +D1_DEVICE_ENDPOINT_DEFS = [ # Trunk ports ('1/1', '25Gbps', []), ('1/2', '25Gbps', []), ('1/3', '25Gbps', []), ('1/4', '25Gbps', []), # Inter-domain ports @@ -40,67 +40,72 @@ DEVICE_ENDPOINT_DEFS = [ ('3/5', '10Gbps', []), ('3/6', '10Gbps', []), ('3/7', '10Gbps', []), ('3/8', '10Gbps', []), ] -DEVICE_D1R1_UUID = 'D1-R1' -DEVICE_D1R1_ID = json_device_id(DEVICE_D1R1_UUID) -DEVICE_D1R1 = json_device_emulated_packet_router_disabled(DEVICE_D1R1_UUID) -DEVICE_D1R1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D1_DEVICE_D1R1_UUID = 'D1-R1' +D1_DEVICE_D1R1_ID = json_device_id(D1_DEVICE_D1R1_UUID) +D1_DEVICE_D1R1 = json_device_emulated_packet_router_disabled(D1_DEVICE_D1R1_UUID) +D1_DEVICE_D1R1_CONNECT_RULES = json_device_emulated_connect_rules(D1_DEVICE_ENDPOINT_DEFS) -DEVICE_D1R2_UUID = 'D1-R2' -DEVICE_D1R2_ID = json_device_id(DEVICE_D1R2_UUID) -DEVICE_D1R2 = json_device_emulated_packet_router_disabled(DEVICE_D1R2_UUID) -DEVICE_D1R2_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D1_DEVICE_D1R2_UUID = 'D1-R2' +D1_DEVICE_D1R2_ID = json_device_id(D1_DEVICE_D1R2_UUID) +D1_DEVICE_D1R2 = json_device_emulated_packet_router_disabled(D1_DEVICE_D1R2_UUID) +D1_DEVICE_D1R2_CONNECT_RULES = json_device_emulated_connect_rules(D1_DEVICE_ENDPOINT_DEFS) -DEVICE_D1R3_UUID = 'D1-R3' -DEVICE_D1R3_ID = json_device_id(DEVICE_D1R3_UUID) -DEVICE_D1R3 = json_device_emulated_packet_router_disabled(DEVICE_D1R3_UUID) -DEVICE_D1R3_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D1_DEVICE_D1R3_UUID = 'D1-R3' +D1_DEVICE_D1R3_ID = json_device_id(D1_DEVICE_D1R3_UUID) +D1_DEVICE_D1R3 = json_device_emulated_packet_router_disabled(D1_DEVICE_D1R3_UUID) +D1_DEVICE_D1R3_CONNECT_RULES = json_device_emulated_connect_rules(D1_DEVICE_ENDPOINT_DEFS) -DEVICE_D1R4_UUID = 'D1-R4' -DEVICE_D1R4_ID = json_device_id(DEVICE_D1R4_UUID) -DEVICE_D1R4 = json_device_emulated_packet_router_disabled(DEVICE_D1R4_UUID) -DEVICE_D1R4_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D1_DEVICE_D1R4_UUID = 'D1-R4' +D1_DEVICE_D1R4_ID = json_device_id(D1_DEVICE_D1R4_UUID) +D1_DEVICE_D1R4 = json_device_emulated_packet_router_disabled(D1_DEVICE_D1R4_UUID) +D1_DEVICE_D1R4_CONNECT_RULES = json_device_emulated_connect_rules(D1_DEVICE_ENDPOINT_DEFS) # Virtual devices on remote domains -DEVICE_D2R1_UUID = 'D2-R1' -DEVICE_D2R1_ID = json_device_id(DEVICE_D2R1_UUID) -DEVICE_D2R1 = json_device_emulated_packet_router_disabled(DEVICE_D2R1_UUID) -DEVICE_D2R1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D1_DEVICE_D2R1_UUID = 'D2-R1' +D1_DEVICE_D2R1_ID = json_device_id(D1_DEVICE_D2R1_UUID) +D1_DEVICE_D2R1 = json_device_emulated_packet_router_disabled(D1_DEVICE_D2R1_UUID) +D1_DEVICE_D2R1_CONNECT_RULES = json_device_emulated_connect_rules(D1_DEVICE_ENDPOINT_DEFS) -ENDPOINT_IDS = {} -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D1R1_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D1R2_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D1R3_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D1R4_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D2R1_ID, DEVICE_ENDPOINT_DEFS)) +D1_ENDPOINT_IDS = {} +D1_ENDPOINT_IDS.update(json_endpoint_ids(D1_DEVICE_D1R1_ID, D1_DEVICE_ENDPOINT_DEFS)) +D1_ENDPOINT_IDS.update(json_endpoint_ids(D1_DEVICE_D1R2_ID, D1_DEVICE_ENDPOINT_DEFS)) +D1_ENDPOINT_IDS.update(json_endpoint_ids(D1_DEVICE_D1R3_ID, D1_DEVICE_ENDPOINT_DEFS)) +D1_ENDPOINT_IDS.update(json_endpoint_ids(D1_DEVICE_D1R4_ID, D1_DEVICE_ENDPOINT_DEFS)) +D1_ENDPOINT_IDS.update(json_endpoint_ids(D1_DEVICE_D2R1_ID, D1_DEVICE_ENDPOINT_DEFS)) # ----- Links ---------------------------------------------------------------------------------------------------------- # Intra-domain links -LINK_D1R1_D1R2_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D1R1_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R2_UUID]['1/1']) -LINK_D1R1_D1R2_ID = json_link_id(LINK_D1R1_D1R2_UUID) -LINK_D1R1_D1R2 = json_link(LINK_D1R1_D1R2_UUID, [ - ENDPOINT_IDS[DEVICE_D1R1_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R2_UUID]['1/1']]) - -LINK_D1R2_D1R3_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D1R2_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R3_UUID]['1/1']) -LINK_D1R2_D1R3_ID = json_link_id(LINK_D1R2_D1R3_UUID) -LINK_D1R2_D1R3 = json_link(LINK_D1R2_D1R3_UUID, [ - ENDPOINT_IDS[DEVICE_D1R2_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R3_UUID]['1/1']]) - -LINK_D1R3_D1R4_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D1R3_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R4_UUID]['1/1']) -LINK_D1R3_D1R4_ID = json_link_id(LINK_D1R3_D1R4_UUID) -LINK_D1R3_D1R4 = json_link(LINK_D1R3_D1R4_UUID, [ - ENDPOINT_IDS[DEVICE_D1R3_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R4_UUID]['1/1']]) - -LINK_D1R4_D1R1_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D1R4_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R1_UUID]['1/1']) -LINK_D1R4_D1R1_ID = json_link_id(LINK_D1R4_D1R1_UUID) -LINK_D1R4_D1R1 = json_link(LINK_D1R4_D1R1_UUID, [ - ENDPOINT_IDS[DEVICE_D1R4_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D1R1_UUID]['1/1']]) +D1_LINK_D1R1_D1R2_UUID = get_link_uuid( + D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R2_UUID]['1/1']) +D1_LINK_D1R1_D1R2_ID = json_link_id(D1_LINK_D1R1_D1R2_UUID) +D1_LINK_D1R1_D1R2 = json_link(D1_LINK_D1R1_D1R2_UUID, [ + D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R2_UUID]['1/1']]) + +D1_LINK_D1R2_D1R3_UUID = get_link_uuid( + D1_ENDPOINT_IDS[D1_DEVICE_D1R2_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R3_UUID]['1/1']) +D1_LINK_D1R2_D1R3_ID = json_link_id(D1_LINK_D1R2_D1R3_UUID) +D1_LINK_D1R2_D1R3 = json_link(D1_LINK_D1R2_D1R3_UUID, [ + D1_ENDPOINT_IDS[D1_DEVICE_D1R2_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R3_UUID]['1/1']]) + +D1_LINK_D1R3_D1R4_UUID = get_link_uuid( + D1_ENDPOINT_IDS[D1_DEVICE_D1R3_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['1/1']) +D1_LINK_D1R3_D1R4_ID = json_link_id(D1_LINK_D1R3_D1R4_UUID) +D1_LINK_D1R3_D1R4 = json_link(D1_LINK_D1R3_D1R4_UUID, [ + D1_ENDPOINT_IDS[D1_DEVICE_D1R3_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['1/1']]) + +D1_LINK_D1R4_D1R1_UUID = get_link_uuid( + D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['1/1']) +D1_LINK_D1R4_D1R1_ID = json_link_id(D1_LINK_D1R4_D1R1_UUID) +D1_LINK_D1R4_D1R1 = json_link(D1_LINK_D1R4_D1R1_UUID, [ + D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['1/2'], D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['1/1']]) # Inter-domain links -LINK_D1R4_D2R1_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D1R4_UUID]['2/1'], ENDPOINT_IDS[DEVICE_D2R1_UUID]['2/1']) -LINK_D1R4_D2R1_ID = json_link_id(LINK_D1R4_D2R1_UUID) -LINK_D1R4_D2R1 = json_link(LINK_D1R4_D2R1_UUID, [ - ENDPOINT_IDS[DEVICE_D1R4_UUID]['2/1'], ENDPOINT_IDS[DEVICE_D2R1_UUID]['2/1']]) +D1_LINK_D1R4_D2R1_UUID = get_link_uuid( + D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['2/1'], D1_ENDPOINT_IDS[D1_DEVICE_D2R1_UUID]['2/1']) +D1_LINK_D1R4_D2R1_ID = json_link_id(D1_LINK_D1R4_D2R1_UUID) +D1_LINK_D1R4_D2R1 = json_link(D1_LINK_D1R4_D2R1_UUID, [ + D1_ENDPOINT_IDS[D1_DEVICE_D1R4_UUID]['2/1'], D1_ENDPOINT_IDS[D1_DEVICE_D2R1_UUID]['2/1']]) # ----- Object Collections --------------------------------------------------------------------------------------------- @@ -108,14 +113,14 @@ D1_CONTEXTS = [D1_CONTEXT] D1_TOPOLOGIES = [D1_TOPOLOGY] D1_DEVICES = [ - (DEVICE_D1R1, DEVICE_D1R1_CONNECT_RULES), - (DEVICE_D1R2, DEVICE_D1R2_CONNECT_RULES), - (DEVICE_D1R3, DEVICE_D1R3_CONNECT_RULES), - (DEVICE_D1R4, DEVICE_D1R4_CONNECT_RULES), - (DEVICE_D2R1, DEVICE_D2R1_CONNECT_RULES), + (D1_DEVICE_D1R1, D1_DEVICE_D1R1_CONNECT_RULES), + (D1_DEVICE_D1R2, D1_DEVICE_D1R2_CONNECT_RULES), + (D1_DEVICE_D1R3, D1_DEVICE_D1R3_CONNECT_RULES), + (D1_DEVICE_D1R4, D1_DEVICE_D1R4_CONNECT_RULES), + (D1_DEVICE_D2R1, D1_DEVICE_D2R1_CONNECT_RULES), ] D1_LINKS = [ - LINK_D1R1_D1R2, LINK_D1R2_D1R3, LINK_D1R3_D1R4, LINK_D1R4_D1R1, - LINK_D1R4_D2R1, + D1_LINK_D1R1_D1R2, D1_LINK_D1R2_D1R3, D1_LINK_D1R3_D1R4, D1_LINK_D1R4_D1R1, + D1_LINK_D1R4_D2R1, ] diff --git a/src/tests/oeccpsc22/tests/Objects_Domain_2.py b/src/tests/oeccpsc22/tests/Objects_Domain_2.py index f7798925096f9fa6b49c81c7a6e628afac23bed8..ec641dce4675a3965a11b2cacfb08777f8e0aa4f 100644 --- a/src/tests/oeccpsc22/tests/Objects_Domain_2.py +++ b/src/tests/oeccpsc22/tests/Objects_Domain_2.py @@ -30,7 +30,7 @@ D2_TOPOLOGY = json_topology(DEFAULT_TOPOLOGY_UUID, context_id=D2_CONTEXT_ID) # ----- Devices -------------------------------------------------------------------------------------------------------- # Assume all devices have the same architecture of endpoints -DEVICE_ENDPOINT_DEFS = [ +D2_DEVICE_ENDPOINT_DEFS = [ # Trunk ports ('1/1', '25Gbps', []), ('1/2', '25Gbps', []), ('1/3', '25Gbps', []), ('1/4', '25Gbps', []), # Inter-domain ports @@ -40,67 +40,72 @@ DEVICE_ENDPOINT_DEFS = [ ('3/5', '10Gbps', []), ('3/6', '10Gbps', []), ('3/7', '10Gbps', []), ('3/8', '10Gbps', []), ] -DEVICE_D2R1_UUID = 'D2-R1' -DEVICE_D2R1_ID = json_device_id(DEVICE_D2R1_UUID) -DEVICE_D2R1 = json_device_emulated_packet_router_disabled(DEVICE_D2R1_UUID) -DEVICE_D2R1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D2_DEVICE_D2R1_UUID = 'D2-R1' +D2_DEVICE_D2R1_ID = json_device_id(D2_DEVICE_D2R1_UUID) +D2_DEVICE_D2R1 = json_device_emulated_packet_router_disabled(D2_DEVICE_D2R1_UUID) +D2_DEVICE_D2R1_CONNECT_RULES = json_device_emulated_connect_rules(D2_DEVICE_ENDPOINT_DEFS) -DEVICE_D2R2_UUID = 'D2-R2' -DEVICE_D2R2_ID = json_device_id(DEVICE_D2R2_UUID) -DEVICE_D2R2 = json_device_emulated_packet_router_disabled(DEVICE_D2R2_UUID) -DEVICE_D2R2_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D2_DEVICE_D2R2_UUID = 'D2-R2' +D2_DEVICE_D2R2_ID = json_device_id(D2_DEVICE_D2R2_UUID) +D2_DEVICE_D2R2 = json_device_emulated_packet_router_disabled(D2_DEVICE_D2R2_UUID) +D2_DEVICE_D2R2_CONNECT_RULES = json_device_emulated_connect_rules(D2_DEVICE_ENDPOINT_DEFS) -DEVICE_D2R3_UUID = 'D2-R3' -DEVICE_D2R3_ID = json_device_id(DEVICE_D2R3_UUID) -DEVICE_D2R3 = json_device_emulated_packet_router_disabled(DEVICE_D2R3_UUID) -DEVICE_D2R3_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D2_DEVICE_D2R3_UUID = 'D2-R3' +D2_DEVICE_D2R3_ID = json_device_id(D2_DEVICE_D2R3_UUID) +D2_DEVICE_D2R3 = json_device_emulated_packet_router_disabled(D2_DEVICE_D2R3_UUID) +D2_DEVICE_D2R3_CONNECT_RULES = json_device_emulated_connect_rules(D2_DEVICE_ENDPOINT_DEFS) -DEVICE_D2R4_UUID = 'D2-R4' -DEVICE_D2R4_ID = json_device_id(DEVICE_D2R4_UUID) -DEVICE_D2R4 = json_device_emulated_packet_router_disabled(DEVICE_D2R4_UUID) -DEVICE_D2R4_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D2_DEVICE_D2R4_UUID = 'D2-R4' +D2_DEVICE_D2R4_ID = json_device_id(D2_DEVICE_D2R4_UUID) +D2_DEVICE_D2R4 = json_device_emulated_packet_router_disabled(D2_DEVICE_D2R4_UUID) +D2_DEVICE_D2R4_CONNECT_RULES = json_device_emulated_connect_rules(D2_DEVICE_ENDPOINT_DEFS) # Virtual devices on remote domains -DEVICE_D1R1_UUID = 'D1-R1' -DEVICE_D1R1_ID = json_device_id(DEVICE_D1R1_UUID) -DEVICE_D1R1 = json_device_emulated_packet_router_disabled(DEVICE_D1R1_UUID) -DEVICE_D1R1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_ENDPOINT_DEFS) +D2_DEVICE_D1R1_UUID = 'D1-R1' +D2_DEVICE_D1R1_ID = json_device_id(D2_DEVICE_D1R1_UUID) +D2_DEVICE_D1R1 = json_device_emulated_packet_router_disabled(D2_DEVICE_D1R1_UUID) +D2_DEVICE_D1R1_CONNECT_RULES = json_device_emulated_connect_rules(D2_DEVICE_ENDPOINT_DEFS) -ENDPOINT_IDS = {} -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D2R1_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D2R2_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D2R3_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D2R4_ID, DEVICE_ENDPOINT_DEFS)) -ENDPOINT_IDS.update(json_endpoint_ids(DEVICE_D1R1_ID, DEVICE_ENDPOINT_DEFS)) +D2_ENDPOINT_IDS = {} +D2_ENDPOINT_IDS.update(json_endpoint_ids(D2_DEVICE_D2R1_ID, D2_DEVICE_ENDPOINT_DEFS)) +D2_ENDPOINT_IDS.update(json_endpoint_ids(D2_DEVICE_D2R2_ID, D2_DEVICE_ENDPOINT_DEFS)) +D2_ENDPOINT_IDS.update(json_endpoint_ids(D2_DEVICE_D2R3_ID, D2_DEVICE_ENDPOINT_DEFS)) +D2_ENDPOINT_IDS.update(json_endpoint_ids(D2_DEVICE_D2R4_ID, D2_DEVICE_ENDPOINT_DEFS)) +D2_ENDPOINT_IDS.update(json_endpoint_ids(D2_DEVICE_D1R1_ID, D2_DEVICE_ENDPOINT_DEFS)) # ----- Links ---------------------------------------------------------------------------------------------------------- # Intra-domain links -LINK_D2R1_D2R2_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D2R1_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R2_UUID]['1/1']) -LINK_D2R1_D2R2_ID = json_link_id(LINK_D2R1_D2R2_UUID) -LINK_D2R1_D2R2 = json_link(LINK_D2R1_D2R2_UUID, [ - ENDPOINT_IDS[DEVICE_D2R1_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R2_UUID]['1/1']]) - -LINK_D2R2_D2R3_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D2R2_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R3_UUID]['1/1']) -LINK_D2R2_D2R3_ID = json_link_id(LINK_D2R2_D2R3_UUID) -LINK_D2R2_D2R3 = json_link(LINK_D2R2_D2R3_UUID, [ - ENDPOINT_IDS[DEVICE_D2R2_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R3_UUID]['1/1']]) - -LINK_D2R3_D2R4_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D2R3_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R4_UUID]['1/1']) -LINK_D2R3_D2R4_ID = json_link_id(LINK_D2R3_D2R4_UUID) -LINK_D2R3_D2R4 = json_link(LINK_D2R3_D2R4_UUID, [ - ENDPOINT_IDS[DEVICE_D2R3_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R4_UUID]['1/1']]) - -LINK_D2R4_D2R1_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D2R4_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R1_UUID]['1/1']) -LINK_D2R4_D2R1_ID = json_link_id(LINK_D2R4_D2R1_UUID) -LINK_D2R4_D2R1 = json_link(LINK_D2R4_D2R1_UUID, [ - ENDPOINT_IDS[DEVICE_D2R4_UUID]['1/2'], ENDPOINT_IDS[DEVICE_D2R1_UUID]['1/1']]) +D2_LINK_D2R1_D2R2_UUID = get_link_uuid( + D2_ENDPOINT_IDS[D2_DEVICE_D2R1_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R2_UUID]['1/1']) +D2_LINK_D2R1_D2R2_ID = json_link_id(D2_LINK_D2R1_D2R2_UUID) +D2_LINK_D2R1_D2R2 = json_link(D2_LINK_D2R1_D2R2_UUID, [ + D2_ENDPOINT_IDS[D2_DEVICE_D2R1_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R2_UUID]['1/1']]) + +D2_LINK_D2R2_D2R3_UUID = get_link_uuid( + D2_ENDPOINT_IDS[D2_DEVICE_D2R2_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R3_UUID]['1/1']) +D2_LINK_D2R2_D2R3_ID = json_link_id(D2_LINK_D2R2_D2R3_UUID) +D2_LINK_D2R2_D2R3 = json_link(D2_LINK_D2R2_D2R3_UUID, [ + D2_ENDPOINT_IDS[D2_DEVICE_D2R2_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R3_UUID]['1/1']]) + +D2_LINK_D2R3_D2R4_UUID = get_link_uuid( + D2_ENDPOINT_IDS[D2_DEVICE_D2R3_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['1/1']) +D2_LINK_D2R3_D2R4_ID = json_link_id(D2_LINK_D2R3_D2R4_UUID) +D2_LINK_D2R3_D2R4 = json_link(D2_LINK_D2R3_D2R4_UUID, [ + D2_ENDPOINT_IDS[D2_DEVICE_D2R3_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['1/1']]) + +D2_LINK_D2R4_D2R1_UUID = get_link_uuid( + D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R1_UUID]['1/1']) +D2_LINK_D2R4_D2R1_ID = json_link_id(D2_LINK_D2R4_D2R1_UUID) +D2_LINK_D2R4_D2R1 = json_link(D2_LINK_D2R4_D2R1_UUID, [ + D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['1/2'], D2_ENDPOINT_IDS[D2_DEVICE_D2R1_UUID]['1/1']]) # Inter-domain links -LINK_D2R4_D1R1_UUID = get_link_uuid(ENDPOINT_IDS[DEVICE_D2R4_UUID]['2/1'], ENDPOINT_IDS[DEVICE_D1R1_UUID]['2/1']) -LINK_D2R4_D1R1_ID = json_link_id(LINK_D2R4_D1R1_UUID) -LINK_D2R4_D1R1 = json_link(LINK_D2R4_D1R1_UUID, [ - ENDPOINT_IDS[DEVICE_D2R4_UUID]['2/1'], ENDPOINT_IDS[DEVICE_D1R1_UUID]['2/1']]) +D2_LINK_D2R4_D1R1_UUID = get_link_uuid( + D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['2/1'], D2_ENDPOINT_IDS[D2_DEVICE_D1R1_UUID]['2/1']) +D2_LINK_D2R4_D1R1_ID = json_link_id(D2_LINK_D2R4_D1R1_UUID) +D2_LINK_D2R4_D1R1 = json_link(D2_LINK_D2R4_D1R1_UUID, [ + D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['2/1'], D2_ENDPOINT_IDS[D2_DEVICE_D1R1_UUID]['2/1']]) # ----- Object Collections --------------------------------------------------------------------------------------------- @@ -108,14 +113,14 @@ D2_CONTEXTS = [D2_CONTEXT] D2_TOPOLOGIES = [D2_TOPOLOGY] D2_DEVICES = [ - (DEVICE_D2R1, DEVICE_D2R1_CONNECT_RULES), - (DEVICE_D2R2, DEVICE_D2R2_CONNECT_RULES), - (DEVICE_D2R3, DEVICE_D2R3_CONNECT_RULES), - (DEVICE_D2R4, DEVICE_D2R4_CONNECT_RULES), - (DEVICE_D1R1, DEVICE_D1R1_CONNECT_RULES), + (D2_DEVICE_D2R1, D2_DEVICE_D2R1_CONNECT_RULES), + (D2_DEVICE_D2R2, D2_DEVICE_D2R2_CONNECT_RULES), + (D2_DEVICE_D2R3, D2_DEVICE_D2R3_CONNECT_RULES), + (D2_DEVICE_D2R4, D2_DEVICE_D2R4_CONNECT_RULES), + (D2_DEVICE_D1R1, D2_DEVICE_D1R1_CONNECT_RULES), ] D2_LINKS = [ - LINK_D2R1_D2R2, LINK_D2R2_D2R3, LINK_D2R3_D2R4, LINK_D2R4_D2R1, - LINK_D2R4_D1R1, + D2_LINK_D2R1_D2R2, D2_LINK_D2R2_D2R3, D2_LINK_D2R3_D2R4, D2_LINK_D2R4_D2R1, + D2_LINK_D2R4_D1R1, ] diff --git a/src/tests/oeccpsc22/tests/Objects_Service.py b/src/tests/oeccpsc22/tests/Objects_Service.py index b9ec2a691e03381ff54dc08053063cad87cdeb3b..a9ffadc0fdbe5f464772e195c892112131a2fb69 100644 --- a/src/tests/oeccpsc22/tests/Objects_Service.py +++ b/src/tests/oeccpsc22/tests/Objects_Service.py @@ -1,35 +1,37 @@ - +from .Objects_Domain_1 import D1_DEVICE_D1R1_UUID, D1_ENDPOINT_IDS +from .Objects_Domain_2 import D2_DEVICE_D2R4_UUID, D2_ENDPOINT_IDS +from .Tools import compose_bearer, compose_service_endpoint_id # ----- WIM Service Settings ------------------------------------------------------------------------------------------- -WIM_SEP_R1_ID = compose_service_endpoint_id(ENDPOINT_ID_R1_13_1_2) -WIM_SEP_R1_ROUTER_ID = '10.10.10.1' -WIM_SEP_R1_ROUTER_DIST = '65000:111' -WIM_SEP_R1_SITE_ID = '1' -WIM_SEP_R1_BEARER = compose_bearer(ENDPOINT_ID_R1_13_1_2, WIM_SEP_R1_ROUTER_ID, WIM_SEP_R1_ROUTER_DIST) -WIM_SRV_R1_VLAN_ID = 400 +WIM_SEP_D1R1_ID = compose_service_endpoint_id(D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['3/1']) +WIM_SEP_D1R1_ROUTER_ID = '10.10.10.1' +WIM_SEP_D1R1_ROUTER_DIST = '65000:111' +WIM_SEP_D1R1_SITE_ID = '1' +WIM_SEP_D1R1_BEARER = compose_bearer(D1_ENDPOINT_IDS[D1_DEVICE_D1R1_UUID]['3/1']) +WIM_SRV_D1R1_VLAN_ID = 400 -WIM_SEP_R3_ID = compose_service_endpoint_id(ENDPOINT_ID_R3_13_1_2) -WIM_SEP_R3_ROUTER_ID = '20.20.20.1' -WIM_SEP_R3_ROUTER_DIST = '65000:222' -WIM_SEP_R3_SITE_ID = '2' -WIM_SEP_R3_BEARER = compose_bearer(ENDPOINT_ID_R3_13_1_2, WIM_SEP_R3_ROUTER_ID, WIM_SEP_R3_ROUTER_DIST) -WIM_SRV_R3_VLAN_ID = 500 +WIM_SEP_D2R4_ID = compose_service_endpoint_id(D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['3/3']) +WIM_SEP_D2R4_ROUTER_ID = '20.20.20.1' +WIM_SEP_D2R4_ROUTER_DIST = '65000:222' +WIM_SEP_D2R4_SITE_ID = '2' +WIM_SEP_D2R4_BEARER = compose_bearer(D2_ENDPOINT_IDS[D2_DEVICE_D2R4_UUID]['3/3']) +WIM_SRV_D2R4_VLAN_ID = 500 WIM_USERNAME = 'admin' WIM_PASSWORD = 'admin' WIM_MAPPING = [ - {'device-id': DEVICE_R1_UUID, 'service_endpoint_id': WIM_SEP_R1_ID, - 'service_mapping_info': {'bearer': {'bearer-reference': WIM_SEP_R1_BEARER}, 'site-id': WIM_SEP_R1_SITE_ID}}, - {'device-id': DEVICE_R3_UUID, 'service_endpoint_id': WIM_SEP_R3_ID, - 'service_mapping_info': {'bearer': {'bearer-reference': WIM_SEP_R3_BEARER}, 'site-id': WIM_SEP_R3_SITE_ID}}, + {'device-id': D1_DEVICE_D1R1_UUID, 'service_endpoint_id': WIM_SEP_D1R1_ID, + 'service_mapping_info': {'bearer': {'bearer-reference': WIM_SEP_D1R1_BEARER}, 'site-id': WIM_SEP_D1R1_SITE_ID}}, + {'device-id': D2_DEVICE_D2R4_UUID, 'service_endpoint_id': WIM_SEP_D2R4_ID, + 'service_mapping_info': {'bearer': {'bearer-reference': WIM_SEP_D2R4_BEARER}, 'site-id': WIM_SEP_D2R4_SITE_ID}}, ] -WIM_SERVICE_TYPE = 'ELINE' +WIM_SERVICE_TYPE = 'ELAN' WIM_SERVICE_CONNECTION_POINTS = [ - {'service_endpoint_id': WIM_SEP_R1_ID, + {'service_endpoint_id': WIM_SEP_D1R1_ID, 'service_endpoint_encapsulation_type': 'dot1q', - 'service_endpoint_encapsulation_info': {'vlan': WIM_SRV_R1_VLAN_ID}}, - {'service_endpoint_id': WIM_SEP_R3_ID, + 'service_endpoint_encapsulation_info': {'vlan': WIM_SRV_D1R1_VLAN_ID}}, + {'service_endpoint_id': WIM_SEP_D2R4_ID, 'service_endpoint_encapsulation_type': 'dot1q', - 'service_endpoint_encapsulation_info': {'vlan': WIM_SRV_R3_VLAN_ID}}, + 'service_endpoint_encapsulation_info': {'vlan': WIM_SRV_D2R4_VLAN_ID}}, ] diff --git a/src/tests/oeccpsc22/tests/test_functional_bootstrap.py b/src/tests/oeccpsc22/tests/test_functional_bootstrap.py index b09b558cd96bf794b26dadc99913100bb0ca9de1..413baa57ef5dc5aea6d958b8b87794b0f0affec9 100644 --- a/src/tests/oeccpsc22/tests/test_functional_bootstrap.py +++ b/src/tests/oeccpsc22/tests/test_functional_bootstrap.py @@ -14,11 +14,7 @@ import copy, logging, pytest from common.Settings import get_setting -from common.tests.EventTools import EVENT_CREATE, check_events -from common.tools.object_factory.Device import json_device_id -from common.tools.object_factory.Link import json_link_id from context.client.ContextClient import ContextClient -from context.client.EventsCollector import EventsCollector from context.proto.context_pb2 import Context, ContextId, Device, Empty, Link, Topology from device.client.DeviceClient import DeviceClient from .Objects_Domain_1 import D1_CONTEXT_ID, D1_CONTEXTS, D1_DEVICES, D1_LINKS, D1_TOPOLOGIES diff --git a/src/tests/oeccpsc22/tests/test_functional_create_service.py b/src/tests/oeccpsc22/tests/test_functional_create_service.py index f3389fdbfce4e9262ffddbad876bb86f9b300551..ea9ffad70b5350c8bcbe07acf60dc0c096a3d655 100644 --- a/src/tests/oeccpsc22/tests/test_functional_create_service.py +++ b/src/tests/oeccpsc22/tests/test_functional_create_service.py @@ -15,18 +15,19 @@ import logging, pytest from common.DeviceTypes import DeviceTypeEnum from common.Settings import get_setting -from common.tests.EventTools import EVENT_CREATE, EVENT_UPDATE, check_events -from common.tools.object_factory.Connection import json_connection_id -from common.tools.object_factory.Device import json_device_id -from common.tools.object_factory.Service import json_service_id from common.tools.grpc.Tools import grpc_message_to_json_string from compute.tests.mock_osm.MockOSM import MockOSM from context.client.ContextClient import ContextClient -from context.client.EventsCollector import EventsCollector from context.proto.context_pb2 import ContextId, Empty -from .Objects import ( - CONTEXT_ID, CONTEXTS, DEVICE_O1_UUID, DEVICE_R1_UUID, DEVICE_R3_UUID, DEVICES, LINKS, TOPOLOGIES, - WIM_MAPPING, WIM_PASSWORD, WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE, WIM_USERNAME) +from tests.oeccpsc22.tests.Objects_Domain_1 import D1_CONTEXT_ID, D1_CONTEXTS, D1_DEVICES, D1_LINKS, D1_TOPOLOGIES +from tests.oeccpsc22.tests.Objects_Domain_2 import D2_CONTEXT_ID, D2_CONTEXTS, D2_DEVICES, D2_LINKS, D2_TOPOLOGIES +#from .Objects_Domain_1 import ( +# CONTEXT_ID, CONTEXTS, DEVICE_O1_UUID, DEVICE_R1_UUID, DEVICE_R3_UUID, DEVICES, LINKS, TOPOLOGIES, +# WIM_MAPPING, WIM_PASSWORD, WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE, WIM_USERNAME) +#from .Objects_Domain_2 import ( +# CONTEXT_ID, CONTEXTS, DEVICE_O1_UUID, DEVICE_R1_UUID, DEVICE_R3_UUID, DEVICES, LINKS, TOPOLOGIES, +# WIM_MAPPING, WIM_PASSWORD, WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE, WIM_USERNAME) +from .Objects_Service import WIM_MAPPING, WIM_PASSWORD, WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE, WIM_USERNAME LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -36,94 +37,89 @@ DEVTYPE_EMU_OLS = DeviceTypeEnum.EMULATED_OPTICAL_LINE_SYSTEM.value @pytest.fixture(scope='session') -def context_client(): - _client = ContextClient(get_setting('CONTEXTSERVICE_SERVICE_HOST'), get_setting('CONTEXTSERVICE_SERVICE_PORT_GRPC')) +def d1_context_client(): + _client = ContextClient( + get_setting('D1_CONTEXTSERVICE_SERVICE_HOST'), get_setting('D1_CONTEXTSERVICE_SERVICE_PORT_GRPC')) yield _client _client.close() @pytest.fixture(scope='session') -def osm_wim(): +def d2_context_client(): + _client = ContextClient( + get_setting('D2_CONTEXTSERVICE_SERVICE_HOST'), get_setting('D2_CONTEXTSERVICE_SERVICE_PORT_GRPC')) + yield _client + _client.close() + + +@pytest.fixture(scope='session') +def d1_osm_wim(): wim_url = 'http://{:s}:{:s}'.format( - get_setting('COMPUTESERVICE_SERVICE_HOST'), str(get_setting('COMPUTESERVICE_SERVICE_PORT_HTTP'))) + get_setting('D1_COMPUTESERVICE_SERVICE_HOST'), str(get_setting('D1_COMPUTESERVICE_SERVICE_PORT_HTTP'))) return MockOSM(wim_url, WIM_MAPPING, WIM_USERNAME, WIM_PASSWORD) -def test_scenario_is_correct(context_client : ContextClient): # pylint: disable=redefined-outer-name - # ----- List entities - Ensure links are created ------------------------------------------------------------------- - response = context_client.ListContexts(Empty()) - assert len(response.contexts) == len(CONTEXTS) +def test_scenario_is_correct( + d1_context_client : ContextClient, # pylint: disable=redefined-outer-name + d2_context_client : ContextClient): # pylint: disable=redefined-outer-name + + def per_domain(contexts, topologies, devices, links, context_id, context_client): + response = context_client.ListContexts(Empty()) + assert len(response.contexts) == len(contexts) + + response = context_client.ListTopologies(ContextId(**context_id)) + assert len(response.topologies) == len(topologies) - response = context_client.ListTopologies(ContextId(**CONTEXT_ID)) - assert len(response.topologies) == len(TOPOLOGIES) + response = context_client.ListDevices(Empty()) + assert len(response.devices) == len(devices) - response = context_client.ListDevices(Empty()) - assert len(response.devices) == len(DEVICES) + response = context_client.ListLinks(Empty()) + assert len(response.links) == len(links) - response = context_client.ListLinks(Empty()) - assert len(response.links) == len(LINKS) + response = context_client.ListServices(ContextId(**context_id)) + assert len(response.services) == 0 - response = context_client.ListServices(ContextId(**CONTEXT_ID)) - assert len(response.services) == 0 + # ----- List entities - Ensure scenario is up ---------------------------------------------------------------------- + per_domain(D1_CONTEXTS, D1_TOPOLOGIES, D1_DEVICES, D1_LINKS, D1_CONTEXT_ID, d1_context_client) + per_domain(D2_CONTEXTS, D2_TOPOLOGIES, D2_DEVICES, D2_LINKS, D2_CONTEXT_ID, d2_context_client) -def test_service_creation(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name - # ----- Start the EventsCollector ---------------------------------------------------------------------------------- - events_collector = EventsCollector(context_client, log_events_received=True) - events_collector.start() +def test_service_creation( + d1_osm_wim : MockOSM): # pylint: disable=redefined-outer-name # ----- Create Service --------------------------------------------------------------------------------------------- - service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) - osm_wim.get_connectivity_service_status(service_uuid) + service_uuid = d1_osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) + d1_osm_wim.get_connectivity_service_status(service_uuid) - # ----- Validate collected events ---------------------------------------------------------------------------------- - packet_connection_uuid = '{:s}:{:s}'.format(service_uuid, DEVTYPE_EMU_PR) - optical_connection_uuid = '{:s}:optical:{:s}'.format(service_uuid, DEVTYPE_EMU_OLS) - optical_service_uuid = '{:s}:optical'.format(service_uuid) +def test_scenario_service_created( + d1_context_client : ContextClient, # pylint: disable=redefined-outer-name + d2_context_client : ContextClient): # pylint: disable=redefined-outer-name - expected_events = [ - # Create packet service and add first endpoint - ('ServiceEvent', EVENT_CREATE, json_service_id(service_uuid, context_id=CONTEXT_ID)), - ('ServiceEvent', EVENT_UPDATE, json_service_id(service_uuid, context_id=CONTEXT_ID)), + def per_domain(contexts, topologies, devices, links, context_id, context_client): + response = context_client.ListContexts(Empty()) + assert len(response.contexts) == len(contexts) - # Configure OLS controller, create optical service, create optical connection - ('DeviceEvent', EVENT_UPDATE, json_device_id(DEVICE_O1_UUID)), - ('ServiceEvent', EVENT_CREATE, json_service_id(optical_service_uuid, context_id=CONTEXT_ID)), - ('ConnectionEvent', EVENT_CREATE, json_connection_id(optical_connection_uuid)), + response = context_client.ListTopologies(ContextId(**context_id)) + assert len(response.topologies) == len(topologies) - # Configure endpoint packet devices, add second endpoint to service, create connection - ('DeviceEvent', EVENT_UPDATE, json_device_id(DEVICE_R1_UUID)), - ('DeviceEvent', EVENT_UPDATE, json_device_id(DEVICE_R3_UUID)), - ('ServiceEvent', EVENT_UPDATE, json_service_id(service_uuid, context_id=CONTEXT_ID)), - ('ConnectionEvent', EVENT_CREATE, json_connection_id(packet_connection_uuid)), - ] - check_events(events_collector, expected_events) + response = context_client.ListDevices(Empty()) + assert len(response.devices) == len(devices) - # ----- Stop the EventsCollector ----------------------------------------------------------------------------------- - events_collector.stop() + response = context_client.ListLinks(Empty()) + assert len(response.links) == len(links) + response = context_client.ListServices(ContextId(**context_id)) + LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + assert len(response.services) == 1 # L3NM + for service in response.services: + service_id = service.service_id + response = context_client.ListConnections(service_id) + LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + grpc_message_to_json_string(service_id), len(response.connections), + grpc_message_to_json_string(response))) + assert len(response.connections) == 1 # one connection per service -def test_scenario_service_created(context_client : ContextClient): # pylint: disable=redefined-outer-name # ----- List entities - Ensure service is created ------------------------------------------------------------------ - response = context_client.ListContexts(Empty()) - assert len(response.contexts) == len(CONTEXTS) - - response = context_client.ListTopologies(ContextId(**CONTEXT_ID)) - assert len(response.topologies) == len(TOPOLOGIES) - - response = context_client.ListDevices(Empty()) - assert len(response.devices) == len(DEVICES) - - response = context_client.ListLinks(Empty()) - assert len(response.links) == len(LINKS) - - response = context_client.ListServices(ContextId(**CONTEXT_ID)) - LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) - assert len(response.services) == 2 # L3NM + TAPI - for service in response.services: - service_id = service.service_id - response = context_client.ListConnections(service_id) - LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( - grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) - assert len(response.connections) == 1 # one connection per service + per_domain(D1_CONTEXTS, D1_TOPOLOGIES, D1_DEVICES, D1_LINKS, D1_CONTEXT_ID, d1_context_client) + per_domain(D2_CONTEXTS, D2_TOPOLOGIES, D2_DEVICES, D2_LINKS, D2_CONTEXT_ID, d2_context_client)