diff options
Diffstat (limited to 'test')
9 files changed, 169 insertions, 76 deletions
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 } |