blob: bf19af837474e22bedddbc249dc131620e83cbc3 [file] [log] [blame]
Suchitra Vemurif7410a92017-05-16 17:04:05 -07001*** Settings ***
2Documentation Test suite for volt Tenant Verification - Chameleon API
3Suite Setup Read InputFile
4Test Template Verify volt Tenant Functionality
5Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
10Library ../Framework/utils/utils.py
11Library ../Framework/restApi.py
12
13*** Variables ***
14${USER} admin
15${PASSWORD} admin
16${PATHFILE} ${CURDIR}/data/Ch_VoltTenant.json
17${PATHFILE2} ${CURDIR}/data/Ch_putVoltTenant.json
18
19*** Test Cases *** TYPE LISTINDEX
20Test volt Tenant-1 CREATE 0
21
22Test volt Tenant-2 CREATE 1
23
24Test volt Tenant-3 CREATE 2
25
26*** Keywords ***
27Read InputFile
28 ${voltList} = utils.jsonToList ${PATHFILE} voltSubscriberInfo
29 Set Suite Variable ${vlist} ${voltList}
30 ${putvoltList}= utils.jsonToList ${PATHFILE2} voltSubscriberInfo
31 Set Suite Variable ${putList} ${putvoltList}
32
33Verify volt Tenant Functionality
34 [Arguments] ${type} ${listIndex}
35 Run Keyword If "${type}" == "CREATE" Test Post volt Tenant API ${listIndex}
36
37Test Post volt Tenant API
38 [Arguments] ${listIndex}
39 ${voltTenantList} = Get Variable Value ${vlist}
40 ${voltTenantDict}= utils.listToDict ${voltTenantList} ${listIndex}
41 ${voltDict}= Get From Dictionary ${voltTenantDict} voltTenant
Suchitra Vemuridaeb2472017-08-15 11:58:21 -070042 ${c_tag}= Get From Dictionary ${voltDict} c_tag
43 ${postResult}= restApi.ApiPost VOLT_TENANT ${voltDict}
44 # Verifying Get Operation after POST
45 ${getVolt_result}= restApi.ApiGet VOLT_TENANT
46 ${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
47 ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} c_tag ${c_tag}
48 ${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
49 Should Be True ${test_result}
50 # Retrieve provided_link_ids from tenantobject and associate with serviceinstancelinks to the core
51 #${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id
52 #${get_result}= restApi.ApiGet VOLT_SUBSCRIBER
53 #${get_result_list}= Get From Dictionary ${get_result} items
54 #${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id}
55 #${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id
56 #Log ${subscriberID}
57 #${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID}
58 #${api_result}= restApi.ApiPost VOLT_TENANT ${voltDict}
59 #Should Be True ${api_result}
60 # Verifying Get operation after POST
61 #${getVolt_result}= restApi.ApiGet VOLT_TENANT
62 #${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
63 #${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID}
64 #${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
65 #Should Be True ${test_result}
66 # # Verifying PUT operation
67 # ${putvoltList}= Get Variable Value ${putList}
68 # ${putVoltDict}= utils.listToDict ${putvoltList} ${listIndex}
69 # ${putvoltTenantDict}= Get From Dictionary ${putVoltDict} voltTenant
70 # ${voltID}= utils.getFieldValueFromDict ${getJsonDict} id
71 # ${put_result}= restApi.ApiChameleonPut VOLT_TENANT ${putvoltTenantDict} ${voltID}
72 # Should Be True ${put_result}
73 # # Verifying Get after PUT operation
74 # #${getVolt_afterPut}= restApi.ApiGet VOLT_TENANT
75 # #${getVoltDict}= utils.getDictFromListofDict ${getVolt_afterPut} id ${voltID}
76 # ${getVoltDict}= restApi.ApiChameleonGet VOLT_TENANT ${voltID}
77 # ${result_afterPut}= utils.compare_dict ${putvoltTenantDict} ${getVoltDict}
78 # Should Be True ${result_afterPut}