complete test cases for M4 39/39039/1
authorLeonardo Bellini <leonardo.bellini@att.com>
Tue, 27 Mar 2018 10:42:06 +0000 (05:42 -0500)
committerLeonardo Bellini <leonardo.bellini@att.com>
Tue, 27 Mar 2018 10:46:02 +0000 (05:46 -0500)
Issue-ID: OPTFRA-204

Change-Id: I0010ecae5f64fbe0b3c0be5cb9ebc52d9a426254
Signed-off-by: Leonardo Bellini <leonardo.bellini@att.com>
test/csit/scripts/optf-has/has/has_script.sh
test/csit/scripts/optf-has/has/has_teardown_script.sh
test/csit/scripts/optf-has/has/music_script.sh
test/csit/scripts/optf-has/has/music_teardown_script.sh
test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json [new file with mode: 0644]
test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig [new file with mode: 0644]
test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service [new file with mode: 0644]
test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json [new file with mode: 0644]
test/csit/tests/optf-has/has/data/plan_with_wrong_version.json
test/csit/tests/optf-has/has/data/plan_without_demand_section.json
test/csit/tests/optf-has/has/optf_has_test.robot

index a5bf9f9..7d207f0 100755 (executable)
@@ -50,12 +50,12 @@ echo "MUSIC_IP=${MUSIC_IP}"
 # change MUSIC reference to the local instance
 sed  -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/properties/conductor.conf
 
-AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim`
-echo "AAISIM_IP=${AAISIM_IP}"
-
 #onboard conductor into music
 curl -vvvvv --noproxy "*" --request POST http://${MUSIC_IP}:8080/MUSIC/rest/v2/admin/onboardAppWithMusic -H "Content-Type: application/json" --data @${WORKSPACE}/test/csit/tests/optf-has/has/data/onboard.json
 
+AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim`
+echo "AAISIM_IP=${AAISIM_IP}"
+
 # change MUSIC reference to the local instance
 sed  -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf
 
@@ -80,6 +80,6 @@ docker inspect cond-api
 docker inspect cond-solv
 docker inspect cond-resv
 
-docker exec -it music-db /usr/bin/nodetool status
-docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
-docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
+docker exec music-db /usr/bin/nodetool status
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
index dcf4164..bef28b4 100755 (executable)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-#echo "print meaningful data before scratching everything"
-#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
-#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
-#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM conductor.plans'
+echo "print meaningful data before scratching everything"
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
+docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM conductor.plans'
 
 echo "optf/has scripts docker containers killing";
 docker stop cond-api
index be4eb8c..fb43e1b 100755 (executable)
@@ -80,6 +80,8 @@ echo "TOMCAT_IP=${TOMCAT_IP}"
 
 ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${TOMCAT_IP} 8080
 
+# wait a while to make sure music is totally up and configured
+sleep 10
 
 echo "inspect docker things for tracing purpose"
 docker inspect music-db
@@ -94,4 +96,3 @@ docker network inspect music-net
 
 
 
-
index fa91f6e..605ebd4 100755 (executable)
@@ -34,6 +34,6 @@ echo "dump music.log files"
 ls -alF /tmp/music
 ls -alF /tmp/music/properties
 cat /tmp/music/properties/music.properties
-cat /tmp/music/logs/MUSIC/music.log
+#cat /tmp/music/logs/MUSIC/music.log
 cat /tmp/music/logs/MUSIC/error.log
 
diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json
new file mode 100644 (file)
index 0000000..3e6d267
--- /dev/null
@@ -0,0 +1,49 @@
+{
+   "name":"onap template with short distance constraint",
+   "template":{
+      "homing_template_version":"2017-10-10",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":25.395968,
+         "customer_long":-51.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
+      },
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
+            }
+         }
+      },
+      "demands":{
+         "vG":[
+            {
+               "inventory_provider":"aai",
+               "inventory_type":"cloud"
+            }
+         ]
+      },
+      "constraints":{
+         "distance-vg":{
+            "type":"distance_to_location",
+            "demands":[
+               "vG"
+            ],
+            "properties":{
+               "distance":"< 1 km",
+               "location":"customer_loc"
+            }
+         }
+      },
+      "optimization":{
+
+      }
+   }
+}
diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig
new file mode 100644 (file)
index 0000000..be41008
--- /dev/null
@@ -0,0 +1,49 @@
+{
+   "name":"onap template with long distance constraint",
+   "template":{
+      "homing_template_version":"2017-10-10",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":45.395968,
+         "customer_long":-71.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
+      },
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
+            }
+         }
+      },
+      "demands":{
+         "vG":[
+            {
+               "inventory_provider":"aai",
+               "inventory_type":"cloud"
+            }
+         ]
+      },
+      "constraints":{
+         "distance-vg":{
+            "type":"distance_to_location",
+            "demands":[
+               "vG"
+            ],
+            "properties":{
+               "distance":"> 100 km",
+               "location":"customer_loc"
+            }
+         }
+      },
+      "optimization":{
+
+      }
+   }
+}
diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service
new file mode 100644 (file)
index 0000000..b0d6478
--- /dev/null
@@ -0,0 +1,51 @@
+{
+   "name":"onap template with long distance constraint",
+   "template":{
+      "homing_template_version":"2017-10-10",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":45.395968,
+         "customer_long":-71.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
+      },
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
+            }
+         }
+      },
+      "demands":{
+         "vG":[
+            {
+               "inventory_provider":"aai",
+               "inventory_type":"service",
+               "service_type": "VVIG", 
+               "customer_id": "21014aa2-526b-11e6-beb8-9e71128cae77"
+            }
+         ]
+      },
+      "constraints":{
+         "distance-vg":{
+            "type":"distance_to_location",
+            "demands":[
+               "vG"
+            ],
+            "properties":{
+               "distance":"> 100 km",
+               "location":"customer_loc"
+            }
+         }
+      },
+      "optimization":{
+
+      }
+   }
+}
diff --git a/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json
new file mode 100644 (file)
index 0000000..85a1a73
--- /dev/null
@@ -0,0 +1,49 @@
+{
+   "name":"onap template with short distance constraint",
+   "template":{
+      "homing_template_version":"2017-10-10",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":45.395968,
+         "customer_long":-71.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
+      },
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
+            }
+         }
+      },
+      "demands":{
+         "vG":[
+            {
+               "inventory_provider":"aai",
+               "inventory_type":"cloud"
+            }
+         ]
+      },
+      "constraints":{
+         "distance-vg":{
+            "type":"distance_to_location",
+            "demands":[
+               "vG"
+            ],
+            "properties":{
+               "distance":"< 1 km",
+               "location":"customer_loc"
+            }
+         }
+      },
+      "optimization":{
+
+      }
+   }
+}
index 9471fbf..c0618bf 100644 (file)
 {
-  "name": "onap optf has plan with wrong version",
-  "template": {
-  "conductor_template_version": "yyyy-mm-dd",
-  "parameters": {
-    "UCPEHOST": "chcil129snd",
-    "CUSTOMER":"21014aa2-526b-11e6-beb8-9e71128cae77"
-  },
-  "locations": {
-    "customer_loc": {
-      "host_name": {
-        "get_param": "UCPEHOST"
-      }
-    }
-  },
-  "demands": {
-    "vHNPortalaaS_PRIMARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "HNPORTAL",
-        "customer_id": {"get_param": "CUSTOMER"}
+   "name":"onap template with wrong version",
+   "template":{
+      "homing_template_version":"xxxx-yy-zz",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":45.395968,
+         "customer_long":-71.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
       },
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "cloud"
-      }
-    ],
-    "vHNPortalaaS_SECONDARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "HNPORTAL",
-        "customer_id": {"get_param": "CUSTOMER"}
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
+            }
+         }
       },
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "cloud"
-      }
-    ],
-    "vHNGWaaS_PRIMARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "HNGATEWAY",
-        "customer_id": {"get_param": "CUSTOMER"}
+      "demands":{
+         "vG":[
+            {
+               "inventory_provider":"aai",
+               "inventory_type":"cloud"
+            }
+         ]
       },
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "cloud"
-      }
-    ],
-    "vHNGWaaS_SECONDARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "HNGATEWAY",
-        "customer_id": {"get_param": "CUSTOMER"}
+      "constraints":{
+
       },
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "cloud"
-      }
-    ],
-    "vVIGaaS_PRIMARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "VVIG",
-        "customer_id": {"get_param": "CUSTOMER"}
-      }
-    ],
-    "vVIGaaS_SECONDARY_1": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "VVIG",
-        "customer_id": {"get_param": "CUSTOMER"}
-      }
-    ],
-    "vVIGaaS_PRIMARY_2": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "VVIG",
-        "customer_id": {"get_param": "CUSTOMER"}
+      "optimization":{
+
       }
-    ],
-    "vVIGaaS_SECONDARY_2": [
-      {
-        "inventory_provider": "aai",
-        "inventory_type": "service",
-        "service_type": "VVIG",
-        "customer_id": {"get_param": "CUSTOMER"}
-      }
-    ]
-  },
-  "constraints": {
-    "distance-vvig": {
-      "type": "distance_to_location",
-      "demands": [
-        "vVIGaaS_SECONDARY_1",
-        "vVIGaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "distance": "< 5000 km",
-        "location": "customer_loc"
-      }
-    },
-    "distance-vgw": {
-      "type": "distance_to_location",
-      "demands": [
-        "vHNGWaaS_SECONDARY_1",
-        "vHNGWaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "distance": "< 5000 km",
-        "location": "customer_loc"
-      }
-    },
-    "zone-vhngw": {
-      "type": "zone",
-      "demands": [
-        "vHNGWaaS_SECONDARY_1",
-        "vHNGWaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "qualifier": "different",
-        "category": "complex"
-      }
-    },
-    "zone-vhnportal": {
-      "type": "zone",
-      "demands": [
-        "vHNPortalaaS_SECONDARY_1",
-        "vHNPortalaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "qualifier": "different",
-        "category": "complex"
-      }
-    }
-  },
-  "optimization": {
-    "minimize": {
-      "sum": [
-        {
-          "product": [
-            1,
-            {
-              "distance_between": [
-                "customer_loc",
-                "vVIGaaS_PRIMARY_1"
-              ]
-            }
-          ]
-        },
-        {
-          "product": [
-            1,
-            {
-              "distance_between": [
-                "customer_loc",
-                "vHNGWaaS_PRIMARY_1"
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  }
-},
-  "timeout": 5,
-  "limit": 3
+   }
 }
+
index 87a459d..fe5d2fa 100644 (file)
@@ -1,93 +1,33 @@
 {
-  "name": "onap optf has plan with wrong version",
-  "template": {
-  "conductor_template_version": "2016-11-01",
-  "parameters": {
-    "UCPEHOST": "chcil129snd",
-    "CUSTOMER":"21014aa2-526b-11e6-beb8-9e71128cae77"
-  },
-  "locations": {
-    "customer_loc": {
-      "host_name": {
-        "get_param": "UCPEHOST"
-      }
-    }
-  },
-  "constraints": {
-    "distance-vvig": {
-      "type": "distance_to_location",
-      "demands": [
-        "vVIGaaS_SECONDARY_1",
-        "vVIGaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "distance": "< 5000 km",
-        "location": "customer_loc"
-      }
-    },
-    "distance-vgw": {
-      "type": "distance_to_location",
-      "demands": [
-        "vHNGWaaS_SECONDARY_1",
-        "vHNGWaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "distance": "< 5000 km",
-        "location": "customer_loc"
-      }
-    },
-    "zone-vhngw": {
-      "type": "zone",
-      "demands": [
-        "vHNGWaaS_SECONDARY_1",
-        "vHNGWaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "qualifier": "different",
-        "category": "complex"
-      }
-    },
-    "zone-vhnportal": {
-      "type": "zone",
-      "demands": [
-        "vHNPortalaaS_SECONDARY_1",
-        "vHNPortalaaS_PRIMARY_1"
-      ],
-      "properties": {
-        "qualifier": "different",
-        "category": "complex"
-      }
-    }
-  },
-  "optimization": {
-    "minimize": {
-      "sum": [
-        {
-          "product": [
-            1,
-            {
-              "distance_between": [
-                "customer_loc",
-                "vVIGaaS_PRIMARY_1"
-              ]
-            }
-          ]
-        },
-        {
-          "product": [
-            1,
-            {
-              "distance_between": [
-                "customer_loc",
-                "vHNGWaaS_PRIMARY_1"
-              ]
+   "name":"onap template without demand section",
+   "template":{
+      "homing_template_version":"2017-10-10",
+      "parameters":{
+         "service_name":"Residential vCPE",
+         "service_id":"vcpe_service_id",
+         "customer_lat":45.395968,
+         "customer_long":-71.135344,
+         "physical_location":"DLLSTX233",
+         "REQUIRED_MEM":4,
+         "REQUIRED_DISK":100,
+         "pnf_id":"some_pnf_id"
+      },
+      "locations":{
+         "customer_loc":{
+            "latitude":{
+               "get_param":"customer_lat"
+            },
+            "longitude":{
+               "get_param":"customer_long"
             }
-          ]
-        }
-      ]
-    }
-  }
-},
-  "timeout": 5,
-  "limit": 3
+         }
+      },
+      "constraints":{
+
+      },
+      "optimization":{
+
+      }
+   }
 }
+
index 08a3210..d6de276 100644 (file)
@@ -139,9 +139,73 @@ Healthcheck
     Log To Console              body = ${resp.text}
     Should Be Equal As Integers    ${resp.status_code}    200
 
+SendPlanWithWrongVersion
+    [Documentation]    It sends a POST request to conductor
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    ${data}=         Get Binary File     ${CURDIR}${/}data${/}plan_with_wrong_version.json
+    &{headers}=      Create Dictionary    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    10s    Wait Plan Resolution
+
+GetPlanWithWrongVersion
+    [Documentation]    It sends a REST GET request to capture error
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    &{headers}=      Create Dictionary    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']}
+    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    error    ${resultStatus}
+
+
+
+SendPlanWithoutDemandSection
+    [Documentation]    It sends a POST request to conductor
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    ${data}=         Get Binary File     ${CURDIR}${/}data${/}plan_without_demand_section.json
+    &{headers}=      Create Dictionary    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    10s    Wait Plan Resolution
+
+GetPlanWithoutDemandSection
+    [Documentation]    It sends a REST GET request to capture error
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    &{headers}=      Create Dictionary    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']}
+    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    error    ${resultStatus}
+
 
 SendPlanWithLatiAndLongi
-    [Documentation]    It sends a POST GET request to conductor
+    [Documentation]    It sends a POST request to conductor
     Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
     ${data}=         Get Binary File     ${CURDIR}${/}data${/}plan_with_lati_and_longi.json
     &{headers}=      Create Dictionary    Content-Type=application/json  Accept=application/json
@@ -172,7 +236,6 @@ GetPlanWithLatiAndLongi
     Should Be Equal    done    ${resultStatus}
 
 
-
 *** Keywords ***