Revert "Feature 11001: Robot framework linting for E2E tests"
[osm/tests.git] / robot-systest / lib / repo_lib.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   Library to deploy and delete OSM repos.
15
16
17 *** Variables ***
18 ${success_return_code}   0
19
20 *** Keywords ***
21 Get Repos List
22     ${rc}   ${stdout}=   Run and Return RC and Output   osm repo-list
23     Log   ${stdout}
24     Should Be Equal As Integers   ${rc}   ${success_return_code}
25
26
27 Create Repo
28     [Arguments]   ${repo_name}   ${repo_uri}   ${repo_type}   ${user}   ${password}   ${additional_options}=""
29
30     ${user_attr}   Set Variable If   '${user}'!='${EMPTY}'   --user ${user}   \
31     ${password_attr}   Set Variable If   '${password}'!='${EMPTY}'   --password ${password}   \
32
33     ${rc}   ${stdout}=   Run and Return RC and Output   osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri}
34     Log   ${stdout}
35     Should Be Equal As Integers   ${rc}   ${success_return_code}
36     [Return]   ${stdout}
37
38
39 Delete Repo
40     [Arguments]   ${repo_id}
41
42     ${rc}   ${stdout}=   Run Keyword And Continue On Failure   Run and Return RC and Output   osm repo-delete ${repo_id}
43     Should Be Equal As Integers   ${rc}   ${success_return_code}
44     Log   ${stdout}
45     WAIT UNTIL KEYWORD SUCCEEDS   ${delete_max_wait_time}   ${delete_pol_time}   Check For NSD   ${repo_id}
46
47
48 Check For Repo
49     [Arguments]   ${repo_id}
50
51     ${rc}   ${stdout}=   Run and Return RC and Output   osm repo-list | awk '{print $2}' | grep ${repo_id}
52     Should Not Be Equal As Strings   ${stdout}   ${repo_id}