Robot Test: Include SDNC create/delete account using osm cli
[osm/devops.git] / robot-systest / lib / cli / nsd_lib.robot
1 # -*- coding: utf-8 -*-
2
3 ##
4 # Copyright 2019 Tech Mahindra Limited
5 #
6 # All Rights Reserved.
7 #
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
11 #
12 #         http://www.apache.org/licenses/LICENSE-2.0
13 #
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
18 # under the License.
19 ##
20
21 ## Change log:
22 # 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019
23 ##
24
25 *** Variables ***
26 ${success_return_code}    0
27 ${delete_max_wait_time}    1min
28 ${delete_pol_time}    15sec
29
30
31 *** Keywords ***
32 Get NSDs List
33     [Documentation]  Get nsds list
34
35     ${rc}   ${stdout}=      Run and Return RC and Output            osm nsd-list
36     log     ${stdout}
37     Should Be Equal As Integers         ${rc}     ${success_return_code}
38
39
40 Create NSD
41     [Documentation]  Create nsd at osm
42     [Arguments]  ${nsd_pkg}
43
44     ${rc}   ${stdout}=      Run and Return RC and Output            osm nsd-create ${nsd_pkg}
45     log     ${stdout}
46     Should Be Equal As Integers         ${rc}     ${success_return_code}
47     [Return]  ${stdout}
48
49
50 Delete NSD
51     [Documentation]  Delete nsd
52     [Arguments]  ${nsd_id}
53
54     ${rc}   ${stdout}=      Run and Return RC and Output            osm nsd-delete ${nsd_id}
55     log     ${stdout}
56     Should Be Equal As Integers         ${rc}     ${success_return_code}
57     WAIT UNTIL KEYWORD SUCCEEDS    ${delete_max_wait_time}   ${delete_pol_time}   Check For NSD   ${nsd_id}
58
59
60 Check For NSD
61     [Arguments]  ${nsd_id}
62
63     ${rc}   ${stdout}=      Run and Return RC and Output            osm nsd-list
64     log     ${stdout}
65     Should Be Equal As Integers         ${rc}     ${success_return_code}
66     Should Not Contain      ${stdout}   ${nsd_id}
67
68
69 Force Delete NSD
70     [Documentation]  Forcely Delete nsd
71     [Arguments]  ${nsd_id}
72
73     ${rc}   ${stdout}=      Run and Return RC and Output            osm nsd-delete ${nsd_id}
74     log     ${stdout}
75     Should Be Equal As Integers         ${rc}   ${success_return_code}
76
77
78 Build NS Descriptor
79     [Documentation]  Build NS Descriptor from the descriptor-packages
80     [Arguments]  ${nsd path}
81
82     ${rc}   ${stdout}=      Run and Return RC and Output            make -C '${CURDIR}${/}../../..${nsd path}'
83     log     ${stdout}
84     Should Be Equal As Integers         ${rc}   ${success_return_code}