| *** Comments *** |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| |
| *** Settings *** |
| Documentation {{ documentation }} |
| |
| Library OperatingSystem |
| Library String |
| Library Collections |
| Library Process |
| Library SSHLibrary |
| |
| Resource ../lib/vnfd_lib.resource |
| Resource ../lib/nsd_lib.resource |
| Resource ../lib/ns_lib.resource |
| Resource ../lib/connectivity_lib.resource |
| Resource ../lib/ssh_lib.resource |
| |
| Test Tags {% for tag in tags %}{{ tag }}{% if not loop.last %} {% endif %}{% endfor %} |
| |
| Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| |
| |
| *** Variables *** |
| # NF package folders and names |
| {% for item in nfpkg -%} |
| ${NFPKG{{ loop.index }}_FOLDER} {{ item.package }} |
| ${NFPKG{{ loop.index }}_NAME} {{ item.name }} |
| {% endfor %} |
| # NS package folders and names |
| {% for item in nspkg -%} |
| ${NSPKG{{ loop.index }}_FOLDER} {{ item.package }} |
| ${NSPKG{{ loop.index }}_NAME} {{ item.name }} |
| {% endfor %} |
| # NS instance name and configuration |
| {% for item in ns -%} |
| ${NS{{ loop.index }}_NAME} {{ item.name }} |
| ${NS{{ loop.index }}_CONFIG} {{ item.config }} |
| {% endfor %} |
| # SSH keys and username to be used |
| ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| ${PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| ${USERNAME} ubuntu |
| ${PASSWORD} ${EMPTY} |
| |
| {% for item in ns -%} |
| ${NS{{ loop.index }}_ID} ${EMPTY} |
| {%- endfor %} |
| {% for item in vnf -%} |
| ${VNF{{ loop.index }}_IP_ADDR} ${EMPTY} |
| ${VNF{{ loop.index }}_MEMBER_INDEX} {{ item.vnf_member_index }} |
| ${VNF{{ loop.index }}_NS_NAME} {{ item.ns }} |
| {%- endfor %} |
| |
| |
| *** Test Cases *** |
| {%- for item in nfpkg %} |
| Add NF Package {{ item.name }} |
| [Documentation] Upload NF package {{ item.name }} for the testsuite. |
| Create VNFD '%{PACKAGES_FOLDER}/${NFPKG{{ loop.index }}_FOLDER}' |
| {% endfor %} |
| {%- for item in nspkg %} |
| Add NS Package {{ item.name }} |
| [Documentation] Upload NS package {{ item.name }} for the testsuite. |
| Create NSD '%{PACKAGES_FOLDER}/${NSPKG{{ loop.index }}_FOLDER}' |
| {% endfor %} |
| {%- for item in ns %} |
| Network Service Instance {{ item.name }} |
| [Documentation] Instantiate NS {{ item.name }} for the testsuite. |
| ${id}= Create Network Service ${NSPKG{{ item.nspkg_index }}_NAME} %{VIM_TARGET} ${NS{{ loop.index }}_NAME} ${NS{{ loop.index }}_CONFIG} ${PUBLICKEY} |
| Set Suite Variable ${NS{{ loop.index }}_ID} ${id} |
| {% endfor %} |
| {%- for item in vnf %} |
| Get Vnf Ip Address |
| [Documentation] Get the mgmt IP address of the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }}. |
| ${ip_addr}= Get Vnf Management Ip Address ${NS{{ item.ns_index }}_ID} ${VNF{{ loop.index }}_MEMBER_INDEX} |
| Log ${ip_addr} |
| Set Suite Variable ${VNF{{ loop.index }}_IP_ADDR} ${ip_addr} |
| {% for item2 in item.tests %} |
| {#- Check if "ping" test exists for this VNF -#} |
| {% if item2.type == 'ping' %} |
| Test Ping |
| [Documentation] Test that the mgmt IP address of the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }} is reachable with ping. |
| Test Connectivity ${VNF{{ loop.index }}_IP_ADDR} |
| {% endif %} |
| {#- Check if "ssh" test exists for this VNF -#} |
| {% if item2.type == 'ssh' %} |
| Test SSH Access |
| [Documentation] Check that the VNF {{ item.vnf_member_index }} of the NS {{ item.ns }} is accessible via SSH in its mgmt IP address. |
| Sleep 30s Waiting ssh daemon to be up |
| Test SSH Connection ${VNF{{ loop.index }}_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} |
| {%- endif %} |
| {%- endfor %} |
| {%- endfor %} |
| |
| {% for item in ns -%} |
| Delete NS Instance {{ item.name }} |
| [Documentation] Delete NS instance {{ item.name }}. |
| [Tags] cleanup |
| Delete NS ${NS{{ loop.index }}_NAME} |
| {% endfor %} |
| |
| {%- for item in nspkg %} |
| Delete NS Package {{ item.name }} |
| [Documentation] Delete NS package {{ item.name }} from OSM. |
| [Tags] cleanup |
| Delete NSD ${NSPKG{{ loop.index }}_NAME} |
| {% endfor %} |
| |
| {%- for item in nfpkg %} |
| Delete NF Package {{ item.name }} |
| [Documentation] Delete NF package {{ item.name }} from OSM. |
| [Tags] cleanup |
| Delete VNFD ${NFPKG{{ loop.index }}_NAME} |
| {% endfor %} |
| |
| *** Keywords *** |
| Suite Cleanup |
| [Documentation] Test Suit Cleanup: Deleting packages and NS instances |
| {%- for item in ns %} |
| Run Keyword If Any Tests Failed Delete NS ${NS{{ loop.index }}_NAME} |
| {%- endfor -%} |
| {%- for item in nspkg %} |
| Run Keyword If Any Tests Failed Delete NSD ${NSPKG{{ loop.index }}_NAME} |
| {%- endfor -%} |
| {%- for item in nfpkg %} |
| Run Keyword If Any Tests Failed Delete VNFD ${NFPKG{{ loop.index }}_NAME} |
| {%- endfor %} |