CSIT for NST selection enhancements 67/118467/3
authorhariharan97 <rh20085046@wipro.com>
Thu, 25 Feb 2021 08:49:44 +0000 (14:19 +0530)
committerhariharan97 <rh20085046@wipro.com>
Tue, 2 Mar 2021 02:31:19 +0000 (08:01 +0530)
Issue-ID: OPTFRA-764
Signed-off-by: hariharan97 <rh20085046@wipro.com>
Change-Id: Ic431c58c96a517fd939f337f3352f28ae4e5e8c3

scripts/optf-has/has/has-properties/conductor.conf.onap
scripts/optf-has/has/has_script.sh
scripts/optf-has/has/simulator_script.sh
scripts/optf-has/has/simulator_teardown_script.sh
tests/optf-has/has/data/nsi_selection_template_with_create.json
tests/optf-has/has/data/nsi_selection_template_with_nonsi.json
tests/optf-has/has/data/nsi_selection_template_with_reuse.json
tests/optf-has/has/data/nssi_selection_template.json
tests/optf-has/has/data/nssi_selection_template_unmatched.json
tests/optf-has/has/data/nst_selection_template.json [new file with mode: 0644]
tests/optf-has/has/optf_has_test.robot

index 3ce7fa0..b8b0a0a 100644 (file)
@@ -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"
+
index 3b24d47..b845dda 100755 (executable)
@@ -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}"
 
index c52535c..a3e4faa 100755 (executable)
@@ -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/
index eb29445..14b3886 100755 (executable)
@@ -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
index 6d659f9..acf53ff 100644 (file)
                                 "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": {
                             }
                         },
                         "ran": {
-                            "coverage_area_ta_list": {
-                                "values": [
-                                    {
-                                        "get_param": "coverage_area_ta_list"
-                                    }
-                                ]
-                            },
                             "latency": {
                                 "max": {
                                     "get_param": "latency"
         "parameters": {
             "core_latency": 10,
             "core_reliability": 99.9,
-            "coverage_area_ta_list": "Chennai",
             "latency": 30,
             "ran_latency": 7,
             "ran_reliability": 99.9,
index 1b5b99e..b4e625a 100644 (file)
                                 "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": {
                             }
                         },
                         "ran": {
-                            "coverage_area_ta_list": {
-                                "values": [
-                                    {
-                                        "get_param": "coverage_area_ta_list"
-                                    }
-                                ]
-                            },
                             "latency": {
                                 "max": {
                                     "get_param": "latency"
         "parameters": {
             "core_latency": 10,
             "core_reliability": 99.9,
-            "coverage_area_ta_list": "Chennai",
             "latency": 30,
             "ran_latency": 7,
             "ran_reliability": 99.9,
index ff66b2d..3cce5f9 100644 (file)
                                 "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": {
                             }
                         },
                         "ran": {
-                            "coverage_area_ta_list": {
-                                "values": [
-                                    {
-                                        "get_param": "coverage_area_ta_list"
-                                    }
-                                ]
-                            },
+          
                             "latency": {
                                 "max": {
                                     "get_param": "latency"
         "parameters": {
             "core_latency": 10,
             "core_reliability": 99.9,
-            "coverage_area_ta_list": "Chennai",
             "latency": 30,
             "ran_latency": 7,
             "ran_reliability": 99.9,
index a498ca0..e165694 100644 (file)
@@ -7,7 +7,6 @@
    "template": {
       "homing_template_version": "2020-08-13",
       "parameters": {
-         "coverage_area_ta_list": "Chennai",
          "latency": 30,
          "reliability": 99.9
       },
                         "get_param": "reliability"
                      },
                      "unit": ""
-                  },
-                  {
-                     "attribute": "coverage_area_ta_list",
-                     "operator": "eq",
-                     "threshold": {
-                        "get_param": "coverage_area_ta_list"
-                     },
-                     "unit": ""
                   }
                ]
             },
index 4930280..23500c5 100644 (file)
@@ -7,7 +7,6 @@
    "template": {
       "homing_template_version": "2020-08-13",
       "parameters": {
-         "coverage_area_ta_list": "Chennai",
          "latency": 5,
          "reliability": 99.9
       },
                         "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 (file)
index 0000000..4181914
--- /dev/null
@@ -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
index 9185fce..6085bce 100644 (file)
@@ -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 ***