blob: 40132d77188c5a659d36bf98380546071ae2e919 [file] [log] [blame]
Felipe Vicensf96bb452020-06-22 08:12:30 +02001# -*- 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*** Settings ***
26Library String
27
28
29*** Variables ***
30${success_return_code} 0
31${delete_max_wait_time} 1min
32${delete_pol_time} 15sec
33
34
35*** Keywords ***
36Get NSDs List
garciadeblasf70f5362020-09-29 15:38:47 +000037 ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list
garciadeblas321726f2022-12-21 11:43:06 +010038 Log ${stdout}
Felipe Vicensf96bb452020-06-22 08:12:30 +020039 Should Be Equal As Integers ${rc} ${success_return_code}
40
41
42Create NSD
43 [Arguments] ${nsd_pkg}
44
garciadeblasf70f5362020-09-29 15:38:47 +000045 ${rc} ${stdout}= Run and Return RC and Output osm nspkg-create ${nsd_pkg}
garciadeblas321726f2022-12-21 11:43:06 +010046 Log ${stdout}
Felipe Vicensf96bb452020-06-22 08:12:30 +020047 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020048 ${lines}= Get Line Count ${stdout}
49 ${last}= Evaluate ${lines} - 1
50 ${id}= Get Line ${stdout} ${last}
51 [Return] ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020052
53
54Delete NSD
55 [Arguments] ${nsd_id}
56
garciadeblasf70f5362020-09-29 15:38:47 +000057 ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm nspkg-delete ${nsd_id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020058 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblas321726f2022-12-21 11:43:06 +010059 Log ${stdout}
Felipe Vicensf96bb452020-06-22 08:12:30 +020060 WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${nsd_id}
61
62
63Check For NSD
64 [Arguments] ${nsd_id}
65
garciadeblasf70f5362020-09-29 15:38:47 +000066 ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020067 Should Not Be Equal As Strings ${stdout} ${nsd_id}