Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for EPC Creation |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify EPC Instance Functionality |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
| 8 | Library XML |
| 9 | Library RequestsLibrary |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 10 | Library CORDRobot |
| 11 | Library ImportResource resources=CORDRobot |
| 12 | Library MCORD_RestApiProperties.py |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
| 15 | ${USER} admin |
| 16 | ${PASSWORD} admin |
| 17 | ${PATHFILE} ${CURDIR}/data/EPCInstance.json |
| 18 | |
| 19 | *** Test Cases *** TYPE LISTINDEX |
| 20 | Test Create EPC EPC_CREATE 0 |
| 21 | |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 22 | Test Instance Validation |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 23 | INSTANCE_VALIDATE 0 |
| 24 | |
| 25 | *** Keywords *** |
| 26 | Read InputFile |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 27 | ${EPCList} = CORDRobot.jsonToList ${PATHFILE} EPCInfo |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 28 | Set Suite Variable ${elist} ${EPCList} |
| 29 | @{vepc_instanceList}= Create List mysite_venb mysite_vspgwc mysite_vspgwu |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 30 | @{instanceList}= Create List |
| 31 | Set Suite Variable @{instanceList} |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 32 | Set Suite Variable @{vepc_instanceList} |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 33 | |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 34 | Verify EPC Instance functionality |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 35 | [Arguments] ${type} ${listIndex} |
| 36 | Run Keyword If "${type}" == "EPC_CREATE" Test Post EPC Create ${listIndex} |
| 37 | Run Keyword If "${type}" == "INSTANCE_VALIDATE" Test Instance Validation ${listIndex} |
| 38 | |
| 39 | Test Post EPC Create |
| 40 | [Arguments] ${listIndex} |
| 41 | ${EPCList} = Get Variable Value ${elist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 42 | ${InputDict}= CORDRobot.listToDict ${EPCList} ${listIndex} |
| 43 | ${api_result}= CORDRobot.ApiPost EPC_INSTANCES ${InputDict} |
| 44 | ${site_id}= CORDRobot.getFieldValueFromDict ${InputDict} site_id |
| 45 | ${json_result}= CORDRobot.ApiGet EPC_INSTANCES |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 46 | Log ${json_result} |
| 47 | ${json_result_list}= Get From Dictionary ${json_result} items |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 48 | ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list} site_id ${site_id} |
| 49 | ${result}= CORDRobot.compare_dict ${InputDict} ${getJsonDict} |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 50 | Should Be True ${result} |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 51 | Sleep 30s |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 52 | |
| 53 | Test Instance Validation |
| 54 | [Arguments] ${listIndex} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 55 | ${get_result}= CORDRobot.ApiGet CORE_INSTANCES |
Suchitra Vemuri | 038f99b | 2017-12-15 15:29:52 -0800 | [diff] [blame] | 56 | Should Be True ${get_result} |
| 57 | ${get_result_List}= Get From Dictionary ${get_result} items |
Suchitra Vemuri | 9008144 | 2017-12-20 16:10:15 -0800 | [diff] [blame] | 58 | : FOR ${Item} IN @{get_result_List} |
| 59 | \ ${instance_name}= Get From Dictionary ${Item} name |
| 60 | \ Append To List ${instanceList} ${instance_name} |
| 61 | Log ${instanceList} |
| 62 | Sort List ${instanceList} |
| 63 | Lists Should Be Equal ${instanceList} ${vepc_instanceList} |