| garciadeblas | 3a5d204 | 2024-11-21 01:12:53 +0100 | [diff] [blame] | 1 | *** Comments *** |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 8 | # Unless required by applicable law or agreed to in writing, software |
| 9 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
| 13 | |
| 14 | |
| 15 | *** Settings *** |
| 16 | Documentation {{ documentation }} |
| 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library Process |
| 22 | Library SSHLibrary |
| 23 | |
| 24 | Resource ../lib/vnfd_lib.resource |
| 25 | Resource ../lib/nsd_lib.resource |
| 26 | Resource ../lib/ns_lib.resource |
| 27 | Resource ../lib/connectivity_lib.resource |
| 28 | Resource ../lib/ssh_lib.resource |
| 29 | |
| 30 | Test Tags {% for tag in tags %}{{ tag }}{% if not loop.last %} {% endif %}{% endfor %} |
| 31 | |
| 32 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 33 | |
| 34 | |
| 35 | *** Variables *** |
| 36 | # NF package folders and names |
| 37 | {% for item in nfpkg -%} |
| 38 | ${NFPKG{{ loop.index }}_FOLDER} {{ item.package }} |
| 39 | ${NFPKG{{ loop.index }}_NAME} {{ item.name }} |
| 40 | {% endfor %} |
| 41 | # NS package folders and names |
| 42 | {% for item in nspkg -%} |
| 43 | ${NSPKG{{ loop.index }}_FOLDER} {{ item.package }} |
| 44 | ${NSPKG{{ loop.index }}_NAME} {{ item.name }} |
| 45 | {% endfor %} |
| 46 | # NS instance name and configuration |
| 47 | {% for item in ns -%} |
| 48 | ${NS{{ loop.index }}_NAME} {{ item.name }} |
| 49 | ${NS{{ loop.index }}_CONFIG} {{ item.config }} |
| 50 | {% endfor %} |
| 51 | # SSH keys and username to be used |
| 52 | ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| 53 | ${PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| 54 | ${USERNAME} ubuntu |
| 55 | ${PASSWORD} ${EMPTY} |
| 56 | |
| 57 | {% for item in ns -%} |
| 58 | ${NS{{ loop.index }}_ID} ${EMPTY} |
| 59 | {%- endfor %} |
| 60 | {% for item in vnf -%} |
| 61 | ${VNF{{ loop.index }}_IP_ADDR} ${EMPTY} |
| 62 | ${VNF{{ loop.index }}_MEMBER_INDEX} {{ item.vnf_member_index }} |
| 63 | ${VNF{{ loop.index }}_NS_NAME} {{ item.ns }} |
| 64 | {%- endfor %} |
| 65 | |
| 66 | |
| 67 | *** Test Cases *** |
| 68 | {%- for item in nfpkg %} |
| 69 | Add NF Package {{ item.name }} |
| 70 | [Documentation] Upload NF package {{ item.name }} for the testsuite. |
| 71 | Create VNFD '%{PACKAGES_FOLDER}/${NFPKG{{ loop.index }}_FOLDER}' |
| 72 | {% endfor %} |
| 73 | {%- for item in nspkg %} |
| 74 | Add NS Package {{ item.name }} |
| 75 | [Documentation] Upload NS package {{ item.name }} for the testsuite. |
| 76 | Create NSD '%{PACKAGES_FOLDER}/${NSPKG{{ loop.index }}_FOLDER}' |
| 77 | {% endfor %} |
| 78 | {%- for item in ns %} |
| 79 | Network Service Instance {{ item.name }} |
| 80 | [Documentation] Instantiate NS {{ item.name }} for the testsuite. |
| 81 | ${id}= Create Network Service ${NSPKG{{ item.nspkg_index }}_NAME} %{VIM_TARGET} ${NS{{ loop.index }}_NAME} ${NS{{ loop.index }}_CONFIG} ${PUBLICKEY} |
| 82 | Set Suite Variable ${NS{{ loop.index }}_ID} ${id} |
| 83 | {% endfor %} |
| 84 | {%- for item in vnf %} |
| 85 | Get Vnf Ip Address |
| 86 | [Documentation] Get the mgmt IP address of the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }}. |
| 87 | ${ip_addr}= Get Vnf Management Ip Address ${NS{{ item.ns_index }}_ID} ${VNF{{ loop.index }}_MEMBER_INDEX} |
| 88 | Log ${ip_addr} |
| 89 | Set Suite Variable ${VNF{{ loop.index }}_IP_ADDR} ${ip_addr} |
| 90 | {% for item2 in item.tests %} |
| 91 | {#- Check if "ping" test exists for this VNF -#} |
| 92 | {% if item2.type == 'ping' %} |
| 93 | Test Ping |
| 94 | [Documentation] Test that the mgmt IP address of the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }} is reachable with ping. |
| 95 | Test Connectivity ${VNF{{ loop.index }}_IP_ADDR} |
| 96 | {% endif %} |
| 97 | {#- Check if "ssh" test exists for this VNF -#} |
| 98 | {% if item2.type == 'ssh' %} |
| 99 | Test SSH Access |
| 100 | [Documentation] Check that the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }} is accessible via SSH in its mgmt IP address. |
| 101 | Sleep 30s Waiting ssh daemon to be up |
| 102 | Test SSH Connection ${VNF{{ loop.index }}_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} |
| 103 | {%- endif %} |
| 104 | {%- endfor %} |
| 105 | {%- endfor %} |
| 106 | |
| 107 | {% for item in ns -%} |
| 108 | Delete NS Instance {{ item.name }} |
| 109 | [Documentation] Delete NS instance {{ item.name }}. |
| 110 | [Tags] cleanup |
| 111 | Delete NS ${NS{{ loop.index }}_NAME} |
| 112 | {% endfor %} |
| 113 | |
| 114 | {%- for item in nspkg %} |
| 115 | Delete NS Package {{ item.name }} |
| 116 | [Documentation] Delete NS package {{ item.name }} from OSM. |
| 117 | [Tags] cleanup |
| 118 | Delete NSD ${NSPKG{{ loop.index }}_NAME} |
| 119 | {% endfor %} |
| 120 | |
| 121 | {%- for item in nfpkg %} |
| 122 | Delete NF Package {{ item.name }} |
| 123 | [Documentation] Delete NF package {{ item.name }} from OSM. |
| 124 | [Tags] cleanup |
| 125 | Delete VNFD ${NFPKG{{ loop.index }}_NAME} |
| 126 | {% endfor %} |
| 127 | |
| 128 | *** Keywords *** |
| 129 | Suite Cleanup |
| 130 | [Documentation] Test Suit Cleanup: Deleting packages and NS instances |
| 131 | {%- for item in ns %} |
| 132 | Run Keyword If Any Tests Failed Delete NS ${NS{{ loop.index }}_NAME} |
| 133 | {%- endfor -%} |
| 134 | {%- for item in nspkg %} |
| 135 | Run Keyword If Any Tests Failed Delete NSD ${NSPKG{{ loop.index }}_NAME} |
| 136 | {%- endfor -%} |
| 137 | {%- for item in nfpkg %} |
| 138 | Run Keyword If Any Tests Failed Delete VNFD ${NFPKG{{ loop.index }}_NAME} |
| 139 | {%- endfor %} |