Revert "Feature 11001: Robot framework linting for E2E tests"
[osm/tests.git] / robot-systest / testsuite / lcmop_01-cancel_operation_basic.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   [LCMOP_01] Cancel an ongoing NS operation
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   Process
20 Library   SSHLibrary
21
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_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/connectivity_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27
28 Force Tags   lcmop_01   cluster_lcmop   daily
29
30 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
31
32
33 *** Variables ***
34 # NS and VNF descriptor package folder and ids
35 ${vnfd_pkg}   simple_ee_vnf
36 ${vnfd_name}   simple_ee-vnf
37 ${nsd_pkg}   simple_ee_ns
38 ${nsd_name}   simple_ee-ns
39
40 # NS instance name and configuration
41 ${ns_name}   lcmop_01_cancel_operation_basic
42 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43
44
45 *** Test Cases ***
46 Create VNF Descriptor
47     [Documentation]   Create the VNF descriptor
48
49     ${id}=   Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
50     Set Suite Variable   ${vnfd_id}   ${id}
51
52
53 Create NS Descriptor
54     [Documentation]   Create the NS descriptor
55
56     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
57
58
59 Instantiate Network Service
60     [Documentation]   Instantiate the Network service
61
62     ${id}=   Instantiate Network Service   ${ns_name}   ${nsd_name}   %{VIM_TARGET}   --config '${ns_config}'
63     Set Suite Variable   ${ns_id}   ${id}
64
65
66 Get operation ID
67     [Documentation]   Obtain the operation ID of the NS instantiation
68
69     ${id}=   Get Operations By Type   ${ns_id}   instantiate
70     Set Suite Variable   ${op_id}   ${id}
71
72
73 Cancel operation
74     [Documentation]   Cancel the ongoing NS instantiation
75
76     Sleep   5s   Waiting before cancelling the operation
77     Cancel operation By Id   ${op_id}
78
79
80 Check that operation is cancelled
81     [Documentation]   Check that the operation is succesfully cancelled
82
83     Check For NS Operation Cancelled   ${op_id}
84
85
86 Delete NS Instance Test
87     [Documentation]   Delete the cancelled NS instance
88     [Tags]   cleanup
89
90     Delete NS   ${ns_name}
91
92
93 Delete NS Descriptor Test
94     [Documentation]   Delete the NS descriptor
95     [Tags]   cleanup
96
97     Delete NSD   ${nsd_name}
98
99
100 Delete VNF Descriptor Test
101     [Documentation]   Delete the VNF descriptor
102     [Tags]   cleanup
103
104     Delete VNFD   ${vnfd_name}
105
106
107 *** Keywords ***
108 Suite Cleanup
109     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
110
111     Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
112
113     Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
114
115     Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}