Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / lib / repo_lib.resource
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   Library to deploy and delete OSM repos.
17
18 Library   OperatingSystem
19
20 Resource   ../lib/nsd_lib.resource
21
22
23 *** Variables ***
24 ${SUCCESS_RETURN_CODE}   0
25 ${REPO_DELETE_MAX_WAIT_TIME}   1min
26 ${REPO_DELETE_POL_TIME}   15sec
27
28
29 *** Keywords ***
30 Get Repos List
31     [Documentation]   Get the list of repos and log it.
32     ${rc}   ${stdout}=   Run And Return RC And Output   osm repo-list
33     Log   ${stdout}
34     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
35
36 Create Repo
37     [Documentation]   Create a repository in OSM with the name and options passed as arguments, and return the repo id.
38     [Arguments]   ${repo_name}   ${repo_uri}   ${repo_type}   ${user}   ${password}   ${additional_options}=""
39     ${user_attr}=   Set Variable If   '${user}'!='${EMPTY}'   --user ${user}   \
40     ${password_attr}=   Set Variable If   '${password}'!='${EMPTY}'   --password ${password}   \
41     ${rc}   ${stdout}=   Run And Return RC And Output   osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri}
42     Log   ${rc},${stdout}
43     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
44     RETURN   ${stdout}
45
46 Delete Repo
47     [Documentation]   Delete from OSM the repo passed as argument.
48     [Arguments]   ${repo_id}
49     ${rc}   ${stdout}=   Run Keyword And Continue On Failure   Run And Return RC And Output   osm repo-delete ${repo_id}
50     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
51     Log   ${stdout}
52     WAIT UNTIL KEYWORD SUCCEEDS   ${REPO_DELETE_MAX_WAIT_TIME}   ${REPO_DELETE_POL_TIME}   Check For NSD   ${repo_id}
53
54 Check For Repo
55     [Documentation]   Check that a repository exists in OSM.
56     [Arguments]   ${repo_id}
57     ${rc}   ${stdout}=   Run And Return RC And Output   osm repo-list | awk '{print $2}' | grep ${repo_id}
58     Log   ${rc},${stdout}
59     Should Not Be Equal As Strings   ${stdout}   ${repo_id}