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
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 Documentation Library to deploy and delete OSM repos.
18 Library OperatingSystem
20 Resource ../lib/nsd_lib.resource
24 ${SUCCESS_RETURN_CODE} 0
25 ${REPO_DELETE_MAX_WAIT_TIME} 1min
26 ${REPO_DELETE_POL_TIME} 15sec
31 [Documentation] Get the list of repos and log it.
32 ${rc} ${stdout}= Run And Return RC And Output osm repo-list
34 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
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}
43 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
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}
52 WAIT UNTIL KEYWORD SUCCEEDS ${REPO_DELETE_MAX_WAIT_TIME} ${REPO_DELETE_POL_TIME} Check For NSD ${repo_id}
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}
59 Should Not Be Equal As Strings ${stdout} ${repo_id}