From ac6c8501503d272c691b71a98078cc3fab1cc8c9 Mon Sep 17 00:00:00 2001 From: hariharan97 Date: Thu, 25 Feb 2021 14:19:44 +0530 Subject: [PATCH] CSIT for NST selection enhancements Issue-ID: OPTFRA-764 Signed-off-by: hariharan97 Change-Id: Ic431c58c96a517fd939f337f3352f28ae4e5e8c3 --- .../has/has-properties/conductor.conf.onap | 48 +++++++++++++++++++ scripts/optf-has/has/has_script.sh | 9 +++- scripts/optf-has/has/simulator_script.sh | 19 ++++++++ scripts/optf-has/has/simulator_teardown_script.sh | 2 + .../data/nsi_selection_template_with_create.json | 19 +------- .../data/nsi_selection_template_with_nonsi.json | 19 +------- .../data/nsi_selection_template_with_reuse.json | 20 +------- .../optf-has/has/data/nssi_selection_template.json | 9 ---- .../data/nssi_selection_template_unmatched.json | 10 +--- .../optf-has/has/data/nst_selection_template.json | 55 ++++++++++++++++++++++ tests/optf-has/has/optf_has_test.robot | 34 +++++++++++++ 11 files changed, 171 insertions(+), 73 deletions(-) create mode 100644 tests/optf-has/has/data/nst_selection_template.json diff --git a/scripts/optf-has/has/has-properties/conductor.conf.onap b/scripts/optf-has/has/has-properties/conductor.conf.onap index 3ce7fa05..b8b0a0ad 100644 --- a/scripts/optf-has/has/has-properties/conductor.conf.onap +++ b/scripts/optf-has/has/has-properties/conductor.conf.onap @@ -585,3 +585,51 @@ concurrent = true # Extensions list to use (list value) #extensions = multicloud + + +[sdc] + +# +# From conductor +# + + +# Data Store table prefix. (string value) +#table_prefix = sdc + +# Base URL for SDC, up to and not including the version, and without a +# trailing slash. (string value) +#server_url = https://controller:8443/sdc +server_url = http://localhost:9595/sdc + +# Timeout for SDC Rest Call (string value) +#sdc_rest_timeout = 30 + +# Number of retry for SDC Rest Call (string value) +#sdc_retries = 3 + +# The version of A&AI in v# format. (string value) +server_url_version = v1 + +# SSL/TLS certificate file in pem format. This certificate must be registered +# with the SDC endpoint. (string value) +#certificate_file = certificate.pem +certificate_file = + +# Private Certificate Key file in pem format. (string value) +#certificate_key_file = certificate_key.pem +certificate_key_file = + +# Certificate Authority Bundle file in pem format. Must contain the appropriate +# trust chain for the Certificate file. (string value) +#certificate_authority_bundle_file = certificate_authority_bundle.pem +certificate_authority_bundle_file = /usr/local/bin/AAF_RootCA.cer + +# Username for SDC. (string value) +#username = + +# Password for SDC. (string value) +#password = + +temp_path = "/tmp/nsttemplates" + diff --git a/scripts/optf-has/has/has_script.sh b/scripts/optf-has/has/has_script.sh index 3b24d47a..b845dda5 100755 --- a/scripts/optf-has/has/has_script.sh +++ b/scripts/optf-has/has/has_script.sh @@ -31,7 +31,7 @@ cd ${DIR} COND_CONF=/tmp/conductor/properties/conductor.conf LOG_CONF=/tmp/conductor/properties/log.conf IMAGE_NAME=nexus3.onap.org:10001/onap/optf-has -IMAGE_VER=2.1.2-SNAPSHOT-latest +IMAGE_VER=2.1.3-SNAPSHOT-latest BUNDLE=/tmp/conductor/properties/AAF_RootCA.cer mkdir -p /tmp/conductor/properties @@ -57,6 +57,13 @@ echo "AAISIM_IP=${AAISIM_IP}" # change AAI reference to the local instance sed -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf +SDCSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' sdcsim` +echo "SDCSIM_IP=${SDCSIM_IP}" + +# change SDC reference to the local instance +sed -i -e "s%localhost:9595/%${SDCSIM_IP}:9595/%g" /tmp/conductor/properties/conductor.conf + + MULTICLOUDSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' multicloudsim` echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}" diff --git a/scripts/optf-has/has/simulator_script.sh b/scripts/optf-has/has/simulator_script.sh index c52535cb..a3e4faa6 100755 --- a/scripts/optf-has/has/simulator_script.sh +++ b/scripts/optf-has/has/simulator_script.sh @@ -71,6 +71,25 @@ echo "MULTICLOUDSIM_IP=${MULTICLOUDSIM_IP}" ${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${MULTICLOUDSIM_IP} 8082 + +# prepare sdcsim +cd ${WORK_DIR}/has/conductor/conductor/tests/functional/simulators/sdcsim/ + +# check Dockerfile content +cat ./Dockerfile + +# build multicloudsim +docker build -t sdcsim . + +# run multicloudsim +docker run -d --name sdcsim -p 9595:9595 sdcsim + +SDCSIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' sdcsim` +echo "SDCSIM_IP=${SDCSIM_IP}" + +${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${SDCSIM_IP} 9595 + + # prepare aafsim echo "simulator_script: prepare aafsim " cd ${WORK_DIR}/has/conductor/conductor/tests/functional/simulators/aafsim/ diff --git a/scripts/optf-has/has/simulator_teardown_script.sh b/scripts/optf-has/has/simulator_teardown_script.sh index eb29445a..14b38868 100755 --- a/scripts/optf-has/has/simulator_teardown_script.sh +++ b/scripts/optf-has/has/simulator_teardown_script.sh @@ -18,7 +18,9 @@ echo "optf/has scripts docker containers killing"; docker stop aaisim docker stop multicloudsim docker stop aafsim +docker stop sdcsim docker rm aaisim docker rm multicloudsim docker rm aafsim +docker rm sdcsim \ No newline at end of file diff --git a/tests/optf-has/has/data/nsi_selection_template_with_create.json b/tests/optf-has/has/data/nsi_selection_template_with_create.json index 6d659f9e..acf53ff6 100644 --- a/tests/optf-has/has/data/nsi_selection_template_with_create.json +++ b/tests/optf-has/has/data/nsi_selection_template_with_create.json @@ -26,14 +26,6 @@ "get_param": "reliability" }, "unit": "" - }, - { - "attribute": "coverage_area_ta_list", - "operator": "eq", - "threshold": { - "get_param": "coverage_area_ta_list" - }, - "unit": "" } ] }, @@ -63,8 +55,7 @@ "filtering_attributes": { "service_profile": { "latency": {"value": {"get_param": "latency"}, "operator": "lte"}, - "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"}, - "coverage_area_ta_list": {"value": {"get_param": "coverage_area_ta_list"}, "operator": "eq"} + "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"} }, "subnets":{ "core": { @@ -86,13 +77,6 @@ } }, "ran": { - "coverage_area_ta_list": { - "values": [ - { - "get_param": "coverage_area_ta_list" - } - ] - }, "latency": { "max": { "get_param": "latency" @@ -155,7 +139,6 @@ "parameters": { "core_latency": 10, "core_reliability": 99.9, - "coverage_area_ta_list": "Chennai", "latency": 30, "ran_latency": 7, "ran_reliability": 99.9, diff --git a/tests/optf-has/has/data/nsi_selection_template_with_nonsi.json b/tests/optf-has/has/data/nsi_selection_template_with_nonsi.json index 1b5b99e4..b4e625a2 100644 --- a/tests/optf-has/has/data/nsi_selection_template_with_nonsi.json +++ b/tests/optf-has/has/data/nsi_selection_template_with_nonsi.json @@ -26,14 +26,6 @@ "get_param": "reliability" }, "unit": "" - }, - { - "attribute": "coverage_area_ta_list", - "operator": "eq", - "threshold": { - "get_param": "coverage_area_ta_list" - }, - "unit": "" } ] }, @@ -63,8 +55,7 @@ "filtering_attributes": { "service_profile": { "latency": {"value": {"get_param": "latency"}, "operator": "lte"}, - "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"}, - "coverage_area_ta_list": {"value": {"get_param": "coverage_area_ta_list"}, "operator": "eq"} + "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"} }, "subnets":{ "core": { @@ -86,13 +77,6 @@ } }, "ran": { - "coverage_area_ta_list": { - "values": [ - { - "get_param": "coverage_area_ta_list" - } - ] - }, "latency": { "max": { "get_param": "latency" @@ -155,7 +139,6 @@ "parameters": { "core_latency": 10, "core_reliability": 99.9, - "coverage_area_ta_list": "Chennai", "latency": 30, "ran_latency": 7, "ran_reliability": 99.9, diff --git a/tests/optf-has/has/data/nsi_selection_template_with_reuse.json b/tests/optf-has/has/data/nsi_selection_template_with_reuse.json index ff66b2d2..3cce5f9c 100644 --- a/tests/optf-has/has/data/nsi_selection_template_with_reuse.json +++ b/tests/optf-has/has/data/nsi_selection_template_with_reuse.json @@ -26,14 +26,6 @@ "get_param": "reliability" }, "unit": "" - }, - { - "attribute": "coverage_area_ta_list", - "operator": "eq", - "threshold": { - "get_param": "coverage_area_ta_list" - }, - "unit": "" } ] }, @@ -63,8 +55,7 @@ "filtering_attributes": { "service_profile": { "latency": {"value": {"get_param": "latency"}, "operator": "lte"}, - "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"}, - "coverage_area_ta_list": {"value": {"get_param": "coverage_area_ta_list"}, "operator": "eq"} + "reliability": {"value": {"get_param": "reliability"}, "operator": "gte"} }, "subnets":{ "core": { @@ -86,13 +77,7 @@ } }, "ran": { - "coverage_area_ta_list": { - "values": [ - { - "get_param": "coverage_area_ta_list" - } - ] - }, + "latency": { "max": { "get_param": "latency" @@ -155,7 +140,6 @@ "parameters": { "core_latency": 10, "core_reliability": 99.9, - "coverage_area_ta_list": "Chennai", "latency": 30, "ran_latency": 7, "ran_reliability": 99.9, diff --git a/tests/optf-has/has/data/nssi_selection_template.json b/tests/optf-has/has/data/nssi_selection_template.json index a498ca0b..e1656949 100644 --- a/tests/optf-has/has/data/nssi_selection_template.json +++ b/tests/optf-has/has/data/nssi_selection_template.json @@ -7,7 +7,6 @@ "template": { "homing_template_version": "2020-08-13", "parameters": { - "coverage_area_ta_list": "Chennai", "latency": 30, "reliability": 99.9 }, @@ -51,14 +50,6 @@ "get_param": "reliability" }, "unit": "" - }, - { - "attribute": "coverage_area_ta_list", - "operator": "eq", - "threshold": { - "get_param": "coverage_area_ta_list" - }, - "unit": "" } ] }, diff --git a/tests/optf-has/has/data/nssi_selection_template_unmatched.json b/tests/optf-has/has/data/nssi_selection_template_unmatched.json index 49302801..23500c5b 100644 --- a/tests/optf-has/has/data/nssi_selection_template_unmatched.json +++ b/tests/optf-has/has/data/nssi_selection_template_unmatched.json @@ -7,7 +7,6 @@ "template": { "homing_template_version": "2020-08-13", "parameters": { - "coverage_area_ta_list": "Chennai", "latency": 5, "reliability": 99.9 }, @@ -51,15 +50,8 @@ "get_param": "reliability" }, "unit": "" - }, - { - "attribute": "coverage_area_ta_list", - "operator": "eq", - "threshold": { - "get_param": "coverage_area_ta_list" - }, - "unit": "" } + ] }, "type": "threshold" diff --git a/tests/optf-has/has/data/nst_selection_template.json b/tests/optf-has/has/data/nst_selection_template.json new file mode 100644 index 00000000..41819141 --- /dev/null +++ b/tests/optf-has/has/data/nst_selection_template.json @@ -0,0 +1,55 @@ +{ + "name":"urllc_sample", + "files":{ + + }, + "limit":10, + "num_solution":"1", + "timeout":1200, + "template":{ + "homing_template_version":"2020-08-13", + "demands":{ + "nst_demand":[ + { + "inventory_provider":"aai", + "inventory_type":"nst", + "unique":"true", + "region":"RegionOne", + "filtering_attributes":{ + "model-role":"nst" + } + } + ] + }, + "constraints":{ + "nst_Threshold":{ + "type":"threshold", + "demands":[ + "nst_demand" + ], + "properties":{ + "evaluate":[ + { + "attribute":"latency", + "operator":"lte", + "threshold":30, + "unit":"ms" + } + ] + } + } }, + "optimization":{ + "goal": "minimize", + "operation_function": { + "operator": "sum", + "operands": [{ + "function": "attribute", + "params": { + "demand": "nst_demand", + "attribute": "latency" + } + }] + } + } + } +} \ No newline at end of file diff --git a/tests/optf-has/has/optf_has_test.robot b/tests/optf-has/has/optf_has_test.robot index 9185fcea..6085bcea 100644 --- a/tests/optf-has/has/optf_has_test.robot +++ b/tests/optf-has/has/optf_has_test.robot @@ -686,6 +686,40 @@ GetPlanWithNssiSelectionUnmatched Should Be Equal As Integers ${resp.status_code} 200 Should Be Equal not found ${resultStatus} +# NST selection template +SendPlanWithNSTSelection + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}nst_selection_template.json + &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 60s Wait Plan Resolution + +GetPlanWithNsTSelection + [Documentation] It sends a REST GET request to capture recommendations + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + ${instance_name}= Convert To String ${response_json['plans'][0]['recommendations'][0]['nst_demand']['candidate']['model_name']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal done ${resultStatus} + Should Be Equal EmbbNst ${instance_name} + *** Keywords *** -- 2.16.6