Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Suite for XOS APIs |
| 3 | Suite Setup Setup |
| 4 | Suite Teardown Teardown |
| 5 | Test Template Verify API Functionality |
| 6 | Library Collections |
| 7 | Library String |
| 8 | Library OperatingSystem |
| 9 | Library XML |
| 10 | Library RequestsLibrary |
Kailash Khalasi | 78735ea | 2018-05-01 13:48:26 -0700 | [diff] [blame] | 11 | Library HttpLibrary.HTTP |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 12 | Library ../Framework/utils/utils.py |
| 13 | Library ../Framework/restApi.py |
| 14 | Variables ../Properties/RestApiProperties.py |
| 15 | |
| 16 | *** Variables *** |
| 17 | ${xos_service} core |
| 18 | |
| 19 | *** Test Cases *** TYPE API |
| 20 | {%- for m in proto.messages -%} |
| 21 | {%- if m.name not in ['XOSBase'] -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 22 | {% autoescape false %} |
| 23 | {% endautoescape %} |
Kailash Khalasi | 9302c18 | 2018-05-07 13:46:15 -0600 | [diff] [blame] | 24 | Create {{ m.name }} CREATE /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}} ${json_{{ m.name | lower}}_1} |
Kailash Khalasi | 008d564 | 2018-02-12 12:59:53 -0800 | [diff] [blame] | 25 | [Tags] {{ m.name }} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 26 | |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 27 | Update {{ m.name }} UPDATE /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}} ${json_{{ m.name | lower}}_amend_1} ${id} |
Kailash Khalasi | 008d564 | 2018-02-12 12:59:53 -0800 | [diff] [blame] | 28 | [Tags] {{ m.name }} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 29 | |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 30 | Get {{ m.name }} RETRIEVE /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}} ${json_{{ m.name | lower}}_amend_1} ${id} ${json_{{ m.name | lower}}_amend_key} |
Kailash Khalasi | 008d564 | 2018-02-12 12:59:53 -0800 | [diff] [blame] | 31 | [Tags] {{ m.name }} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 32 | |
Kailash Khalasi | 9302c18 | 2018-05-07 13:46:15 -0600 | [diff] [blame] | 33 | Delete {{ m.name }} DELETE /xosapi/v1/${xos_service}/{{ xproto_pluralize(m) | lower}} data_id=${id} |
Kailash Khalasi | 008d564 | 2018-02-12 12:59:53 -0800 | [diff] [blame] | 34 | [Tags] {{ m.name }} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 35 | {% endif %} |
| 36 | {% endfor -%} |
| 37 | |
| 38 | *** Keywords *** |
| 39 | Verify API Functionality |
| 40 | [Arguments] ${type} ${endpoint} ${data}=${EMPTY} ${data_id}=${EMPTY} ${key}=${EMPTY} |
| 41 | Run Keyword If "${type}" == "RETRIEVE" CORD Get ${endpoint} ${data_id} ${data} ${key} |
| 42 | Run Keyword If "${type}" == "CREATE" CORD Post ${endpoint} ${data} |
| 43 | Run Keyword If "${type}" == "UPDATE" CORD Put ${endpoint} ${data} ${data_id} |
| 44 | Run Keyword If "${type}" == "DELETE" CORD Delete ${endpoint} ${data_id} |
| 45 | |
| 46 | CORD Get |
| 47 | [Documentation] Make a GET call to the CORD controller |
| 48 | [Arguments] ${service} ${id} ${value} ${key} |
| 49 | ${resp}= Get Request ${SERVER_IP} ${service}/${id} |
| 50 | Log ${resp.content} |
| 51 | Should Be Equal As Strings ${resp.status_code} 200 |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 52 | ${amend_value}= Run Keyword If '${key}' != 'null' Get Json Value ${resp.content} /${key} |
| 53 | ${amend_value}= Run Keyword If '${key}' != 'null' Remove String ${amend_value} " |
| 54 | Run Keyword If '${key}' != 'null' Should Contain "${value}" ${amend_value} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 55 | [Return] ${resp} |
| 56 | |
| 57 | CORD Post |
| 58 | [Documentation] Make a POST call to the CORD controller |
| 59 | [Arguments] ${service} ${data} |
| 60 | ${data}= Evaluate json.dumps(${data}) json |
| 61 | ${resp}= Post Request ${SERVER_IP} uri=${service} data=${data} |
| 62 | Log ${resp.content} |
| 63 | Should Be Equal As Strings ${resp.status_code} 200 |
| 64 | ${id}= Get Json Value ${resp.content} /id |
| 65 | Set Suite Variable ${id} |
| 66 | [Return] ${resp} |
| 67 | |
| 68 | CORD Put |
| 69 | [Documentation] Make a PUT call to the CORD controller |
| 70 | [Arguments] ${service} ${data} ${data_id} |
| 71 | ${data}= Evaluate json.dumps(${data}) json |
| 72 | ${resp}= Put Request ${SERVER_IP} uri=${service}/${data_id} data=${data} |
| 73 | Log ${resp.content} |
| 74 | Should Be Equal As Strings ${resp.status_code} 200 |
| 75 | ${id}= Get Json Value ${resp.content} /id |
| 76 | Set Suite Variable ${id} |
| 77 | [Return] ${resp} |
| 78 | |
| 79 | CORD Delete |
| 80 | [Documentation] Make a DELETE call to the CORD controller |
| 81 | [Arguments] ${service} ${data_id} |
| 82 | ${resp}= Delete Request ${SERVER_IP} uri=${service}/${data_id} |
| 83 | Log ${resp.content} |
| 84 | Should Be Equal As Strings ${resp.status_code} 200 |
| 85 | [Return] ${resp} |
| 86 | |
| 87 | Generate JSON Data |
| 88 | {%- for m in proto.messages -%} |
| 89 | {%- if m.name not in ['XOSBase'] -%} |
| 90 | {% autoescape false %} |
| 91 | {% endautoescape %} |
| 92 | ${json_{{ m.name | lower }}_1}= Set Variable { } |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 93 | ${json_{{ m.name | lower }}_amend_1}= Set Variable { } |
| 94 | ${json_{{ m.name | lower}}_amend_key}= Set Variable null |
| 95 | Set Suite Variable ${json_{{ m.name | lower}}_amend_key} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 96 | # set required fields for {{ m.name | lower }} object |
Kailash Khalasi | 78735ea | 2018-05-01 13:48:26 -0700 | [diff] [blame] | 97 | {% for f in m.fields + xproto_base_fields(m, proto.message_table) -%} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 98 | {% if f.modifier == "required" and f.options.blank != "True" -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 99 | {% if not f.options.default -%} |
| 100 | {% if f.link -%} |
| 101 | ${tmp_{{ f.options.model | lower }}_id}= Create {{ f.options.model }} |
| 102 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }}_id ${tmp_{{ f.options.model | lower }}_id} |
Kailash Khalasi | 91d9dc0 | 2018-08-27 10:33:12 -0700 | [diff] [blame] | 103 | {% elif f.name == "created" or f.name == "amend" or f.name =="expires" or f.name =='granted' -%} |
| 104 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value float |
| 105 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_1}" |
| 106 | {% elif f.name == "role" -%} |
| 107 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value role |
| 108 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_1}" |
| 109 | {% elif f.name == "direction" -%} |
| 110 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value direction |
| 111 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_1}" |
| 112 | {% elif f.name == "flavor" -%} |
| 113 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value flavor |
| 114 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_1}" |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 115 | {% else -%} |
| 116 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value {{ f.type }} |
| 117 | ${json_{{ m.name | lower }}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_1}" |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 118 | {% if f.name == "created" or f.name == "amend" or f.name =="expires" or f.name =='granted' -%} |
| 119 | ${json_{{ m.name | lower}}_{{ f.name }}_1}= Generate Random Value float |
| 120 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_1}" |
| 121 | {% else -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 122 | {% if loop.index0 == 0 -%} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 123 | ${json_{{ m.name | lower}}_amend_key}= Set Variable {{ f.name }} |
| 124 | ${json_{{ m.name | lower}}_{{ f.name }}_amend_1}= Generate Random Value {{ f.type }} |
| 125 | ${json_{{ m.name | lower }}_amend_1}= Set Json Value ${json_{{ m.name | lower }}_amend_1} /{{ f.name }} "${json_{{ m.name | lower }}_{{ f.name }}_amend_1}" |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 126 | {% endif -%} |
| 127 | {% endif -%} |
| 128 | {% endif -%} |
| 129 | {% endif -%} |
| 130 | {% endif -%} |
| 131 | {% endfor -%} |
Kailash Khalasi | 0132fd5 | 2018-08-09 15:20:45 -0700 | [diff] [blame] | 132 | {% if m.name == "User" -%} |
Kailash Khalasi | 8c3546b | 2018-08-09 16:41:20 -0700 | [diff] [blame] | 133 | ${json_{{ m.name | lower}}_email}= Set Variable testuser@opencord.org |
| 134 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /email "${json_{{ m.name | lower }}_email}" |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 135 | ${json_{{ m.name | lower}}_email_amend_1}= Set Variable testuseramend@opencord.org |
| 136 | ${json_{{ m.name | lower}}_amend_1}= Set Json Value ${json_{{ m.name | lower }}_amend_1} /email "${json_{{ m.name | lower }}_email_amend_1}" |
Kailash Khalasi | 0132fd5 | 2018-08-09 15:20:45 -0700 | [diff] [blame] | 137 | {% endif %} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 138 | {% if m.name == "Site" -%} |
| 139 | ${json_{{ m.name | lower}}_login_base_tmp}= Set Variable testloginbase |
| 140 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /login_base "${json_{{ m.name | lower }}_login_base_tmp}" |
| 141 | {% endif %} |
Kailash Khalasi | 3566ed8 | 2018-08-27 13:16:49 -0700 | [diff] [blame] | 142 | {% if m.name == "Flavor" -%} |
| 143 | ${json_{{ m.name | lower}}_flavor_tmp}= Set Variable m1.small |
| 144 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /flavor "${json_{{ m.name | lower }}_flavor_tmp}" |
| 145 | {% endif %} |
Kailash Khalasi | f859d49 | 2018-08-27 15:27:42 -0700 | [diff] [blame] | 146 | {% if m.name == "ServiceGraphConstraint" -%} |
| 147 | ${json_{{ m.name | lower}}_constraints_tmp}= Generate Random Value string |
| 148 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /constraints "${json_{{ m.name | lower }}_constraints_tmp}" |
| 149 | {% endif %} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 150 | {% if m.name == "Slice" -%} |
| 151 | ${json_{{ m.name | lower}}_name}= Generate Random Slice Name |
| 152 | ${json_{{ m.name | lower}}_1}= Set Json Value ${json_{{ m.name | lower }}_1} /name "${json_{{ m.name | lower }}_name}" |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 153 | ${json_{{ m.name | lower}}_name_amend_1}= Generate Random Slice Name |
| 154 | ${json_{{ m.name | lower}}_amend_1}= Set Json Value ${json_{{ m.name | lower }}_amend_1} /name "${json_{{ m.name | lower}}_name_amend_1}" |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 155 | {% endif %} |
| 156 | ${json_{{ m.name | lower }}_1}= To JSON ${json_{{ m.name | lower }}_1} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 157 | ${json_{{ m.name | lower }}_amend_1}= To JSON ${json_{{ m.name | lower }}_amend_1} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 158 | Set Suite Variable ${json_{{ m.name | lower }}_1} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 159 | Set Suite Variable ${json_{{ m.name | lower }}_amend_1} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 160 | {% endif -%} |
| 161 | {% endfor %} |
| 162 | |
| 163 | {% for m in proto.messages %} |
| 164 | {%- if m.name not in ['XOSBase'] -%} |
| 165 | Create {{ m.name }} |
| 166 | ##Creating {{ m.name | lower }} object |
| 167 | ${json_{{ m.name | lower }}_tmp}= Set Variable { } |
| 168 | # set required fields for {{ m.name | lower }} object |
Kailash Khalasi | 78735ea | 2018-05-01 13:48:26 -0700 | [diff] [blame] | 169 | {% for f in m.fields + xproto_base_fields(m, proto.message_table) -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 170 | {% if f.link -%} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 171 | {% if f.modifier == "required" and f.options.blank != "True"-%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 172 | # create dependent {{ f.options.model }} |
| 173 | ${dependent_{{ f.options.model | lower }}_id}= Create {{ f.options.model }} |
| 174 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }}_id ${dependent_{{ f.options.model | lower }}_id} |
| 175 | {% endif -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 176 | {% else -%} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 177 | {% if f.modifier == "required" and f.options.blank != "True"-%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 178 | {% if not f.options.default -%} |
Kailash Khalasi | 1470fc3 | 2018-08-09 13:09:11 -0700 | [diff] [blame] | 179 | {% if m.name == "User" and f.name == "email" -%} |
| 180 | ${json_user_email_tmp}= Generate Random Value {{ f.type }} |
| 181 | ${json_user_email_tmp}= Catenate SEPARATOR= ${json_user_email_tmp} @opencord.org |
| 182 | ${json_user_tmp}= Set Json Value ${json_user_tmp} /email "${json_user_email_tmp}" |
| 183 | {% else -%} |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 184 | {% if f.name == "created" or f.name == "amend" or f.name =="expires" or f.name =='granted' -%} |
| 185 | ${json_{{ m.name | lower}}_{{ f.name }}_tmp}= Generate Random Value float |
| 186 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_tmp}" |
Kailash Khalasi | 91d9dc0 | 2018-08-27 10:33:12 -0700 | [diff] [blame] | 187 | {% elif f.name == "role" -%} |
| 188 | ${json_{{ m.name | lower}}_{{ f.name }}_tmp}= Generate Random Value role |
| 189 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_tmp}" |
| 190 | {% elif f.name == "direction" -%} |
| 191 | ${json_{{ m.name | lower}}_{{ f.name }}_tmp}= Generate Random Value direction |
| 192 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_tmp}" |
| 193 | {% elif f.name == "flavor" -%} |
| 194 | ${json_{{ m.name | lower}}_{{ f.name }}_tmp}= Generate Random Value flavor |
| 195 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_tmp}" |
Kailash Khalasi | cceec83 | 2018-08-10 15:46:50 -0700 | [diff] [blame] | 196 | {% else -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 197 | ${json_{{ m.name | lower}}_{{ f.name }}_tmp}= Generate Random Value {{ f.type }} |
| 198 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /{{ f.name }} "${json_{{ m.name | lower}}_{{ f.name }}_tmp}" |
| 199 | {% endif -%} |
| 200 | {% endif -%} |
| 201 | {% endif -%} |
| 202 | {% endif -%} |
Kailash Khalasi | 1470fc3 | 2018-08-09 13:09:11 -0700 | [diff] [blame] | 203 | {% endif -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 204 | {% endfor -%} |
| 205 | {% if m.name == "Site" -%} |
| 206 | ${json_{{ m.name | lower}}_login_base_tmp}= Set Variable testloginbase |
| 207 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /login_base "${json_{{ m.name | lower }}_login_base_tmp}" |
| 208 | {% endif %} |
Kailash Khalasi | 3566ed8 | 2018-08-27 13:16:49 -0700 | [diff] [blame] | 209 | {% if m.name == "Flavor" -%} |
| 210 | ${json_{{ m.name | lower}}_flavor_tmp}= Set Variable m1.small |
| 211 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /flavor "${json_{{ m.name | lower }}_flavor_tmp}" |
| 212 | {% endif %} |
Kailash Khalasi | f859d49 | 2018-08-27 15:27:42 -0700 | [diff] [blame] | 213 | {% if m.name == "ServiceGraphConstraint" -%} |
| 214 | ${json_{{ m.name | lower}}_contraints_tmp}= Generate Random Value string |
| 215 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /contraints "${json_{{ m.name | lower }}_contraints_tmp}" |
| 216 | {% endif %} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 217 | {% if m.name == "Slice" -%} |
| 218 | ${json_{{ m.name | lower}}_name}= Generate Random Slice Name |
| 219 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /name "${json_{{ m.name | lower }}_name}" |
Kailash Khalasi | 0e2bb70 | 2018-08-23 14:46:16 -0700 | [diff] [blame] | 220 | {% endif -%} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 221 | {% if m.name == "Network" -%} |
| 222 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /permit_all_slices true |
| 223 | {% endif %} |
Kailash Khalasi | 3481f1e | 2018-09-27 09:13:47 -0700 | [diff] [blame] | 224 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /no_policy true |
| 225 | ${json_{{ m.name | lower}}_tmp}= Set Json Value ${json_{{ m.name | lower }}_tmp} /no_sync true |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 226 | ${json_{{ m.name | lower }}_tmp}= To JSON ${json_{{ m.name | lower }}_tmp} |
| 227 | ${resp}= CORD Post /xosapi/v1/${xos_service}/{{ m.name | lower}}s ${json_{{ m.name | lower }}_tmp} |
| 228 | ${id_{{ m.name | lower }}_tmp}= Get Json Value ${resp.content} /id |
| 229 | Append To List ${dependent_{{ m.name | lower }}_ids} ${id_{{ m.name | lower }}_tmp} |
| 230 | [Return] ${id_{{ m.name | lower }}_tmp} |
| 231 | {% endif %} |
| 232 | {% endfor -%} |
| 233 | |
| 234 | Setup |
| 235 | {% for m in proto.messages %} |
| 236 | {%- if m.name not in ['XOSBase'] -%} |
| 237 | ${model}= Set Variable {{ m.name | lower }}s |
| 238 | @{dependent_{{ m.name | lower }}_ids}= Create List ${model} |
| 239 | Set Suite Variable @{dependent_{{ m.name | lower }}_ids} |
| 240 | {% endif %} |
| 241 | {% endfor -%} |
| 242 | @{dependent_models}= Create List |
| 243 | Set Suite Variable ${dependent_models} |
Kailash Khalasi | 68f9f63 | 2018-04-11 08:09:19 -0700 | [diff] [blame] | 244 | ${auth} = Create List ${XOS_USER} ${XOS_PASSWD} |
Kailash Khalasi | 8416bfe | 2017-12-20 13:06:37 -0800 | [diff] [blame] | 245 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 246 | Create Session ${SERVER_IP} http://${SERVER_IP}:${SERVER_PORT} auth=${AUTH} headers=${HEADERS} |
| 247 | Generate JSON Data |
| 248 | |
| 249 | Teardown |
| 250 | {% for m in proto.messages %} |
| 251 | {%- if m.name not in ['XOSBase'] -%} |
| 252 | ${len}= Get Length ${dependent_{{ m.name | lower }}_ids} |
| 253 | : FOR ${INDEX} IN RANGE 1 ${len} |
| 254 | \ Run Keyword And Ignore Error CORD Delete /xosapi/v1/${xos_service}/${dependent_{{ m.name | lower }}_ids[0]} ${dependent_{{ m.name | lower }}_ids[${INDEX}]} |
| 255 | {% endif %} |
| 256 | {% endfor -%} |
Kailash Khalasi | 9302c18 | 2018-05-07 13:46:15 -0600 | [diff] [blame] | 257 | Delete All Sessions |
Kailash Khalasi | 1470fc3 | 2018-08-09 13:09:11 -0700 | [diff] [blame] | 258 | |