Feature 11001: Robot framework linting for E2E tests
[osm/tests.git] / robot-systest / testsuite / basic_08-disable_port_security_network_level.robot
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   [BASIC-08] Disable port security at network level.
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21
22 Resource   ../lib/vim_lib.resource
23 Resource   ../lib/vnfd_lib.resource
24 Resource   ../lib/nsd_lib.resource
25 Resource   ../lib/ns_lib.resource
26 Resource   ../lib/prometheus_lib.resource
27
28 Variables   ../resources/basic_08-disable_port_security_network_level_data.py
29
30 Test Tags   basic_08   cluster_main   daily   regression
31
32 Suite Setup   Run Keyword And Ignore Error   Suite Preparation
33 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
34
35
36 *** Variables ***
37 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
38 ${PORT_DISABLED_MSG}   port_security_enabled: false
39
40
41 *** Test Cases ***
42 Create VIM With Port Security Disabled
43     [Documentation]   Register an Opentack VIM with port security disabled, so that all ports created from OSM have port security disabled
44     ...               (no firewall).
45     ${created_vim_account_id}=   Create VIM Target   ${vim_name}   ${vim_user}   ${vim_password}   ${vim_auth_url}   ${vim_tenant}   ${vim_account_type}   config=${vim_config}
46     Log   ${created_vim_account_id}
47     Check For VIM Target Status   ${VIM_NAME}   ${PROMETHEUS_HOST}   ${PROMETHEUS_PORT}   ${PROMETHEUS_USER}   ${PROMETHEUS_PASSWORD}
48
49 Create VNF Descriptor
50     [Documentation]   Upload VNF package for the testsuite.
51     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
52
53 Create NS Descriptor
54     [Documentation]   Upload NS package for the testsuite.
55     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
56
57 Instantiate Network Service
58     [Documentation]   Instantiate NS for the testsuite.
59     ${id}=   Create Network Service   ${NSD_NAME}   ${VIM_NAME}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
60     Set Suite Variable   ${NS_ID}   ${id}
61
62 Check Port Security Is Disabled
63     [Documentation]   Check that there are ports/interfaces in the VDU of the VNF of the NS whose port security was disabled.
64     ${rc}   ${disabled_ports}=   Run And Return RC And Output   osm ns-show ${NS_NAME} --literal | grep -c '${PORT_DISABLED_MSG}'
65     Log   ${rc},${disabled_ports}
66     IF   ${disabled_ports} <= 0   Fail   msg=Found '${disabled_ports}' matches for '${PORT_DISABLED_MSG}'
67
68 Delete NS Instance
69     [Documentation]   Delete NS instance.
70     [Tags]   cleanup
71     Delete NS   ${NS_NAME}
72
73 Delete NS Descriptor
74     [Documentation]   Delete NS package from OSM.
75     [Tags]   cleanup
76     Delete NSD   ${NSD_NAME}
77
78 Delete VNF Descriptor
79     [Documentation]   Delete VNF package from OSM.
80     [Tags]   cleanup
81     Delete VNFD   ${VNFD_NAME}
82
83 Delete VIM
84     [Documentation]   Delete VIM from OSM.
85     [Tags]   cleanup
86     Delete VIM Target   ${VIM_NAME}
87
88
89 *** Keywords ***
90 Suite Preparation
91     [Documentation]   Test Suite Preparation: Setting Prometheus Testsuite Variables
92     Set Testsuite Prometheus Variables
93
94 Suite Cleanup
95     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
96     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
97     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
98     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}
99     Run Keyword If Any Tests Failed   Delete VIM Target   ${VIM_NAME}