new tests for hippieserviceinstances

Change-Id: I250726ab2254182ba77be23160f7e5d2c57b814a
diff --git a/Jenkinsfile-rcordlite-zerotouch b/Jenkinsfile-rcordlite-zerotouch
index 0e2d3b1..8409db5 100644
--- a/Jenkinsfile-rcordlite-zerotouch
+++ b/Jenkinsfile-rcordlite-zerotouch
@@ -47,6 +47,7 @@
                     helm ls | grep xos-core && helm delete --purge xos-core || true
                     helm ls | grep cord-kafka && helm delete --purge cord-kafka || true
                     helm ls | grep voltha-kafka && helm delete --purge voltha-kafka || true
+                    helm ls | grep hippie && helm delete --purge hippie-oss || true
                     """
                 } catch(error) { currentBuild.result = 'FAILURE' }
                 // Wait for helm delete
@@ -191,12 +192,24 @@
                     rm -rf Log/ || true
                     pybot -d Log -T FabricConfig.txt || true
                     pybot -d Log -T HippieOSS.txt || true
+                    sleep 5
                     pybot -d Log -T OSSVolt.txt || true
                     pybot -d Log -T RealOLT_Test.txt || true
                     """
                 } catch(error) { currentBuild.result = 'FAILURE' }
             }
         }
+        stage('Subscriber Validation and Ping Tests') {
+             timeout(10) {
+                try {
+                    sh """
+                    export KUBECONFIG=/home/cord/${deployment_config.pod_config}
+                    cd /home/cord/cord-tester/src/test/cord-api/Tests/
+                    pybot -d Log -T HippieOSS_instances.txt
+                    pybot -d Log -T -v src_ip:${deployment_config.srcHost.ip} -v src_user:${deployment_config.srcHost.user} -v src_pass:${deployment_config.srcHost.pass} -v dst_ip:${deployment_config.dstHost.ip} Subscriber_StatusChecks.txt
+                } catch(error) { currentBuild.result = 'FAILURE' }
+            }
+        }
         stage('Publish') {
             try {
                 sh """
diff --git a/src/test/cord-api/Properties/RestApiProperties.py b/src/test/cord-api/Properties/RestApiProperties.py
index 24c5802..b318314 100644
--- a/src/test/cord-api/Properties/RestApiProperties.py
+++ b/src/test/cord-api/Properties/RestApiProperties.py
@@ -66,4 +66,5 @@
 SWITCH_PORT = '/xosapi/v1/fabric/switchports'
 PORT_INTERFACE = '/xosapi/v1/fabric/portinterfaces'
 OSS_SERVICE = '/xosapi/v1/hippie-oss/hippieossservices'
+OSS_SERVICEINSTANCE = '/xosapi/v1/hippie-oss/hippieossserviceinstances'
 OSS_VOLT = '/xosapi/v1/core/servicedependencys'
diff --git a/src/test/cord-api/Tests/HippieOSS_instances.txt b/src/test/cord-api/Tests/HippieOSS_instances.txt
new file mode 100644
index 0000000..8bba0fb
--- /dev/null
+++ b/src/test/cord-api/Tests/HippieOSS_instances.txt
@@ -0,0 +1,52 @@
+*** Settings ***
+Documentation     Test suite for saving objects in HippieOSS service objects after discovery
+Suite Setup       Read InputFile
+Test Template     HippieOSS Save Test
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+Library           ../Framework/utils/utils.py
+Library           ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE}       ${CURDIR}/data/Subscriber_TopDown.json
+&{input_dict}    serial_number=test    of_dpid=test2
+
+*** Test Cases ***    TYPE                         LISTINDEX
+Hippie OSS for Subscriber-1
+                      STATUS                       0
+
+*** Keywords ***
+Read InputFile
+    ${SubscriberList}=    utils.jsonToList    ${PATHFILE}   SubscriberInfo 
+    Set Suite Variable    ${slist}    ${SubscriberList}
+    Set Global Variable    ${HippieOSS_Id}    ${EMPTY}
+
+HippieOSS Save Test
+    [Arguments]    ${type}    ${listIndex}
+    Run Keyword If    "${type}" == "STATUS"    HippieOSS Retrieve    ${listIndex}
+
+HippieOSS Retrieve
+    [Arguments]    ${listIndex}
+    Set Global Variable    ${HippieOSS_Id}    ${EMPTY}
+    Log    ${HippieOSS_Id}
+    ${json_result}=    restApi.ApiGet    OSS_SERVICEINSTANCE 
+    Log    ${json_result}
+    ${SubscriberList} =    Get Variable Value    ${slist}
+    ${SubscriberDict}=    utils.listToDict    ${SubscriberList}    ${listIndex}
+    Log    ${SubscriberDict}
+    ${onu_device}=    utils.getFieldValueFromDict    ${subscriberDict}   onu_device
+    ${json_result_list}=    Get From dictionary    ${json_result}    items
+    ${getJsonDict}=    utils.getDictFromListOfDict    ${json_result_list}    serial_number    ${onu_device}
+    ${serial_number}=	Get From Dictionary    ${getJsonDict}    serial_number 
+    ${of_dpid}=	Get From Dictionary    ${getJsonDict}    of_dpid 
+    ${HippieOSS_Id}=    Get From Dictionary    ${getJsonDict}   id
+    Set Global Variable    ${HippieOSS_Id}
+    # Create Dictionary
+    ${input_dict}=    Create Dictionary    serial_number=${serial_number}     of_dpid=${of_dpid}
+    # Re POST the same data to HippieOSS Service Instances
+    ${result}=    restApi.ApiPost    OSS_SERVICEINSTANCE    ${input_dict}
+    Should Be True    ${result}
+