Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 1 | *** Settings *** |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 2 | Documentation Test suite for Instance creation for multiple subscribers with multiple "s_tag" - Chameleon APIs |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 3 | Suite Setup Read InputFile |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 4 | Test Template Verify Multiple Instance Creation Functionality |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 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 |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 16 | ${PATHFILE} ${CURDIR}/data/Ch_Subscriber_MultiInstance.json |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 17 | |
| 18 | *** Test Cases *** TYPE LISTINDEX |
| 19 | Test Create Subscriber-1 |
| 20 | SUBSCRIBER_CREATE 0 |
| 21 | |
| 22 | Test Create Subscriber-2 |
| 23 | SUBSCRIBER_CREATE 1 |
| 24 | |
| 25 | Test Create Subscriber-3 |
| 26 | SUBSCRIBER_CREATE 2 |
| 27 | |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 28 | Test Instance creation validation |
| 29 | INSTANCE_VALIDATE 0 |
| 30 | |
| 31 | *** Keywords *** |
| 32 | Read InputFile |
| 33 | ${subscriberList} = utils.jsonToList ${PATHFILE} SubscriberInfo |
| 34 | Set Suite Variable ${slist} ${subscriberList} |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 35 | @{instanceList}= Create List |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 36 | ${Subscriber_Id}= Set Variable |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 37 | Set Suite Variable @{instanceList} |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 38 | Set Suite Variable ${Subscriber_Id} |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 39 | |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 40 | Verify Multiple Instance Creation Functionality |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 41 | [Arguments] ${type} ${listIndex} |
| 42 | Run Keyword If "${type}" == "SUBSCRIBER_CREATE" Test Post Subscriber Create ${listIndex} |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 43 | Run Keyword If "${type}" == "INSTANCE_VALIDATE" Test Instance Validation ${listIndex} |
| 44 | |
| 45 | Test Post Subscriber Create |
| 46 | [Arguments] ${listIndex} |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 47 | [Documentation] Test posts subscribers and validates the end-end functionality until instance creations |
| 48 | # Read input from data files and post subscriber |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 49 | ${subscriberList} = Get Variable Value ${slist} |
| 50 | ${subscriberDict}= utils.listToDict ${subscriberList} ${listIndex} |
| 51 | ${api_result}= restApi.ApiPost VOLT_SUBSCRIBER ${subscriberDict} |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 52 | Sleep 30 |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 53 | ${service_specific_id}= utils.getFieldValueFromDict ${subscriberDict} service_specific_id |
| 54 | ${json_result}= restApi.ApiGet VOLT_SUBSCRIBER |
| 55 | Log ${json_result} |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 56 | # Verifying GET operation after POST and validating the contents posted match the input data |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 57 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 58 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} service_specific_id ${service_specific_id} |
| 59 | ${result}= utils.compare_dict ${subscriberDict} ${getJsonDict} |
| 60 | Should Be True ${result} |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 61 | ${Subscriber_Id}= utils.getFieldValueFromDict ${getJsonDict} id |
| 62 | Log ${Subscriber_Id} |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 63 | # Retrieve subscribed_links_id from GET result of the posted Subscriber |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 64 | ${subscribed_links_ids_list}= utils.getFieldValueFromDict ${getJsonDict} subscribed_links_ids |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 65 | Log ${subscribed_links_ids_list} |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 66 | ${subscribed_links_ids}= Get From List ${subscribed_links_ids_list} 0 |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 67 | Log ${subscribed_links_ids} |
| 68 | # Retrieve provided_links_ids from core/serviceinstancelink |
| 69 | ${getServiceLink}= restApi.ApiChameleonGet CH_CORE_SERVICELINK ${subscribed_links_ids} |
Suchitra Vemuri | daeb247 | 2017-08-15 11:58:21 -0700 | [diff] [blame] | 70 | ${provider_service_instance_id}= Get From Dictionary ${getServiceLink} provider_service_instance_id |
Suchitra Vemuri | 465d46a | 2018-03-02 00:04:47 -0800 | [diff] [blame] | 71 | # Verify created volt using the above provider_service_instance_id |
| 72 | # Verifying GET operation for the Autocreated Volt |
| 73 | ${get_result}= restApi.ApiChameleonGet VOLT_TENANT ${provider_service_instance_id} |
| 74 | Should Be True ${get_result} |
| 75 | # Get "subscriber_links_ids" from the GET result of /volt/volttenants |
| 76 | ${subscribed_links_ids_list}= Get From Dictionary ${get_result} subscribed_links_ids |
| 77 | ${subscribed_links_ids}= Get From List ${subscribed_links_ids_list} 0 |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 78 | # Validation of Instances |
| 79 | Log ${instanceList} |
Suchitra Vemuri | e40e0d2 | 2017-08-23 16:08:38 -0700 | [diff] [blame] | 80 | ${serviceLinkDict}= restApi.ApiChameleonGet CH_CORE_SERVICELINK ${subscribed_links_ids} |
| 81 | Log ${serviceLinkDict} |
| 82 | ${VSGTenant}= Get From Dictionary ${serviceLinkDict} provider_service_instance_id |
| 83 | # Retrieve VSGTenant to retrieve instance_id |
| 84 | ${getVSG_result}= restApi.ApiChameleonGet VSG_TENANT ${VSGTenant} |
Suchitra Vemuri | da8492a | 2017-06-15 14:47:24 -0700 | [diff] [blame] | 85 | ${instance_id}= Get From Dictionary ${getVSG_result} instance_id |
| 86 | Append To List ${instanceList} ${instance_id} |
| 87 | Log ${instanceList} |
| 88 | ${get_CoreInstanceresult}= restApi.ApiChameleonGet CH_CORE_INSTANCES ${instance_id} |
| 89 | Should Be True ${get_CoreInstanceresult} |
| 90 | |
| 91 | Test Instance Validation |
| 92 | [Arguments] ${listIndex} |
| 93 | ${get_result}= restApi.ApiGet VSG_TENANT |
| 94 | Should Be True ${get_result} |
| 95 | ${instanceFinalList}= Remove Duplicates ${instanceList} |
| 96 | Log ${instanceFinalList} |
| 97 | ${instanceCount}= Get Length ${instanceFinalList} |
| 98 | Log ${instanceCount} |
| 99 | Should Be True ${instanceCount} == 3 |