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