Suchitra Vemuri | ef89583 | 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 |
| 10 | Library ../Framework/utils/utils.py |
| 11 | Library ../Framework/restApi.py |
| 12 | |
| 13 | *** Variables *** |
| 14 | ${USER} admin |
| 15 | ${PASSWORD} admin |
| 16 | ${PATHFILE} ${CURDIR}/data/EPCInstance.json |
| 17 | |
| 18 | *** Test Cases *** TYPE LISTINDEX |
| 19 | Test Create EPC EPC_CREATE 0 |
| 20 | |
| 21 | Test Instance creation validation |
| 22 | INSTANCE_VALIDATE 0 |
| 23 | |
| 24 | *** Keywords *** |
| 25 | Read InputFile |
| 26 | ${subscriberList} = utils.jsonToList ${PATHFILE} EPCInfo |
| 27 | Set Suite Variable ${slist} ${subscriberList} |
| 28 | @{instanceList}= Create List |
| 29 | Set Suite Variable @{instanceList} |
| 30 | |
| 31 | Verify Single Instance functionality |
| 32 | [Arguments] ${type} ${listIndex} |
| 33 | Run Keyword If "${type}" == "EPC_CREATE" Test Post EPC Create ${listIndex} |
| 34 | Run Keyword If "${type}" == "INSTANCE_VALIDATE" Test Instance Validation ${listIndex} |
| 35 | |
| 36 | Test Post EPC Create |
| 37 | [Arguments] ${listIndex} |
| 38 | ${EPCList} = Get Variable Value ${elist} |
| 39 | ${InputDict}= utils.listToDict ${EPCList} ${listIndex} |
| 40 | ${api_result}= restApi.ApiPost EPC_INSTANCES ${InputDict} |
| 41 | ${service_specific_id}= utils.getFieldValueFromDict ${InputDict} site_id |
| 42 | ${json_result}= restApi.ApiGet EPC_INSTANCES |
| 43 | Log ${json_result} |
| 44 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 45 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} site_id ${site_id} |
| 46 | ${result}= utils.compare_dict ${InputDict} ${getJsonDict} |
| 47 | Should Be True ${result} |
| 48 | ${instanceList} Create List |
| 49 | |
| 50 | Test Instance Validation |
| 51 | [Arguments] ${listIndex} |
| 52 | ${get_result}= restApi.ApiGet CORE_INSTANCES |
| 53 | Should Be True ${get_result} |
| 54 | ${get_result_List}= Get From Dictionary ${get_result} items |
| 55 | ${instanceFinalList}= Remove Duplicates ${instanceList} |
| 56 | Log ${instanceFinalList} |
| 57 | ${instanceCount}= Get Length ${instanceFinalList} |
| 58 | Log ${instanceCount} |
| 59 | Should Be True ${instanceCount} == 1 |
| 60 | ${instance_id}= Get From List ${instanceFinalList} 0 |
| 61 | ${get_CoreInstanceresult}= restApi.ApiChameleonGet CORE_INSTANCES ${instance_id} |
| 62 | Should Be True ${get_CoreInstanceresult} |