Revert "Revert "Modified testsuites to remove resource files""
[osm/tests.git] / robot-systest / testsuite / epa_05-epa_underlay_passthrough.robot
1 #   Licensed under the Apache License, Version 2.0 (the "License");
2 #   you may not use this file except in compliance with the License.
3 #   You may obtain a copy of the License at
4 #
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #   Unless required by applicable law or agreed to in writing, software
8 #   distributed under the License is distributed on an "AS IS" BASIS,
9 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 #   See the License for the specific language governing permissions and
11 #   limitations under the License.
12
13 *** Settings ***
14 Documentation     [EPA-05] EPA underlay PASSTHROUGH.
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   SSHLibrary
20
21 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
25 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
27
28 Variables   %{ROBOT_DEVOPS_FOLDER}/resources/epa_05-epa_underlay_passthrough.py
29
30 Force Tags   epa_05   cluster_epa
31
32 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
33
34
35 *** Variables ***
36 # NS and VNF descriptor package folder and ids
37 ${vnfd_pkg}   epa_1vm_passthrough_vnf
38 ${vnfd_name}   epa_1vm_passthrough-vnf
39 ${nsd_pkg}   epa_1vm_passthrough_ns
40 ${nsd_name}   epa_1vm_passthrough-ns
41 ${ns_name}   epa_05
42
43 # Fixed IPs and subnet for datanet VL
44 ${datanet_subnet}   192.168.110.0/24
45 ${datanet_ip1}   192.168.110.11
46 ${datanet_ip2}   192.168.110.22
47
48 ${vnf_member_index_1}   1
49 ${vnf_member_index_2}   2
50 ${username}   ubuntu
51 ${password}   osm4u
52 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} , {name: datanet, ip-profile: {ip-version: ipv4, subnet-address: "${datanet_subnet}"}, vnfd-connection-point-ref: [ {member-vnf-index-ref: "1", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip1}"}, {member-vnf-index-ref: "2", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip2}"}]} ] }
53 ${success_return_code}   0
54
55
56 *** Test Cases ***
57 Create VNF Descriptor
58
59     Remove Environment Variable  OVERRIDES
60     Create VNFD  '%{PACKAGES_FOLDER}/${vnfd_pkg}'
61
62
63 Create NS Descriptor
64
65     Create NSD  '%{PACKAGES_FOLDER}/${nsd_pkg}'
66
67
68 Instantiate Network Service
69
70     ${id}=  Create Network Service  ${nsd_name}  %{VIM_TARGET}  ${ns_name}  ${ns_config}  ${EMPTY}
71     Set Suite Variable  ${ns_id}  ${id}
72
73
74 Get Management Ip Addresses
75
76     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
77     ${ip}  Get Vnf Management Ip Address  ${ns_id}  ${vnf_member_index_1}
78     Set Suite Variable  ${ip_mgmt_1}  ${ip}
79     log  ${ip_mgmt_1}
80
81     ${ip}  Get Vnf Management Ip Address  ${ns_id}  ${vnf_member_index_2}
82     Set Suite Variable  ${ip_mgmt_2}  ${ip}
83     log  ${ip_mgmt_2}
84
85
86 Ping from Vnf1 to Vnf2
87
88     Variable Should Exist  ${ip_mgmt_1}  msg=IP address of the data VNF '${vnf_member_index_1}' is not available
89     Variable Should Exist  ${privatekey}  msg=SSH private key not available
90     Sleep   30 seconds   Wait for SSH daemon to be up
91     ${stdout}=   Execute Remote Command Check Rc Return Output   ${ip_mgmt_1}   ${username}   ${password}   ${privatekey}   ip addr ; ping -c 5 ${datanet_ip2}
92     log  ${stdout}
93
94
95 Ping from Vnf2 to Vnf1
96
97     Variable Should Exist  ${ip_mgmt_2}  msg=IP address of the data VNF '${vnf_member_index_2}' is not available
98     Variable Should Exist  ${privatekey}  msg=SSH private key not available
99     ${stdout}=   Execute Remote Command Check Rc Return Output   ${ip_mgmt_2}   ${username}   ${password}   ${privatekey}   ip addr ; ping -c 5 ${datanet_ip1}
100     log  ${stdout}
101
102
103 Delete NS Instance
104     [Tags]   cleanup
105
106     Delete NS  ${ns_name}
107
108
109 Delete NS Descriptor
110     [Tags]   cleanup
111
112     Delete NSD  ${nsd_name}
113
114
115 Delete VNF Descriptor
116     [Tags]   cleanup
117
118     Delete VNFD  ${vnfd_name}
119
120
121
122 *** Keywords ***
123 Suite Cleanup
124     [Documentation]  Test Suite Cleanup: Deleting descriptors and NS instance
125
126     Run Keyword If Any Tests Failed  Delete NS  ${ns_name}
127
128     Run Keyword If Any Tests Failed  Delete NSD  ${nsd_name}
129
130     Run Keyword If Any Tests Failed  Delete VNFD  ${vnfd_name}
131
132