blob: 60b4a41de5f651801ffdd27b11f32656f984fe70 [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
42 ${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id
43 ${get_result}= restApi.ApiGet VOLT_SUBSCRIBER
44 ${get_result_list}= Get From Dictionary ${get_result} items
45 ${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id}
46 ${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id
47 Log ${subscriberID}
48 ${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID}
49 ${api_result}= restApi.ApiPost VOLT_TENANT ${updatedVoltDict}
50 Should Be True ${api_result}
51 # Verifying Get operation after POST
52 ${getVolt_result}= restApi.ApiGet VOLT_TENANT
53 ${getVolt_result_list}= Get From Dictionary ${getVolt_result} items
54 ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID}
55 ${test_result}= utils.compare_dict ${voltDict} ${getJsonDict}
56 Should Be True ${test_result}
57 # Verifying PUT operation
58 ${putvoltList}= Get Variable Value ${putList}
59 ${putVoltDict}= utils.listToDict ${putvoltList} ${listIndex}
60 ${putvoltTenantDict}= Get From Dictionary ${putVoltDict} voltTenant
61 ${voltID}= utils.getFieldValueFromDict ${getJsonDict} id
62 ${put_result}= restApi.ApiChameleonPut VOLT_TENANT ${putvoltTenantDict} ${voltID}
63 Should Be True ${put_result}
64 # Verifying Get after PUT operation
65 #${getVolt_afterPut}= restApi.ApiGet VOLT_TENANT
66 #${getVoltDict}= utils.getDictFromListofDict ${getVolt_afterPut} id ${voltID}
67 ${getVoltDict}= utils.ApiChemeleonGet VOLT_TENANT ${voltID}
68 ${result_afterPut}= utils.compare_dict ${putvoltTenantDict} ${getVoltDict}
69 Should Be True ${result_afterPut}