Complete optf-has csit for M4 71/39171/1
authorLeonardo Bellini <leonardo.bellini@att.com>
Tue, 27 Mar 2018 16:52:58 +0000 (11:52 -0500)
committerLeonardo Bellini <leonardo.bellini@att.com>
Tue, 27 Mar 2018 16:53:17 +0000 (11:53 -0500)
Issue-ID: OPTFRA-204

Change-Id: I09afb088c343699be78d2195638596ac09a0c875
Signed-off-by: Leonardo Bellini <leonardo.bellini@att.com>
test/csit/scripts/optf-has/has/music_script.sh
test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json [deleted file]
test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service [deleted file]
test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json
test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json [moved from test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig with 73% similarity]
test/csit/tests/optf-has/has/optf_has_test.robot

index fb43e1b..39cab61 100755 (executable)
@@ -55,7 +55,7 @@ docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG};
 docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG};
 
 # Delay for Cassandra
-sleep 20;
+sleep 30;
 
 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
 docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG};
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
deleted file mode 100644 (file)
index 3e6d267..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-{
-   "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.service b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service
deleted file mode 100644 (file)
index b0d6478..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-{
-   "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":{
-
-      }
-   }
-}
index 85a1a73..68a7e11 100644 (file)
@@ -5,8 +5,8 @@
       "parameters":{
          "service_name":"Residential vCPE",
          "service_id":"vcpe_service_id",
-         "customer_lat":45.395968,
-         "customer_long":-71.135344,
+         "customer_lat":25.395968,
+         "customer_long":-51.135344,
          "physical_location":"DLLSTX233",
          "REQUIRED_MEM":4,
          "REQUIRED_DISK":100,
          }
       },
       "optimization":{
-
+    "minimize": {
+      "sum": [
+        {
+          "distance_between": [
+            "customer_loc",
+            "vG"
+          ]
+        },
+        {
+          "distance_between": [
+            "customer_loc",
+            "vG"
+          ]
+        }
+      ]
+    }
       }
    }
 }
@@ -1,5 +1,5 @@
 {
-   "name":"onap template with long distance constraint",
+   "name":"onap template with wrong distance constraint",
    "template":{
       "homing_template_version":"2017-10-10",
       "parameters":{
       },
       "constraints":{
          "distance-vg":{
-            "type":"distance_to_location",
             "demands":[
                "vG"
             ],
             "properties":{
-               "distance":"> 100 km",
+               "distance":"< 1 km",
                "location":"customer_loc"
             }
          }
       },
       "optimization":{
-
+    "minimize": {
+      "sum": [
+        {
+          "distance_between": [
+            "customer_loc",
+            "vG"
+          ]
+        },
+        {
+          "distance_between": [
+            "customer_loc",
+            "vG"
+          ]
+        }
+      ]
+    }
       }
    }
 }
index d6de276..62db107 100644 (file)
@@ -170,8 +170,6 @@ GetPlanWithWrongVersion
     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}
@@ -203,6 +201,37 @@ GetPlanWithoutDemandSection
     Should Be Equal As Integers    ${resp.status_code}    200
     Should Be Equal    error    ${resultStatus}
 
+SendPlanWithWrongConstraint
+    [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_distance_constraint.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
+
+GetPlanWithWrongConstraint
+    [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 request to conductor
@@ -235,6 +264,38 @@ GetPlanWithLatiAndLongi
     Should Be Equal As Integers    ${resp.status_code}    200
     Should Be Equal    done    ${resultStatus}
 
+SendPlanWithShortDistanceConstraint
+    [Documentation]    It sends a POST request to conductor
+    Create Session   optf-cond            ${COND_HOSTNAME}:${COND_PORT}
+    ${data}=         Get Binary File     ${CURDIR}${/}data${/}plan_with_short_distance_constraint.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    60s    Wait Plan Resolution
+
+GetPlanWithShortDistanceConstraint
+    [Documentation]    It sends a REST GET request to capture recommendations
+    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    not found    ${resultStatus}
+
+
 
 *** Keywords ***