Draft: Updated instance test
Change-Id: I6621c08a4a0af6958145056e84bd729b5a18aba6
diff --git a/src/test/cord-api/Framework/restApi.py b/src/test/cord-api/Framework/restApi.py
index c93f121..7eac08c 100644
--- a/src/test/cord-api/Framework/restApi.py
+++ b/src/test/cord-api/Framework/restApi.py
@@ -178,7 +178,7 @@
time.sleep(5)
result = test.ApiDelete(key, urlSuffix)
'''
-#'''
+'''
test = restApi()
#key = "UTILS_SYNCHRONIZER"
#key = "CORE_USERS"
@@ -188,22 +188,23 @@
#jsonResponse = test.ApiPost(key,{"identity":{"name":"My House 22"}})
#jsonResponse = test.ApiPost(key,{"firstname":"Test002","lastname":"User002","email":"test002@onlab.us","password":"TestUser002","site": "http://localhost:8000/api/core/sites/1/"})
key = "VOLT_TENANT"
-#key = "VOLT_SUBSCRIBER"
+key2 = "VOLT_SUBSCRIBER"
#jsonResponse = test.ApiDelete(key,204)
#jsonResponse = test.ApiPut(key,{"firstname":"Test002","lastname":"User002","email":"test002update@onlab.us","password":"TestUser002","site": "http://localhost:8000/api/core/sites/1/"},14)
#jsonResponse = test.ApiPost(key2,{"username":"test002update@onlab.us","password":"TestUser002"})
#jsonResponse = test.ApiPost(key2,{"username":"padmin@vicci.org","password":"letmein"})
#jsonResponse = test.ApiPut(key,{"username":"testuser","password":"TestUser001"},"9")
#key = "CORE_INSTANCES"
-#key1 = "CORE_SANITY_SLICES"
+key1 = "CH_CORE_SERVICELINK"
#key2 = "CORE_SLICES"
#input_dict = { "s_tag" : "111", "c_tag" : "222", "subscriber" : 23}
input_dict = {
"s_tag" : 117,
"c_tag" : 227,
- "subscriber_root_id" : "16"
}
-
+input_dict3 = {
+ "subscriber_service_instance_id" : 5
+ }
#input_dict1 = { "name" : "mysite_Test1", "site" : 1 , "creator" : 1}
input_dict2 = {
@@ -217,13 +218,16 @@
}
#jsonResponse = test.ApiPost(key,input_dict)
#jsonResponse = test.ApiChameleonPut(key,input_dict,12)
-jsonGetData = test.ApiGet(key)
+#jsonGetData = test.ApiGet(key1)
+#jsonResponse = test.ApiChameleonPut(key1,input_dict3,6)
+#jsonGetData = test.ApiGet(key1)
#print "========="
#print jsonGetData
#jsonEdit = test.ApiPut(key,{"c_tag" : "666","s_tag" : "123"},"30")
-#jsonO = test.ApiChameleonDelete(key,"56")
+jsonO = test.ApiChameleonDelete(key2,"50")
+jsonO = test.ApiChameleonDelete(key,"51")
#jsonResponse = test.ApiPut(key,{"identity":{"name":"My House 22"}},"71")
#jsonResponse = test.ApiPost(key,input_dict)
#jsonResponse = test.ApiPut(key,{"name":"test1-changed"},"9")
print "========="
-#'''
+'''
diff --git a/src/test/cord-api/Properties/RestApiProperties.py b/src/test/cord-api/Properties/RestApiProperties.py
index 2d44159..d252ea2 100644
--- a/src/test/cord-api/Properties/RestApiProperties.py
+++ b/src/test/cord-api/Properties/RestApiProperties.py
@@ -16,12 +16,15 @@
#!/usr/bin/env python
-SERVER_IP = 'localhost'
+SERVER_IP = 'ms0925.utah.cloudlab.us'
+#SERVER_IP = '10.201.101.11'
+#SERVER_PORT = '9101'
SERVER_PORT = '8080'
USER = 'xosadmin@opencord.org'
-PASSWD = 'GKHDWlgEgHB780HSbUSc'
+PASSWD = 'wfjaPUOSD0nZiWe3LN8M'
VOLT_SUBSCRIBER = '/xosapi/v1/rcord/cordsubscriberroots'
VOLT_TENANT = '/xosapi/v1/volt/volttenants'
+CH_CORE_SERVICELINK = '/xosapi/v1/core/serviceinstancelinks'
TENANT_SUBSCRIBER = '/api/tenant/cord/subscriber/'
TENANT_VOLT = '/api/tenant/cord/volt/'
UTILS_SYNCHRONIZER = '/api/utility/synchronizer/'
diff --git a/src/test/cord-api/Tests/Ch_MultiInstanceTest.txt b/src/test/cord-api/Tests/Ch_MultiInstanceTest.txt
index 29bf1d4..29be1cc 100644
--- a/src/test/cord-api/Tests/Ch_MultiInstanceTest.txt
+++ b/src/test/cord-api/Tests/Ch_MultiInstanceTest.txt
@@ -45,7 +45,9 @@
${voltList}= utils.jsonToList ${PATHFILE2} voltSubscriberInfo
Set Suite Variable ${vlist} ${voltList}
@{instanceList}= Create List
+ ${Subscriber_Id}= Set Variable
Set Suite Variable @{instanceList}
+ Set Suite Variable ${Subscriber_Id}
Verify Single Instance functionality
[Arguments] ${type} ${listIndex}
@@ -58,38 +60,61 @@
${subscriberList} = Get Variable Value ${slist}
${subscriberDict}= utils.listToDict ${subscriberList} ${listIndex}
${api_result}= restApi.ApiPost VOLT_SUBSCRIBER ${subscriberDict}
+ ${service_specific_id}= utils.getFieldValueFromDict ${subscriberDict} service_specific_id
+ ${json_result}= restApi.ApiGet VOLT_SUBSCRIBER
+ Log ${json_result}
+ ${json_result_list}= Get From Dictionary ${json_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} service_specific_id ${service_specific_id}
+ ${result}= utils.compare_dict ${subscriberDict} ${getJsonDict}
+ Should Be True ${result}
+ #${Subscriber_Id}= utils.getFieldValueFromDict ${getJsonDict} id
+ #Log ${Subscriber_Id}
${instanceList} Create List
Test Post volt Tenant Create
[Arguments] ${listIndex}
+ ${subscriberList} = Get Variable Value ${slist}
+ ${subscriberDict}= utils.listToDict ${subscriberList} ${listIndex}
+ ${service_specific_id}= utils.getFieldValueFromDict ${subscriberDict} service_specific_id
+ ${json_result}= restApi.ApiGet VOLT_SUBSCRIBER
+ Log ${json_result}
+ ${json_result_list}= Get From Dictionary ${json_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} service_specific_id ${service_specific_id}
+ ${Subscriber_Id}= utils.getFieldValueFromDict ${getJsonDict} id
+ Log ${Subscriber_Id}
${voltTenantList} = Get Variable Value ${vlist}
${voltTenantDict}= utils.listToDict ${voltTenantList} ${listIndex}
${voltDict}= Get From Dictionary ${voltTenantDict} voltTenant
- ${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id
- ${get_result}= restApi.ApiGet VOLT_SUBSCRIBER
+ ${c_tag}= Get From Dictionary ${voltDict} c_tag
+ ${postResult}= restApi.ApiPost VOLT_TENANT ${voltDict}
+ Sleep 10
+ # Verifying GET operation after POST
+ ${get_result}= restApi.ApiGet VOLT_TENANT
${get_result_list}= Get From Dictionary ${get_result} items
- ${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id}
- ${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id
- ${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID}
- ${api_result}= restApi.ApiPost VOLT_TENANT ${updatedVoltDict}
- Should Be True ${api_result}
- # Verifying Get operation after POST
- Sleep 20
- ${getVolt_result}= restApi.ApiGet VOLT_TENANT
- Log ${getVolt_result}
- ${getVolt_result_list}= utils.getFieldValueFromDict ${getVolt_result} items
- Log ${getVolt_result_list}
- ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID}
- Log ${getJsonDict}
+ ${getJsonDict}= utils.getDictFromListofDict ${get_result_list} c_tag ${c_tag}
${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
Should Be True ${test_result}
+ ${Volt_Id}= Get From Dictionary ${getJsonDict} id
+ ${subscribed_links_ids_list}= utils.getFieldValueFromDict ${getJsonDict} subscribed_links_ids
+ Log ${subscribed_links_ids_list}
+ ${subscribed_links_ids}= Get From List ${subscribed_links_ids_list} 0
+ Log ${subscribed_links_ids}
+ # Retrieve service links using provide links ID
+ ${getServiceLink}= restApi.ApiChameleonGet CH_CORE_SERVICELINK ${subscribed_links_ids}
+ ${provider_service_instance_id}= Get From Dictionary ${getServiceLink} provider_service_instance_id
+ # Update the subscriber_service_instance_id to the required subscriber_id to establish desired link
+ ${serviceDict}= Create Dictionary subscriber_service_instance_id=${Subscriber_Id}
+ ${result}= restApi.ApiChameleonPut CH_CORE_SERVICELINK ${serviceDict} ${subscribed_links_ids}
+ Sleep 10
+ Should Be True ${result}
# Validation of Instances
Log ${instanceList}
- Log ${getJsonDict}
- ${VSGTenantList}= Get From Dictionary ${getJsonDict} subscribed_tenants_ids
- Log ${VSGTenantList}
- ${VSGTenant}= Get From List ${VSGTenantList} 0
- ${getVSG_result}= restApi.ApiChameleonGet VSG_TENANT ${VSGTenant}
+ #Log ${getJsonDict}
+ #${VSGTenantList}= Get From Dictionary ${getJsonDict} subscribed_tenants_ids
+ #Log ${VSGTenantList}
+ #${VSGTenant}= Get From List ${VSGTenantList} 0
+ #${getVSG_result}= restApi.ApiChameleonGet VSG_TENANT ${VSGTenant}
+ ${getVSG_result}= restApi.ApiChameleonGet VSG_TENANT ${provider_service_instance_id}
${instance_id}= Get From Dictionary ${getVSG_result} instance_id
Append To List ${instanceList} ${instance_id}
Log ${instanceList}
diff --git a/src/test/cord-api/Tests/Ch_VoltTenant.txt b/src/test/cord-api/Tests/Ch_VoltTenant.txt
index 2165cc6..bf19af8 100644
--- a/src/test/cord-api/Tests/Ch_VoltTenant.txt
+++ b/src/test/cord-api/Tests/Ch_VoltTenant.txt
@@ -39,31 +39,40 @@
${voltTenantList} = Get Variable Value ${vlist}
${voltTenantDict}= utils.listToDict ${voltTenantList} ${listIndex}
${voltDict}= Get From Dictionary ${voltTenantDict} voltTenant
- ${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id
- ${get_result}= restApi.ApiGet VOLT_SUBSCRIBER
- ${get_result_list}= Get From Dictionary ${get_result} items
- ${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id}
- ${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id
- Log ${subscriberID}
-# ${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID}
-# ${api_result}= restApi.ApiPost VOLT_TENANT ${voltDict}
-# Should Be True ${api_result}
-# # Verifying Get operation after POST
-# ${getVolt_result}= restApi.ApiGet VOLT_TENANT
-# ${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
-# ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID}
-# ${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
-# Should Be True ${test_result}
-# # Verifying PUT operation
-# ${putvoltList}= Get Variable Value ${putList}
-# ${putVoltDict}= utils.listToDict ${putvoltList} ${listIndex}
-# ${putvoltTenantDict}= Get From Dictionary ${putVoltDict} voltTenant
-# ${voltID}= utils.getFieldValueFromDict ${getJsonDict} id
-# ${put_result}= restApi.ApiChameleonPut VOLT_TENANT ${putvoltTenantDict} ${voltID}
-# Should Be True ${put_result}
-# # Verifying Get after PUT operation
-# #${getVolt_afterPut}= restApi.ApiGet VOLT_TENANT
-# #${getVoltDict}= utils.getDictFromListofDict ${getVolt_afterPut} id ${voltID}
-# ${getVoltDict}= restApi.ApiChameleonGet VOLT_TENANT ${voltID}
-# ${result_afterPut}= utils.compare_dict ${putvoltTenantDict} ${getVoltDict}
-# Should Be True ${result_afterPut}
+ ${c_tag}= Get From Dictionary ${voltDict} c_tag
+ ${postResult}= restApi.ApiPost VOLT_TENANT ${voltDict}
+ # Verifying Get Operation after POST
+ ${getVolt_result}= restApi.ApiGet VOLT_TENANT
+ ${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
+ ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} c_tag ${c_tag}
+ ${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
+ Should Be True ${test_result}
+ # Retrieve provided_link_ids from tenantobject and associate with serviceinstancelinks to the core
+ #${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id
+ #${get_result}= restApi.ApiGet VOLT_SUBSCRIBER
+ #${get_result_list}= Get From Dictionary ${get_result} items
+ #${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id}
+ #${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id
+ #Log ${subscriberID}
+ #${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID}
+ #${api_result}= restApi.ApiPost VOLT_TENANT ${voltDict}
+ #Should Be True ${api_result}
+ # Verifying Get operation after POST
+ #${getVolt_result}= restApi.ApiGet VOLT_TENANT
+ #${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
+ #${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID}
+ #${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
+ #Should Be True ${test_result}
+ # # Verifying PUT operation
+ # ${putvoltList}= Get Variable Value ${putList}
+ # ${putVoltDict}= utils.listToDict ${putvoltList} ${listIndex}
+ # ${putvoltTenantDict}= Get From Dictionary ${putVoltDict} voltTenant
+ # ${voltID}= utils.getFieldValueFromDict ${getJsonDict} id
+ # ${put_result}= restApi.ApiChameleonPut VOLT_TENANT ${putvoltTenantDict} ${voltID}
+ # Should Be True ${put_result}
+ # # Verifying Get after PUT operation
+ # #${getVolt_afterPut}= restApi.ApiGet VOLT_TENANT
+ # #${getVoltDict}= utils.getDictFromListofDict ${getVolt_afterPut} id ${voltID}
+ # ${getVoltDict}= restApi.ApiChameleonGet VOLT_TENANT ${voltID}
+ # ${result_afterPut}= utils.compare_dict ${putvoltTenantDict} ${getVoltDict}
+ # Should Be True ${result_afterPut}
diff --git a/src/test/cord-api/Tests/data/Ch_MultiInstance_VoltTenant.json b/src/test/cord-api/Tests/data/Ch_MultiInstance_VoltTenant.json
index 8c3c51b..7f92d41 100644
--- a/src/test/cord-api/Tests/data/Ch_MultiInstance_VoltTenant.json
+++ b/src/test/cord-api/Tests/data/Ch_MultiInstance_VoltTenant.json
@@ -4,8 +4,7 @@
"voltTenant" :
{
"s_tag" : 115,
- "c_tag" : 222,
- "subscriber_root_id" : ""
+ "c_tag" : 222
},
"service_specific_id" : "304"
},
@@ -13,8 +12,7 @@
"voltTenant" :
{
"s_tag" : 116,
- "c_tag" : 333,
- "subscriber_root_id" : ""
+ "c_tag" : 333
},
"service_specific_id" : "305"
},
@@ -22,8 +20,7 @@
"voltTenant" :
{
"s_tag" : 117,
- "c_tag" : 444,
- "subscriber_root_id" : ""
+ "c_tag" : 444
},
"service_specific_id" : "306"
}