Tests for Zero Touch
Change-Id: Ie2ba9c47c37ce5a62be95198f75b8b8687ea771d
diff --git a/src/test/cord-api/Properties/RestApiProperties.py b/src/test/cord-api/Properties/RestApiProperties.py
index 757b5b2..24c5802 100644
--- a/src/test/cord-api/Properties/RestApiProperties.py
+++ b/src/test/cord-api/Properties/RestApiProperties.py
@@ -65,3 +65,5 @@
FABRIC_SWITCH = '/xosapi/v1/fabric/switches'
SWITCH_PORT = '/xosapi/v1/fabric/switchports'
PORT_INTERFACE = '/xosapi/v1/fabric/portinterfaces'
+OSS_SERVICE = '/xosapi/v1/hippie-oss/hippieossservices'
+OSS_VOLT = '/xosapi/v1/core/servicedependencys'
diff --git a/src/test/cord-api/Tests/HippieOSS.txt b/src/test/cord-api/Tests/HippieOSS.txt
new file mode 100644
index 0000000..9de05be
--- /dev/null
+++ b/src/test/cord-api/Tests/HippieOSS.txt
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation Test for configuring HippieOSS for ZeroTouch test
+Suite Setup Read InputFile
+Test Template Configuring Hippie OSS Service
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE} ${CURDIR}/data/hippieOSS.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Create HippieOSS-1
+ CREATE 0
+Test Get HippieOSS-1
+ RETRIEVE 0
+
+*** Keywords ***
+Read InputFile
+ ${hippieList}= utils.jsonToList ${PATHFILE} hippieOSSInfo
+ Set Suite Variable ${slist} ${hippieList}
+ Set Global Variable ${hippieOSS_Id} ${EMPTY}
+
+Configuring Hippie OSS Service
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Post Hippie OSS ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Get Hippie OSS ${listIndex}
+
+Post Hippie OSS
+ [Arguments] ${listIndex}
+ ${hippieList} = Get Variable Value ${slist}
+ ${hippieOSSDict}= utils.listToDict ${hippieList} ${listIndex}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson OSS_SERVICE ${hippieOSSDict}
+ Should Be True ${api_result_status}
+ ${hippieOSS_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${hippieOSS_Id}
+
+Get Hippie OSS
+ [Arguments] ${listIndex}
+ Log ${hippieOSS_Id}
+ ${json_result}= restApi.ApiChameleonGet OSS_SERVICE ${hippieOSS_Id}
+ Log ${json_result}
+ ${hippieList} = Get Variable Value ${slist}
+ ${hippieOSSDict}= utils.listToDict ${hippieList} ${listIndex}
+ Log ${hippieOSSDict}
+ ${test_result}= utils.compare_dict ${hippieOSSDict} ${json_result}
+ Should Be True ${test_result}
diff --git a/src/test/cord-api/Tests/OSSVolt.txt b/src/test/cord-api/Tests/OSSVolt.txt
new file mode 100644
index 0000000..2282d99
--- /dev/null
+++ b/src/test/cord-api/Tests/OSSVolt.txt
@@ -0,0 +1,64 @@
+*** Settings ***
+Documentation Test for configuring OSS VOLT for Zero Touch
+Suite Setup Read InputFile
+Test Template Configuring OSS Volt
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE} ${CURDIR}/data/ossVolt.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Create VOLTDevice-1
+ CREATE 0
+Test Get VOLTDevice-1
+ RETRIEVE 0
+
+*** Keywords ***
+Read InputFile
+ ${ossVoltList}= utils.jsonToList ${PATHFILE} ossVoltInfo
+ Set Suite Variable ${dlist} ${ossVoltList}
+ Set Global Variable ${VOLTDevice_Id} ${EMPTY}
+ Set Global Variable ${hippieOSS_Id} ${EMPTY}
+
+Configuring OSS Volt
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Test Post OSS Volt ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Test Get OSS Volt ${listIndex}
+
+Test Post OSS Volt
+ [Arguments] ${listIndex}
+ ${ossVoltList} = Get Variable Value ${dlist}
+ ${ossVoltDict}= utils.listToDict ${ossvoltList} ${listIndex}
+ ${api_getResult}= restApi.ApiGet VOLT_SERVICE
+ ${voltServiceList}= Get From Dictionary ${api_getResult} items
+ ${voltServiceDict}= utils.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService
+ ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id
+ ${ossVoltDict}= utils.setFieldValueInDict ${ossVoltDict} provider_service_id ${VOLTService_Id}
+ Log ${ossVoltDict}
+ ${api_getResult}= restApi.ApiGet OSS_SERVICE
+ ${ServiceList}= Get From Dictionary ${api_getResult} items
+ ${ServiceDict}= utils.getDictFromListOfDict ${ServiceList} self_content_type_id hippie-oss.hippieossservice
+ ${hippieOSS_Id}= Get From Dictionary ${ServiceDict} id
+ ${ossVoltDict}= utils.setFieldValueInDict ${ossVoltDict} subscriber_service_id ${hippieOSS_Id}
+ Log ${ossVoltDict}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson OSS_VOLT ${ossVoltDict}
+ Should Be True ${api_result_status}
+ ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${VOLTDevice_Id}
+
+Test Get OSS Volt
+ [Arguments] ${listIndex}
+ Log ${VOLTDevice_Id}
+ ${json_result}= restApi.ApiChameleonGet OSS_VOLT ${VOLTDevice_Id}
+ Log ${json_result}
+ ${voltDeviceList} = Get Variable Value ${dlist}
+ ${voltDeviceDict}= utils.listToDict ${voltDeviceList} ${listIndex}
+ Log ${voltDeviceDict}
+ ${test_result}= utils.compare_dict ${voltDeviceDict} ${json_result}
+ Should Be True ${test_result}
diff --git a/src/test/cord-api/Tests/data/hippieOSS.json b/src/test/cord-api/Tests/data/hippieOSS.json
new file mode 100644
index 0000000..4d135dd
--- /dev/null
+++ b/src/test/cord-api/Tests/data/hippieOSS.json
@@ -0,0 +1,8 @@
+{
+ "hippieOSSInfo" : [
+ {
+ "name": "hippie-oss",
+ "kind": "oss"
+ }
+ ]
+}
diff --git a/src/test/cord-api/Tests/data/ossVolt.json b/src/test/cord-api/Tests/data/ossVolt.json
new file mode 100644
index 0000000..ee076d2
--- /dev/null
+++ b/src/test/cord-api/Tests/data/ossVolt.json
@@ -0,0 +1,9 @@
+{
+ "ossVoltInfo" : [
+ {
+ "connect_method": "None",
+ "subscriber_service_id": 8,
+ "provider_service_id": 2
+ }
+ ]
+}