Add optf-has healthcheck and other test cases

Issue-ID: OPTFRA-204

Change-Id: I847a8ea755190be05537c2f6dd332bc21ddd3728
Signed-off-by: Leonardo Bellini <leonardo.bellini@att.com>
diff --git a/test/csit/tests/optf-has/has/data/healthcheck.json b/test/csit/tests/optf-has/has/data/healthcheck.json
new file mode 100644
index 0000000..926bb28
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/healthcheck.json
@@ -0,0 +1,19 @@
+{
+    "consistencyInfo": {
+        "type": "eventual"
+    },
+    "values": {
+        "created": 1479482603641,
+        "message": "",
+        "name": "foo",
+        "recommend_max": 1,
+        "solution": "{\"healthcheck\": \" healthcheck\"}",
+        "status": "solved",
+        "template": "{\"healthcheck\": \"healthcheck\"}",
+        "timeout": 3600,
+        "translation": "{\"healthcheck\": \" healthcheck\"}",
+        "updated": 1484324150629
+    }
+}
+
+
diff --git a/test/csit/tests/optf-has/has/data/onboard.json b/test/csit/tests/optf-has/has/data/onboard.json
new file mode 100644
index 0000000..a4939c4
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/onboard.json
@@ -0,0 +1,6 @@
+{ 
+   "appname": "conductor", 
+   "userId": "conductor", 
+   "isAAF": "false", 
+   "password": "c0nduct0r" 
+}
diff --git a/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json
new file mode 100644
index 0000000..5e35d6a
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json
@@ -0,0 +1,41 @@
+{
+   "name":"onap template with lati and longi without constraints and without optimizations",
+   "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":{
+
+      },
+      "optimization":{
+
+      }
+   }
+}
+
diff --git a/test/csit/tests/optf-has/has/optf_has_test.robot b/test/csit/tests/optf-has/has/optf_has_test.robot
index 4882c22..08a3210 100644
--- a/test/csit/tests/optf-has/has/optf_has_test.robot
+++ b/test/csit/tests/optf-has/has/optf_has_test.robot
@@ -11,6 +11,8 @@
 
 #global variables
 ${generatedPlanId}
+${generatedAID}
+${resultStatus}
 
 *** Test Cases ***
 Check Cassandra Docker Container
@@ -114,6 +116,62 @@
     Log To Console              body = ${resp.text}
     Should Be Equal As Integers    ${resp.status_code}    200
 
+Conductor AddHealthcheck Row Into Music
+    [Documentation]    It sends a REST PUT request to Music to inject healthcheck plan
+    Create Session   musicaas            ${MUSIC_HOSTNAME}:${MUSIC_PORT}
+    ${data}=         Get Binary File     ${CURDIR}${/}data${/}healthcheck.json
+    &{headers}=      Create Dictionary    ns=conductor    userId=conductor    password=c0nduct0r   Content-Type=application/json  Accept=application/json
+    ${resp}=         Put Request        musicaas   /MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows?id=healthcheck    data=${data}    headers=${headers}
+    Log To Console              *********************
+    Log To Console              response = ${resp}
+    Log To Console              body = ${resp.text}
+    ${response_json}    json.loads    ${resp.content}
+    Should Be Equal As Integers    ${resp.status_code}    200
+    Sleep    5s    Wait Injection effectiveness
+
+Healthcheck
+    [Documentation]    It sends a REST GET request to healthcheck url
+    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/healthcheck     headers=${headers}
+    Log To Console              *********************
+    Log To Console              response = ${resp}
+    Log To Console              body = ${resp.text}
+    Should Be Equal As Integers    ${resp.status_code}    200
+
+
+SendPlanWithLatiAndLongi
+    [Documentation]    It sends a POST GET 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
+    ${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
+
+GetPlanWithLatiAndLongi
+    [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    done    ${resultStatus}
+
+
 
 *** Keywords ***