diff options
author | krishnaa96 <krishna.moorthy6@wipro.com> | 2021-09-09 16:23:17 +0530 |
---|---|---|
committer | krishnaa96 <krishna.moorthy6@wipro.com> | 2021-10-04 21:13:51 +0530 |
commit | e35d4a1b94bbcd844300282d1c3c8722ef58062d (patch) | |
tree | 1e3db2313ba02a09feb48842852c8118547072f9 | |
parent | 92373ddd2e28cc2000a2634d273836fea5d87a6e (diff) |
Support second level NSSI in terminate app
Issue-ID: OPTFRA-990
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: If47b19d18e5eb1cbef24418c7697e0770818959f
-rw-r--r-- | apps/nxi_termination/optimizers/remote_opt_processor.py | 59 | ||||
-rw-r--r-- | config/common_config.yaml | 10 | ||||
-rwxr-xr-x | csit/scripts/osdf-properties/osdf_config.yaml | 2 | ||||
-rw-r--r-- | csit/tests/osdf/optf_osdf_nxi_termination.robot | 2 | ||||
-rw-r--r-- | osdf/adapters/aai/fetch_aai_data.py | 3 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | test/apps/nxi_termination/failure_relationship_list.json | 87 | ||||
-rw-r--r-- | test/apps/nxi_termination/invalid_request.json | 4 | ||||
-rw-r--r-- | test/apps/nxi_termination/nxi_termination.json | 4 | ||||
-rw-r--r-- | test/apps/nxi_termination/success_relationship_list.json | 55 | ||||
-rw-r--r-- | test/apps/nxi_termination/test_remote_opt_processor_termination.py | 14 | ||||
-rw-r--r-- | test/functest/simulators/aai/response-payloads/nsi_instance.json | 13 | ||||
-rw-r--r-- | test/functest/simulators/aai/response-payloads/nsi_instance_with_args.json | 45 | ||||
-rwxr-xr-x | test/functest/simulators/build_sim_image.sh | 1 | ||||
-rw-r--r-- | test/functest/simulators/oof_dependencies_simulators.py | 22 |
15 files changed, 223 insertions, 100 deletions
diff --git a/apps/nxi_termination/optimizers/remote_opt_processor.py b/apps/nxi_termination/optimizers/remote_opt_processor.py index 7878f5d..fc3bc17 100644 --- a/apps/nxi_termination/optimizers/remote_opt_processor.py +++ b/apps/nxi_termination/optimizers/remote_opt_processor.py @@ -21,6 +21,7 @@ from jinja2 import Template from apps.nxi_termination.optimizers.response_processor import get_nxi_termination_response from osdf.adapters.aai.fetch_aai_data import AAIException from osdf.adapters.aai.fetch_aai_data import execute_dsl_query +from osdf.adapters.aai.fetch_aai_data import get_aai_data from osdf.logging.osdf_logging import debug_log @@ -42,25 +43,38 @@ def process_nxi_termination_opt(request_json, osdf_config): } try: + if request_type == "NSSI": + templates = query_templates["nssi"] + for template in templates: + resource_count = get_resource_count(template, inputs, osdf_config) + if resource_count == -1: + continue + elif resource_count > 1 or (resource_count == 1 and not addtnl_args.get("serviceInstanceId")): + terminate_response = False + elif resource_count == 0: + terminate_response = True + elif resource_count == 1 and addtnl_args.get("serviceInstanceId"): + new_template = template + "('service-instance-id','{}')".format(addtnl_args["serviceInstanceId"]) + terminate_response = get_resource_count(new_template, inputs, osdf_config) == 1 + return set_response("success", "", request_info, terminate_response) + if request_type == "NSI": - query_type = "nsi" - if addtnl_args and "serviceProfileId" in addtnl_args: - inputs["profile_id"] = addtnl_args["serviceProfileId"] - query_type = "nsi_with_profile" - else: - query_type = "nssi" - if addtnl_args and "serviceInstanceId" in addtnl_args: - inputs["nsi_id"] = addtnl_args["serviceInstanceId"] - query_type = "nssi_with_nsi" - - debug_log.debug("query type: {}".format(query_type)) - - resource_count = get_resource_count(query_templates[query_type], inputs, osdf_config) - if query_type not in ["nsi", "nssi"]: - # if additional args is provided, it must have exactly one resource in its relationships - resource_count = resource_count - 1 - - return set_response("success", "", request_info, resource_count <= 0) + allotted_resources = get_allotted_resources(request_json, osdf_config) + resource_count = len(allotted_resources) + if resource_count == 1 and addtnl_args.get("serviceInstanceId"): + debug_log.debug("resource count {}".format(resource_count)) + terminate_response = False + properties = allotted_resources[0]["relationship-data"] + for property in properties: + if property["relationship-key"] == "service-instance.service-instance-id" \ + and property["relationship-value"] == addtnl_args.get("serviceInstanceId"): + terminate_response = True + elif resource_count > 1 or (resource_count == 1 and not addtnl_args.get("serviceInstanceId")): + terminate_response = False + elif resource_count == 0: + terminate_response = True + + return set_response("success", "", request_info, terminate_response) except AAIException as e: reason = str(e) return set_response("failure", reason, request_info) @@ -83,4 +97,11 @@ def get_resource_count(query_template, inputs, osdf_config): dsl_response = execute_dsl_query(query, "count", osdf_config) debug_log.debug("dsl_response {}".format(dsl_response)) # the dsl query with format "count" includes the original service-instance, hence reducing one from the result - return dsl_response["results"][0]["service-instance"] - 1 + count = dsl_response["results"][0] + return count.get("service-instance", 0) - 1 + + +def get_allotted_resources(request_json, osdf_config): + response = get_aai_data(request_json, osdf_config) + rel_list = response["relationship-list"]["relationship"] + return [rel for rel in rel_list if rel["related-to"] == "allotted-resource"] diff --git a/config/common_config.yaml b/config/common_config.yaml index b9578f2..5307776 100644 --- a/config/common_config.yaml +++ b/config/common_config.yaml @@ -155,5 +155,11 @@ nxi_termination: query_templates: nsi: "service-instance*('service-instance-id','{{instance_id}}') > service-instance*('service-role','e2eserviceprofile-service')" nsi_with_profile: "service-instance*('service-instance-id','{{instance_id}}') > service-instance*('service-role','e2eserviceprofile-service')('service-instance-id','{{profile_id}}')" - nssi: "service-instance*('service-instance-id','{{instance_id}}') > service-instance*('service-role','nsi')" - nssi_with_nsi: "service-instance*('service-instance-id','{{instance_id}}') > service-instance*('service-role','nsi')('service-instance-id','{{nsi_id}}')"
\ No newline at end of file + nssi: + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'CN') > service-instance*('service-role','nsi')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'CN') > service-instance*('service-role','nsi')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'TN-BH') > service-instance*('service-role','nsi')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'AN') > service-instance*('service-role','nsi')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'AN-NF') > service-instance*('workload-context','AN')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'TN-MH') > service-instance*('workload-context','AN')" + - "service-instance*('service-instance-id','{{instance_id}}')('workload-context', 'AN-NF') > service-instance*('workload-context','AN')" diff --git a/csit/scripts/osdf-properties/osdf_config.yaml b/csit/scripts/osdf-properties/osdf_config.yaml index 93ea197..f97a743 100755 --- a/csit/scripts/osdf-properties/osdf_config.yaml +++ b/csit/scripts/osdf-properties/osdf_config.yaml @@ -60,7 +60,7 @@ cpsPassword: '' #aai api aaiUrl: "http://127.0.0.1:5000" aaiGetLinksUrl: "/aai/v16/network/logical-links" -aaiServiceInstanceUrl : "/aai/v20/nodes/service-instances/service-instance/" +aaiServiceInstanceUrl : "/simulated/aai/v23/nodes/service-instances/service-instance/" aaiGetControllersUrl: /aai/v19/external-system/esr-thirdparty-sdnc-list controllerQueryUrl: /aai/v19/query?format=resource aaiGetInterDomainLinksUrl: /aai/v19/network/logical-links?link-type=inter-domain&operational-status=up diff --git a/csit/tests/osdf/optf_osdf_nxi_termination.robot b/csit/tests/osdf/optf_osdf_nxi_termination.robot index da6836e..881d4cd 100644 --- a/csit/tests/osdf/optf_osdf_nxi_termination.robot +++ b/csit/tests/osdf/optf_osdf_nxi_termination.robot @@ -33,7 +33,7 @@ TerminationRequestGeneration Set Global Variable ${nssi_termination_request} ${nsi_termination_request_args}= copy.deepcopy ${nsi_termination_request} ${request_info}= Set Variable ${nsi_termination_request_args["requestInfo"]} - ${addtnl_args}= Create Dictionary serviceProfileId=660ca85c-1a0f-4521-a559-65f23e794699 + ${addtnl_args}= Create Dictionary serviceInstanceId=660ca85c-1a0f-4521-a559-65f23e794699 Set To Dictionary ${request_info} addtnlArgs=${addtnl_args} Set To Dictionary ${nsi_termination_request_args} requestInfo=${request_info} Set Global Variable ${nsi_termination_request_args} diff --git a/osdf/adapters/aai/fetch_aai_data.py b/osdf/adapters/aai/fetch_aai_data.py index fad2512..170d5e5 100644 --- a/osdf/adapters/aai/fetch_aai_data.py +++ b/osdf/adapters/aai/fetch_aai_data.py @@ -52,7 +52,9 @@ def get_aai_data(request_json, osdf_config): aai_req_url = aai_url + config["aaiServiceInstanceUrl"] + nxi_id + "?depth=2" try: + debug_log.debug("aai request: {}".format(aai_req_url)) response = requests.get(aai_req_url, headers=AAI_HEADERS, auth=AUTH, verify=False) + debug_log.debug("aai response: {}".format(response.json())) except RequestException as e: raise AAIException("Request exception was encountered {}".format(e)) @@ -77,6 +79,7 @@ def execute_dsl_query(query, format, osdf_config): debug_log.debug("aai dsl request: {}".format(data)) try: response = requests.put(dsl_url, data=data, headers=AAI_HEADERS, auth=AUTH, verify=False) + debug_log.debug("aai dsl response: {}".format(response)) except RequestException as ex: raise AAIException("Request exception was encountered {}".format(ex)) @@ -29,7 +29,7 @@ http://maven.apache.org/POM/4.0.0 "> <groupId>org.onap.optf.osdf</groupId> <artifactId>optf-osdf</artifactId> <name>optf-osdf</name> - <version>3.0.5-SNAPSHOT</version> + <version>3.0.6-SNAPSHOT</version> <description>Optimization Service Design Framework</description> <properties> diff --git a/test/apps/nxi_termination/failure_relationship_list.json b/test/apps/nxi_termination/failure_relationship_list.json index 537f283..392f4db 100644 --- a/test/apps/nxi_termination/failure_relationship_list.json +++ b/test/apps/nxi_termination/failure_relationship_list.json @@ -1,27 +1,66 @@ [ + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v23/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/d88b6ce6-19be-439d-8553-4f9d6cce0494/allotted-resources/allotted-resource/07138106-f535-413b-b002-40ba24f95937", + "relationship-data": [ { - "related-to": "service-instance", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4115d3c8-dd59-45d6-b09d-e756dee9b518", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "5GCustomer" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "5G" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "4115d3c8-dd59-45d6-b09d-e756dee9b567" - } - ], - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "nsi_test_0211" - } - ] + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "07138106-f535-413b-b002-40ba24f95937" + }, + { + "relationship-key": "allotted-resource.id", + "relationship-value": "07138106-f535-413b-b002-40ba24f95937" + } + ], + "related-to-property": [ + { + "property-key": "allotted-resource.description" + }, + { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_coe" + } + ] + }, + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v23/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/d88b6ce6-19be-439d-8553-4f9d6cce0494/allotted-resources/allotted-resource/07138106-f535-413b-b002-40ba24f95937", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "d290f1ee-6c54-4b01-90e6-d701748f0851" + }, + { + "relationship-key": "allotted-resource.id", + "relationship-value": "d290f1ee-6c54-4b01-90e6-d701748f0851" + } + ], + "related-to-property": [ + { + "property-key": "allotted-resource.description" + }, + { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_terminate" } - ]
\ No newline at end of file + ] + } +]
\ No newline at end of file diff --git a/test/apps/nxi_termination/invalid_request.json b/test/apps/nxi_termination/invalid_request.json index 793776d..72eafd7 100644 --- a/test/apps/nxi_termination/invalid_request.json +++ b/test/apps/nxi_termination/invalid_request.json @@ -6,7 +6,7 @@ "sourceId": "SO", "timeout": 5, "addtnlArgs": { - "serviceProfileId":"cdad9f49-4201-4e3a-aac1-b0f27902c299" + "serviceInstanceId":"cdad9f49-4201-4e3a-aac1-b0f27902c299" } }, "type":"NST", @@ -14,4 +14,4 @@ "UUID":"d290f1ee-6c54-4b01-90e6-d701748f0851", "invariantUUID":"d290f1ee-6c54-4b01-90e6-d701748f0851" -}
\ No newline at end of file +} diff --git a/test/apps/nxi_termination/nxi_termination.json b/test/apps/nxi_termination/nxi_termination.json index ac53c4d..1e25f2e 100644 --- a/test/apps/nxi_termination/nxi_termination.json +++ b/test/apps/nxi_termination/nxi_termination.json @@ -6,7 +6,7 @@ "sourceId": "SO", "timeout": 5, "addtnlArgs": { - "serviceProfileId":"cdad9f49-4201-4e3a-aac1-b0f27902c299" + "serviceInstanceId":"cdad9f49-4201-4e3a-aac1-b0f27902c299" } }, "type":"NSI", @@ -14,4 +14,4 @@ "UUID":"d290f1ee-6c54-4b01-90e6-d701748f0851", "invariantUUID":"d290f1ee-6c54-4b01-90e6-d701748f0851" -}
\ No newline at end of file +} diff --git a/test/apps/nxi_termination/success_relationship_list.json b/test/apps/nxi_termination/success_relationship_list.json index 4f2a8bb..608418d 100644 --- a/test/apps/nxi_termination/success_relationship_list.json +++ b/test/apps/nxi_termination/success_relationship_list.json @@ -1,27 +1,34 @@ [ + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v23/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/d88b6ce6-19be-439d-8553-4f9d6cce0494/allotted-resources/allotted-resource/07138106-f535-413b-b002-40ba24f95937", + "relationship-data": [ { - "related-to": "service-instance", - "relationship-label": "org.onap.relationships.inventory.ComposedOf", - "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4115d3c8-dd59-45d6-b09d-e756dee9b518", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "5GCustomer" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "5G" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "4115d3c8-dd59-45d6-b09d-e756dee9b518" - } - ], - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "nsi_test_0211" - } - ] + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cdad9f49-4201-4e3a-aac1-b0f27902c299" + }, + { + "relationship-key": "allotted-resource.id", + "relationship-value": "07138106-f535-413b-b002-40ba24f95937" + } + ], + "related-to-property": [ + { + "property-key": "allotted-resource.description" + }, + { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_coe" } - ]
\ No newline at end of file + ] + } +]
\ No newline at end of file diff --git a/test/apps/nxi_termination/test_remote_opt_processor_termination.py b/test/apps/nxi_termination/test_remote_opt_processor_termination.py index 9fbc27b..555f2e8 100644 --- a/test/apps/nxi_termination/test_remote_opt_processor_termination.py +++ b/test/apps/nxi_termination/test_remote_opt_processor_termination.py @@ -69,13 +69,13 @@ class TestRemoteOptProcessor(unittest.TestCase): exception_response_json1 = json_from_file(exception_response_file1) #nsi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_allotted_resources', return_value=success_rel_json) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() #nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=3) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_allotted_resources', return_value=failure_rel_json) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json1, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() @@ -83,18 +83,12 @@ class TestRemoteOptProcessor(unittest.TestCase): request_json["requestInfo"]["addtnlArgs"] = {} #nsi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', - return_value=0) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_allotted_resources', + return_value=[]) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() - # nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', - return_value=1) - self.Mock_req = self.patcher_req.start() - self.assertEquals(nxi_failure_output_json2, process_nxi_termination_opt(request_json, osdf_config)) - self.patcher_req.stop() # # # nssi success scenario self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) diff --git a/test/functest/simulators/aai/response-payloads/nsi_instance.json b/test/functest/simulators/aai/response-payloads/nsi_instance.json new file mode 100644 index 0000000..b09d2e4 --- /dev/null +++ b/test/functest/simulators/aai/response-payloads/nsi_instance.json @@ -0,0 +1,13 @@ +{ + "service-instance-id": "9629e36c-a3d9-4aed-8368-f72b8be1cd34", + "service-instance-name": "nsi_test_0211", + "service-type": "embb", + "service-role": "nsi", + "environment-context": "cn", + "model-invariant-id": "21d57d4b-52ad-4d3c-a798-248b5bb9124a", + "model-version-id": "bfba363e-e39c-4bd9-a9d5-1371c28f4d22", + "resource-version": "1581418601616", + "orchestration-status": "active", + "relationship-list": { + "relationship": [ +]}} diff --git a/test/functest/simulators/aai/response-payloads/nsi_instance_with_args.json b/test/functest/simulators/aai/response-payloads/nsi_instance_with_args.json new file mode 100644 index 0000000..19e5ac1 --- /dev/null +++ b/test/functest/simulators/aai/response-payloads/nsi_instance_with_args.json @@ -0,0 +1,45 @@ +{ + "service-instance-id": "9629e36c-a3d9-4aed-8368-f72b8be1cd34", + "service-instance-name": "nsi_test_0211", + "service-type": "embb", + "service-role": "nsi", + "environment-context": "cn", + "model-invariant-id": "21d57d4b-52ad-4d3c-a798-248b5bb9124a", + "model-version-id": "bfba363e-e39c-4bd9-a9d5-1371c28f4d22", + "resource-version": "1581418601616", + "orchestration-status": "active", + "relationship-list": { + "relationship": [ + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v23/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/d88b6ce6-19be-439d-8553-4f9d6cce0494/allotted-resources/allotted-resource/07138106-f535-413b-b002-40ba24f95937", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cdad9f49-4201-4e3a-aac1-b0f27902c299" + }, + { + "relationship-key": "allotted-resource.id", + "relationship-value": "07138106-f535-413b-b002-40ba24f95937" + } + ], + "related-to-property": [ + { + "property-key": "allotted-resource.description" + }, + { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_coe" + } + ] + } +]}} diff --git a/test/functest/simulators/build_sim_image.sh b/test/functest/simulators/build_sim_image.sh index 5d46ecb..6a71d3c 100755 --- a/test/functest/simulators/build_sim_image.sh +++ b/test/functest/simulators/build_sim_image.sh @@ -43,6 +43,7 @@ cp $SIMULATORS_DIR/simulated-config/*.config $DOCKER_DIR/sim/config/ cp -r $SIMULATORS_DIR/configdb $DOCKER_DIR/sim cp -r $SIMULATORS_DIR/has-api $DOCKER_DIR/sim cp -r $SIMULATORS_DIR/policy $DOCKER_DIR/sim +cp -r $SIMULATORS_DIR/aai $DOCKER_DIR/sim cp $TEST_DIR/policy-local-files/*.json $DOCKER_DIR/sim/policy/response-payloads/pdp-has-vcpe-good cp $TEST_DIR/placement-tests/policy_response.json $DOCKER_DIR/sim/policy/response-payloads/ cp $SIMULATORS_DIR/oof_dependencies_simulators.py $DOCKER_DIR/sim/oof_dependencies_simulators.py diff --git a/test/functest/simulators/oof_dependencies_simulators.py b/test/functest/simulators/oof_dependencies_simulators.py index 53cc74e..d7b1f04 100644 --- a/test/functest/simulators/oof_dependencies_simulators.py +++ b/test/functest/simulators/oof_dependencies_simulators.py @@ -118,36 +118,30 @@ def get_nbr_list(cell_id, ts): return jsonify(data) return jsonify(data), 503 +@app.route("/simulated/aai/v23/nodes/service-instances/service-instance/<service_id>", methods=["GET"]) +def get_aai_instances(service_id): + data, status = get_payload_for_simulated_component('aai', 'nsi_instance.json') + if not status: + return jsonify(data) + return jsonify(data), 503 @app.route("/simulated/aai/v23/dsl", methods=["PUT"]) def dsl_query(): - nsi_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34') > " - "service-instance*('service-role','e2eserviceprofile-service')"} - - nssi_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34') > " + nssi_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34')('workload-context', 'CN') > " "service-instance*('service-role','nsi')"} - nsi_with_sp_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34') > " - "service-instance*('service-role','e2eserviceprofile-service')(" - "'service-instance-id'," - "'660ca85c-1a0f-4521-a559-65f23e794699660ca85c-1a0f-4521-a559-65f23e794699')"} - - nssi_with_nsi_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34') > " + nssi_with_nsi_query = {"dsl": "service-instance*('service-instance-id','9629e36c-a3d9-4aed-8368-f72b8be1cd34')('workload-context', 'CN') > " "service-instance*('service-role','nsi')('service-instance-id'," "'660ca85c-1a0f-4521-a559-65f23e794699')"} queries = { - "nsi": nsi_query, "nssi_query": nssi_query, - "nsi_with_sp": nsi_with_sp_query, "nssi_with_nsi": nssi_with_nsi_query } count = { - "nsi": 1, "nssi_query": 1, - "nsi_with_sp": 2, "nssi_with_nsi": 2 } |