Remove regression tag from disabled daily tests
[osm/tests.git] / robot-systest / deprecated / lib / client_lib / client_lib.py
1 ##
2 # Copyright 2019 Tech Mahindra Limited
3 #
4 # All Rights Reserved.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
16 # under the License.
17 ##
18
19
20 from osmclient import client
21 from robot.api import logger
22 import json
23
24
25 class ClientLib:
26 def __init__(self, host="127.0.0.1", user=None, password=None, project=None):
27
28 kwargs = {}
29 if user is not None:
30 kwargs['user'] = user
31 if password is not None:
32 kwargs['password'] = password
33 if project is not None:
34 kwargs['project'] = project
35 self.client = client.Client(host=host, sol005=True, **kwargs)
36
37 def get_vim_list(self):
38 resp = self.client.vim.list()
39 logger.info('VIM List: {}'.format(resp))
40 return json.dumps(resp)
41
42 def create_vim_account(self, name, vim_type, user, password, auth_url, tenant, desc='', config=None):
43 vim_access = {}
44 if config is not None:
45 vim_access['config'] = config
46 vim_access['vim-type'] = vim_type
47 vim_access['vim-username'] = user
48 vim_access['vim-password'] = password
49 vim_access['vim-url'] = auth_url
50 vim_access['vim-tenant-name'] = tenant
51 vim_access['description'] = desc
52
53 resp = self.client.vim.create(name, vim_access)
54 logger.info('Create VIM Account: {}'.format(resp))
55 return json.dumps(resp)
56
57 def delete_vim_account(self, name):
58 resp = self.client.vim.delete(name)
59 return json.dumps(resp)
60
61 def get_vnfd_list(self):
62 resp = self.client.vnfd.list()
63 logger.info('VNF Descriptor List: {}'.format(resp))
64 return json.dumps(resp)
65
66 def get_nsd_list(self):
67 resp = self.client.nsd.list()
68 logger.info('NS Descriptor List: {}'.format(resp))
69 return json.dumps(resp)