[CORD-2371]: M-CORD Sanity Test
Change-Id: I067e721f8ca88d07bd78a05b1c314c7355f0ca3e
diff --git a/src/test/cord-api/Framework/restApi.py b/src/test/cord-api/Framework/restApi.py
index a948d05..6e21535 100644
--- a/src/test/cord-api/Framework/restApi.py
+++ b/src/test/cord-api/Framework/restApi.py
@@ -24,8 +24,8 @@
'''
Functions for testing CORD API with POST, GET, PUT, DELETE method
'''
- def __init__(self):
- self.rp = readProperties(os.path.abspath(os.path.dirname(__file__))+"/../Properties/RestApiProperties.py")
+ def __init__(self, propertyFile="RestApiProperties.py"):
+ self.rp = readProperties(os.path.abspath(os.path.dirname(__file__))+"/../Properties/"+ propertyFile)
self.controllerIP = self.getValueFromProperties("SERVER_IP")
self.controllerPort = self.getValueFromProperties("SERVER_PORT")
self.user = self.getValueFromProperties("USER")
@@ -164,70 +164,7 @@
#test
'''
-if __name__ == '__main__':
- test = RestApi()
- key = "TENANT_SUBSCRIBER"
- account_num = 5
- result = test.ApiPost(key, {"identity":{"account_num":str(account_num)}})
- time.sleep(5)
- result = test.ApiGet(key)
- subId = test.getSubscriberIdFromAccountNum(result, account_num)
- urlSuffix = str(subId) + "/"
- time.sleep(5)
- result = test.ApiPut(key, {"identity":{"name":"My House 2"}}, urlSuffix)
- time.sleep(5)
- result = test.ApiDelete(key, urlSuffix)
-'''
-'''
-test = restApi()
-#key = "UTILS_SYNCHRONIZER"
-#key = "CORE_USERS"
-#key2 = "UTILS_LOGIN"
-#key = "TENANT_SUBSCRIBER"
-#jsonGetData = test.ApiGet(key)
-#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"
-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 = "CH_CORE_SERVICELINK"
-#key2 = "CORE_SLICES"
-#input_dict = { "s_tag" : "111", "c_tag" : "222", "subscriber" : 23}
-input_dict = {
- "s_tag" : 117,
- "c_tag" : 227,
- }
-input_dict3 = {
- "subscriber_service_instance_id" : 5
- }
-#input_dict1 = { "name" : "mysite_Test1", "site" : 1 , "creator" : 1}
-input_dict2 = {
+test = restApi("MCORD_RestApiProperties.py")
+print test.getURL("CORE_INSTANCES")
- "cdn_enable": "true",
- "uplink_speed": 1000000000,
- "downlink_speed": 1000000000,
- "enable_uverse": "true",
- "status": "enabled",
- "service_specific_id": "100",
- "name": "My House"
- }
-#jsonResponse = test.ApiPost(key,input_dict)
-#jsonResponse = test.ApiChameleonPut(key,input_dict,12)
-#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(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/MCORD-Tests/EPCInstanceTest.txt b/src/test/cord-api/MCORD-Tests/EPCInstanceTest.txt
index 218e32b..d9a33ae 100644
--- a/src/test/cord-api/MCORD-Tests/EPCInstanceTest.txt
+++ b/src/test/cord-api/MCORD-Tests/EPCInstanceTest.txt
@@ -8,7 +8,7 @@
Library XML
Library RequestsLibrary
Library ../Framework/utils/utils.py
-Library ../Framework/restApi.py
+Library ../Framework/restApi.py MCORD_RestApiProperties.py
*** Variables ***
${USER} admin
@@ -18,17 +18,19 @@
*** Test Cases *** TYPE LISTINDEX
Test Create EPC EPC_CREATE 0
-Test Instance creation validation
+Test Instance Validation
INSTANCE_VALIDATE 0
*** Keywords ***
Read InputFile
- ${subscriberList} = utils.jsonToList ${PATHFILE} EPCInfo
- Set Suite Variable ${slist} ${subscriberList}
+ ${EPCList} = utils.jsonToList ${PATHFILE} EPCInfo
+ Set Suite Variable ${elist} ${EPCList}
+ @{vepc_instanceList}= Create List mysite_venb mysite_vspgwc mysite_vspgwu
@{instanceList}= Create List
Set Suite Variable @{instanceList}
+ Set Suite Variable @{vepc_instanceList}
-Verify Single Instance functionality
+Verify EPC Instance functionality
[Arguments] ${type} ${listIndex}
Run Keyword If "${type}" == "EPC_CREATE" Test Post EPC Create ${listIndex}
Run Keyword If "${type}" == "INSTANCE_VALIDATE" Test Instance Validation ${listIndex}
@@ -38,25 +40,23 @@
${EPCList} = Get Variable Value ${elist}
${InputDict}= utils.listToDict ${EPCList} ${listIndex}
${api_result}= restApi.ApiPost EPC_INSTANCES ${InputDict}
- ${service_specific_id}= utils.getFieldValueFromDict ${InputDict} site_id
+ ${site_id}= utils.getFieldValueFromDict ${InputDict} site_id
${json_result}= restApi.ApiGet EPC_INSTANCES
Log ${json_result}
${json_result_list}= Get From Dictionary ${json_result} items
${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} site_id ${site_id}
${result}= utils.compare_dict ${InputDict} ${getJsonDict}
Should Be True ${result}
- ${instanceList} Create List
+ Sleep 30s
Test Instance Validation
[Arguments] ${listIndex}
${get_result}= restApi.ApiGet CORE_INSTANCES
Should Be True ${get_result}
${get_result_List}= Get From Dictionary ${get_result} items
- ${instanceFinalList}= Remove Duplicates ${instanceList}
- Log ${instanceFinalList}
- ${instanceCount}= Get Length ${instanceFinalList}
- Log ${instanceCount}
- Should Be True ${instanceCount} == 1
- ${instance_id}= Get From List ${instanceFinalList} 0
- ${get_CoreInstanceresult}= restApi.ApiChameleonGet CORE_INSTANCES ${instance_id}
- Should Be True ${get_CoreInstanceresult}
+ : FOR ${Item} IN @{get_result_List}
+ \ ${instance_name}= Get From Dictionary ${Item} name
+ \ Append To List ${instanceList} ${instance_name}
+ Log ${instanceList}
+ Sort List ${instanceList}
+ Lists Should Be Equal ${instanceList} ${vepc_instanceList}
diff --git a/src/test/cord-api/MCORD-Tests/data/EPCInstance.json b/src/test/cord-api/MCORD-Tests/data/EPCInstance.json
index 3151d45..6aa8fa7 100644
--- a/src/test/cord-api/MCORD-Tests/data/EPCInstance.json
+++ b/src/test/cord-api/MCORD-Tests/data/EPCInstance.json
@@ -3,7 +3,7 @@
[
{
"blueprint": "build",
- "site_id":"1"
+ "site_id": 1
}
]
}
diff --git a/src/test/cord-api/Properties/MCORD_RestApiProperties.py b/src/test/cord-api/Properties/MCORD_RestApiProperties.py
index de757aa..e25db98 100644
--- a/src/test/cord-api/Properties/MCORD_RestApiProperties.py
+++ b/src/test/cord-api/Properties/MCORD_RestApiProperties.py
@@ -17,9 +17,9 @@
#!/usr/bin/env python
-SERVER_IP = 'c220g2-011013.wisc.cloudlab.us'
+SERVER_IP = 'clnode103.clemson.cloudlab.us'
SERVER_PORT = '8080'
USER = 'xosadmin@opencord.org'
-PASSWD = ''
+PASSWD = 'ENpKyPfvEsS9lODZnrZk'
EPC_INSTANCES = '/xosapi/v1/vepc/vepcserviceinstances'
CORE_INSTANCES = '/xosapi/v1/core/instances'