1 # -*- coding: utf-8 -*-
4 # Copyright 2020 Tech Mahindra Limited
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
20 # Author: Mrityunjay Yadav <MY00514913@techmahindra.com>, Jayant Madavi
25 Documentation Test Suite to test disable network port security NS
26 Library OperatingSystem
29 Resource ../../lib/cli/vnfd_lib.robot
30 Resource ../../lib/cli/nsd_lib.robot
31 Resource ../../lib/cli/ns_lib.robot
32 Resource ../../lib/cli/vim_account_lib.robot
33 Library ../../lib/custom_lib.py
34 Variables ../../resource/cli/disable_port_security_ns_data.py
36 Suite Teardown Run Keyword And Ignore Error Test Cleanup
48 [Tags] disable_port_security comprehensive
50 Build VNF Descriptor ${vnfdPckgPath}
51 ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}'
52 Append To List ${vnfd_ids} ${vnfd_id}
56 [Tags] disable_port_security comprehensive
58 Build NS Descriptor ${nsdPckgPath}
59 ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}'
60 Append To List ${nsd_ids} ${nsd_id}
63 Network Service Instance Test
64 [Documentation] Launch and terminate network services
65 [Tags] disable_port_security comprehensive
67 :FOR ${vim_name} IN @{vim}
68 \ Launch Network Services and Return ${vim_name}
72 [Tags] disable_port_security comprehensive
74 :FOR ${ns} IN @{ns_ids}
75 \ Check For Network Port Security ${ns}
78 Delete NS Instance Test
79 [Tags] disable_port_security comprehensive
81 :FOR ${ns} IN @{ns_ids}
85 Delete NS Descriptor Test
86 [Tags] disable_port_security comprehensive
88 :FOR ${nsd} IN @{nsd_ids}
92 Delete VNF Descriptor Test
93 [Tags] disable_port_security comprehensive
95 :FOR ${vnfd_id} IN @{vnfd_ids}
96 \ Delete VNFD ${vnfd_id}
100 Check For Network Port Security
101 [Arguments] ${ns_name}
102 ${rc} ${network_id}= Run and Return RC and Output openstack network list | grep ${ns_name} | awk '{print $2}'
104 ${rc} ${stdout}= Run and Return RC and Output openstack network show ${network_id} -f json | jq '.port_security_enabled'
106 Should Be Equal As Strings ${stdout} true
110 [Documentation] Test Suit Cleanup: Deliting Descriptor, instance and vim
112 :FOR ${ns} IN @{ns_ids}
115 :FOR ${nsd} IN @{nsd_ids}
118 :FOR ${vnfd} IN @{vnfd_ids}
119 \ Delete VNFD ${vnfd}
121 # :FOR ${vim_id} IN @{vim}
122 # \ Delete Vim Account ${vim_id}