blob: a52354fcf07c68d06db074212aeeb83648f1b2c7 [file] [log] [blame]
yadavmr58af6b12019-09-18 15:33:25 +05301# -*- 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
26*** Keywords ***
27Create Vim
28 [Arguments] ${vim_name} ${account_type} ${auth_url} ${user} ${password} ${tenant} ${description}
29
30 &{request_data}= Create Dictionary vim_user=${user} vim_password=${password} vim_url=${auth_url} vim_tenant_name=${tenant} vim_type=${account_type} description=${description} name=${vim_name}
31
32 &{headers}= Create Dictionary Authorization=Bearer ${token} Content-Type=application/json Accept=application/json
33
34 Create Session osmvim ${HOST} verify=${FALSE} headers=${headers}
35
36 LOG ${request_data}
37 ${res}= Post Request osmvim ${create_vim_uri} data=${request_data}
38 log ${res.content}
39 Pass Execution If ${res.status_code} in ${success_status_code_list} Create Vim Request completed
40 Get Vim ID ${res.content}
41
42
43Delete Vim
44 [Arguments] ${vim_id}
45
46 ${uri} = Catenate SEPARATOR=/ ${create_vim_uri} ${vim_id}
47 ${resp}= Delete Request osmvim ${uri}
48
49 log ${resp.content}
50 Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete Vim Request completed
51
52
53Get Vim ID
54 [Arguments] ${res}
55
56# log to console ${res}
57 ${content}= To Json ${res}
58 ${id}= Get From Dictionary ${content} id
59 Set Suite Variable ${vim_id} ${id}
60 log Vim Id is ${vim_id}