Implement client support for multisite VIM
Client side changes for multisite VIM feature including new shell commands. Change-Id: Idae463b0cec40bea2edfde5723f7de5077600040 Implements: blueprint multi-site-vim
This commit is contained in:
@@ -24,6 +24,7 @@ import os
|
|||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import six
|
import six
|
||||||
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
from tackerclient.i18n import _
|
from tackerclient.i18n import _
|
||||||
@@ -171,3 +172,10 @@ def add_boolean_argument(parser, name, **kwargs):
|
|||||||
choices=['True', 'true', 'False', 'false'],
|
choices=['True', 'true', 'False', 'false'],
|
||||||
default=default,
|
default=default,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_url(url):
|
||||||
|
url_parts = urlparse.urlparse(url)
|
||||||
|
if not url_parts.scheme or not url_parts.netloc or not url_parts.port:
|
||||||
|
raise exceptions.TackerClientException(message='Invalid URL')
|
||||||
|
return url_parts
|
||||||
|
@@ -46,6 +46,7 @@ from tackerclient.common import extension as client_extension
|
|||||||
from tackerclient.common import utils
|
from tackerclient.common import utils
|
||||||
from tackerclient.i18n import _
|
from tackerclient.i18n import _
|
||||||
from tackerclient.tacker.v1_0 import extension
|
from tackerclient.tacker.v1_0 import extension
|
||||||
|
from tackerclient.tacker.v1_0.nfvo import vim
|
||||||
from tackerclient.tacker.v1_0.vm import vnf
|
from tackerclient.tacker.v1_0.vm import vnf
|
||||||
from tackerclient.tacker.v1_0.vm import vnfd
|
from tackerclient.tacker.v1_0.vm import vnfd
|
||||||
from tackerclient.version import __version__
|
from tackerclient.version import __version__
|
||||||
@@ -116,6 +117,12 @@ COMMAND_V1 = {
|
|||||||
'vnf-show': vnf.ShowVNF,
|
'vnf-show': vnf.ShowVNF,
|
||||||
# 'vnf-config-create'
|
# 'vnf-config-create'
|
||||||
# 'vnf-config-push'
|
# 'vnf-config-push'
|
||||||
|
|
||||||
|
'vim-register': vim.CreateVIM,
|
||||||
|
'vim-update': vim.UpdateVIM,
|
||||||
|
'vim-delete': vim.DeleteVIM,
|
||||||
|
'vim-list': vim.ListVIM,
|
||||||
|
'vim-show': vim.ShowVIM,
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMANDS = {'1.0': COMMAND_V1}
|
COMMANDS = {'1.0': COMMAND_V1}
|
||||||
|
0
tackerclient/tacker/v1_0/nfvo/__init__.py
Normal file
0
tackerclient/tacker/v1_0/nfvo/__init__.py
Normal file
114
tackerclient/tacker/v1_0/nfvo/vim.py
Normal file
114
tackerclient/tacker/v1_0/nfvo/vim.py
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
# Copyright 2016 Brocade Communications Systems Inc
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from tackerclient.common import exceptions
|
||||||
|
from tackerclient.common import utils
|
||||||
|
from tackerclient.tacker import v1_0 as tackerV10
|
||||||
|
from tackerclient.tacker.v1_0.nfvo import vim_utils
|
||||||
|
|
||||||
|
_VIM = "vim"
|
||||||
|
|
||||||
|
|
||||||
|
class ListVIM(tackerV10.ListCommand):
|
||||||
|
"""List VIMs that belong to a given tenant."""
|
||||||
|
|
||||||
|
resource = _VIM
|
||||||
|
list_columns = ['id', 'name', 'type', 'description', 'auth_url',
|
||||||
|
'placement_attr', 'auth_cred']
|
||||||
|
|
||||||
|
|
||||||
|
class ShowVIM(tackerV10.ShowCommand):
|
||||||
|
"""Show information of a given VIM."""
|
||||||
|
|
||||||
|
resource = _VIM
|
||||||
|
|
||||||
|
|
||||||
|
class CreateVIM(tackerV10.CreateCommand):
|
||||||
|
"""Create a VIM."""
|
||||||
|
|
||||||
|
resource = _VIM
|
||||||
|
|
||||||
|
def add_known_arguments(self, parser):
|
||||||
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
group.add_argument('--config-file', help='specify VIM specific '
|
||||||
|
'config parameters in a file')
|
||||||
|
group.add_argument('--config', help='specify VIM config parameters '
|
||||||
|
'as a direct input')
|
||||||
|
parser.add_argument(
|
||||||
|
'--name',
|
||||||
|
help='Set a name for the vim')
|
||||||
|
parser.add_argument(
|
||||||
|
'--description',
|
||||||
|
help='Set a description for the vim')
|
||||||
|
|
||||||
|
def args2body(self, parsed_args):
|
||||||
|
body = {self.resource: {}}
|
||||||
|
if parsed_args.config_file:
|
||||||
|
with open(parsed_args.config_file) as f:
|
||||||
|
vim_config = f.read()
|
||||||
|
config_param = yaml.load(vim_config)
|
||||||
|
if parsed_args.config:
|
||||||
|
parsed_args.config = parsed_args.config.decode('unicode_escape')
|
||||||
|
config_param = yaml.load(parsed_args.config)
|
||||||
|
vim_obj = body[self.resource]
|
||||||
|
try:
|
||||||
|
auth_url = config_param.pop('auth_url')
|
||||||
|
except KeyError:
|
||||||
|
raise exceptions.TackerClientException(message='Auth URL must be '
|
||||||
|
'specified',
|
||||||
|
status_code=404)
|
||||||
|
vim_obj['auth_url'] = utils.validate_url(auth_url).geturl()
|
||||||
|
vim_utils.args2body_vim(config_param, vim_obj)
|
||||||
|
tackerV10.update_dict(parsed_args, body[self.resource],
|
||||||
|
['tenant_id', 'name', 'description'])
|
||||||
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVIM(tackerV10.UpdateCommand):
|
||||||
|
"""Update a given VIM."""
|
||||||
|
|
||||||
|
resource = _VIM
|
||||||
|
|
||||||
|
def add_known_arguments(self, parser):
|
||||||
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
group.add_argument(
|
||||||
|
'--config-file',
|
||||||
|
help='specify VIM specific config parameters in a file')
|
||||||
|
group.add_argument(
|
||||||
|
'--config',
|
||||||
|
help='specify VIM config parameters as a direct input')
|
||||||
|
|
||||||
|
def args2body(self, parsed_args):
|
||||||
|
body = {self.resource: {}}
|
||||||
|
# config arg passed as data overrides config yaml when both args passed
|
||||||
|
if parsed_args.config_file:
|
||||||
|
with open(parsed_args.config_file) as f:
|
||||||
|
config_yaml = f.read()
|
||||||
|
config_param = yaml.load(config_yaml)
|
||||||
|
if parsed_args.config:
|
||||||
|
parsed_args.config = parsed_args.config.decode('unicode_escape')
|
||||||
|
config_param = yaml.load(parsed_args.config)
|
||||||
|
vim_obj = body[self.resource]
|
||||||
|
vim_utils.args2body_vim(config_param, vim_obj)
|
||||||
|
tackerV10.update_dict(parsed_args, body[self.resource], ['tenant_id'])
|
||||||
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteVIM(tackerV10.DeleteCommand):
|
||||||
|
"""Delete a given VIM."""
|
||||||
|
resource = _VIM
|
36
tackerclient/tacker/v1_0/nfvo/vim_utils.py
Normal file
36
tackerclient/tacker/v1_0/nfvo/vim_utils.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 2016 Brocade Communications Systems Inc
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
from tackerclient.common import exceptions
|
||||||
|
|
||||||
|
|
||||||
|
def args2body_vim(config_param, vim):
|
||||||
|
"""Create additional args to vim body
|
||||||
|
|
||||||
|
:param vim: vim request object
|
||||||
|
:return: vim body with args populated
|
||||||
|
"""
|
||||||
|
vim['vim_project'] = {'id': config_param.pop('project_id', ''),
|
||||||
|
'name': config_param.pop('project_name', '')}
|
||||||
|
if not vim['vim_project']['id'] and not vim['vim_project']['name']:
|
||||||
|
raise exceptions.TackerClientException(message='Project Id or name '
|
||||||
|
'must be specified',
|
||||||
|
status_code=404)
|
||||||
|
vim['type'] = config_param.pop('type', 'openstack')
|
||||||
|
vim['auth_cred'] = {'username': config_param.pop('username', ''),
|
||||||
|
'password': config_param.pop('password', ''),
|
||||||
|
'user_id': config_param.pop('user_id', '')}
|
@@ -27,7 +27,8 @@ class ListVNF(tackerV10.ListCommand):
|
|||||||
"""List device that belong to a given tenant."""
|
"""List device that belong to a given tenant."""
|
||||||
|
|
||||||
resource = _VNF
|
resource = _VNF
|
||||||
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status']
|
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status',
|
||||||
|
'vim_id', 'placement_attr']
|
||||||
|
|
||||||
|
|
||||||
class ShowVNF(tackerV10.ShowCommand):
|
class ShowVNF(tackerV10.ShowCommand):
|
||||||
@@ -46,13 +47,23 @@ class CreateVNF(tackerV10.CreateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--name',
|
'--name',
|
||||||
help='Set a name for the vnf')
|
help='Set a name for the vnf')
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
vnfd_group = parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument(
|
vnfd_group.add_argument(
|
||||||
'--vnfd-id',
|
'--vnfd-id',
|
||||||
help='VNFD ID to use as template to create VNF')
|
help='VNFD ID to use as template to create VNF')
|
||||||
group.add_argument(
|
vnfd_group.add_argument(
|
||||||
'--vnfd-name',
|
'--vnfd-name',
|
||||||
help='VNFD Name to use as template to create VNF')
|
help='VNFD Name to use as template to create VNF')
|
||||||
|
vim_group = parser.add_mutually_exclusive_group()
|
||||||
|
vim_group.add_argument(
|
||||||
|
'--vim-id',
|
||||||
|
help='VIM ID to use to create VNF on the specified VIM')
|
||||||
|
vim_group.add_argument(
|
||||||
|
'--vim-name',
|
||||||
|
help='VIM name to use to create VNF on the specified VIM')
|
||||||
|
parser.add_argument(
|
||||||
|
'--vim-region-name',
|
||||||
|
help='VIM Region to use to create VNF on the specified VIM')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--config-file',
|
'--config-file',
|
||||||
help='specify config yaml file')
|
help='specify config yaml file')
|
||||||
@@ -76,21 +87,30 @@ class CreateVNF(tackerV10.CreateCommand):
|
|||||||
parsed_args.config = parsed_args.config.decode('unicode_escape')
|
parsed_args.config = parsed_args.config.decode('unicode_escape')
|
||||||
args['attributes']['config'] = parsed_args.config
|
args['attributes']['config'] = parsed_args.config
|
||||||
|
|
||||||
if parsed_args.vnfd_name:
|
if parsed_args.vim_region_name:
|
||||||
|
args.setdefault('placement_attr', {})['region_name'] = \
|
||||||
|
parsed_args.vim_region_name
|
||||||
|
|
||||||
tacker_client = self.get_client()
|
tacker_client = self.get_client()
|
||||||
tacker_client.format = parsed_args.request_format
|
tacker_client.format = parsed_args.request_format
|
||||||
|
if parsed_args.vim_name:
|
||||||
_id = tackerV10.find_resourceid_by_name_or_id(
|
_id = tackerV10.find_resourceid_by_name_or_id(tacker_client,
|
||||||
tacker_client, 'vnfd',
|
'vim',
|
||||||
parsed_args.vnfd_name)
|
parsed_args.
|
||||||
|
vim_id)
|
||||||
|
parsed_args.vim_id = _id
|
||||||
|
if parsed_args.vnfd_name:
|
||||||
|
_id = tackerV10.find_resourceid_by_name_or_id(tacker_client,
|
||||||
|
'vnfd',
|
||||||
|
parsed_args.
|
||||||
|
vnfd_name)
|
||||||
parsed_args.vnfd_id = _id
|
parsed_args.vnfd_id = _id
|
||||||
if parsed_args.param_file:
|
if parsed_args.param_file:
|
||||||
with open(parsed_args.param_file) as f:
|
with open(parsed_args.param_file) as f:
|
||||||
param_yaml = f.read()
|
param_yaml = f.read()
|
||||||
args['attributes']['param_values'] = param_yaml
|
args['attributes']['param_values'] = param_yaml
|
||||||
tackerV10.update_dict(parsed_args, body[self.resource],
|
tackerV10.update_dict(parsed_args, body[self.resource],
|
||||||
['tenant_id', 'name', 'vnfd_id'])
|
['tenant_id', 'name', 'vnfd_id', 'vim_id'])
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
@@ -204,7 +204,7 @@ class CLITestV10Base(testtools.TestCase):
|
|||||||
self.mox.StubOutWithMock(cmd, "get_client")
|
self.mox.StubOutWithMock(cmd, "get_client")
|
||||||
self.mox.StubOutWithMock(self.client.httpclient, "request")
|
self.mox.StubOutWithMock(self.client.httpclient, "request")
|
||||||
cmd.get_client().MultipleTimes().AndReturn(self.client)
|
cmd.get_client().MultipleTimes().AndReturn(self.client)
|
||||||
non_admin_status_resources = ['vnfd', 'vnf']
|
non_admin_status_resources = ['vnfd', 'vnf', 'vim']
|
||||||
if (resource in non_admin_status_resources):
|
if (resource in non_admin_status_resources):
|
||||||
body = {resource: {}, }
|
body = {resource: {}, }
|
||||||
else:
|
else:
|
||||||
|
109
tackerclient/tests/unit/vm/test_cli10_vim.py
Normal file
109
tackerclient/tests/unit/vm/test_cli10_vim.py
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# Copyright 2015-2016 Brocade Communications Systems Inc
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from tackerclient.tacker.v1_0.nfvo import vim
|
||||||
|
from tackerclient.tests.unit import test_cli10
|
||||||
|
|
||||||
|
API_VERSION = "1.0"
|
||||||
|
FORMAT = 'json'
|
||||||
|
TOKEN = 'testtoken'
|
||||||
|
ENDURL = 'localurl'
|
||||||
|
|
||||||
|
|
||||||
|
class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
|
||||||
|
_RESOURCE = 'vim'
|
||||||
|
_RESOURCES = 'vims'
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
plurals = {'vims': 'vim'}
|
||||||
|
super(CLITestV10VIMJSON, self).setUp(plurals=plurals)
|
||||||
|
self.vim_project = {'name': 'abc', 'id': ''}
|
||||||
|
self.auth_cred = {'username': 'xyz', 'password': '12345', 'user_id':
|
||||||
|
''}
|
||||||
|
self.auth_url = 'http://1.2.3.4:5000'
|
||||||
|
|
||||||
|
def test_register_vim_all_params(self):
|
||||||
|
cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
my_id = 'my-id'
|
||||||
|
name = 'test_vim'
|
||||||
|
description = 'Vim Description'
|
||||||
|
vim_config = {'auth_url': 'http://1.2.3.4:5000', 'username': 'xyz',
|
||||||
|
'password': '12345', 'project_name': 'abc'}
|
||||||
|
args = [
|
||||||
|
'--config', str(vim_config),
|
||||||
|
'--name', name,
|
||||||
|
'--description', description]
|
||||||
|
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
||||||
|
position_values = [self.auth_cred, self.vim_project, self.auth_url]
|
||||||
|
extra_body = {'type': 'openstack', 'name': name, 'description':
|
||||||
|
description}
|
||||||
|
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||||
|
args, position_names, position_values,
|
||||||
|
extra_body=extra_body)
|
||||||
|
|
||||||
|
def test_register_vim_with_mandatory_params(self):
|
||||||
|
cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
my_id = 'my-id'
|
||||||
|
|
||||||
|
vim_config = {'auth_url': 'http://1.2.3.4:5000', 'username': 'xyz',
|
||||||
|
'password': '12345', 'project_name': 'abc'}
|
||||||
|
args = [
|
||||||
|
'--config', str(vim_config),
|
||||||
|
]
|
||||||
|
position_names = ['auth_cred', 'vim_project', 'auth_url']
|
||||||
|
position_values = [self.auth_cred, self.vim_project, self.auth_url]
|
||||||
|
extra_body = {'type': 'openstack'}
|
||||||
|
self._test_create_resource(self._RESOURCE, cmd, None, my_id, args,
|
||||||
|
position_names, position_values,
|
||||||
|
extra_body=extra_body)
|
||||||
|
|
||||||
|
def test_list_vims(self):
|
||||||
|
cmd = vim.ListVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
self._test_list_resources(self._RESOURCES, cmd, True)
|
||||||
|
|
||||||
|
def test_show_vim_id(self):
|
||||||
|
cmd = vim.ShowVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
args = ['--fields', 'id', self.test_id]
|
||||||
|
self._test_show_resource(self._RESOURCE, cmd, self.test_id, args,
|
||||||
|
['id'])
|
||||||
|
|
||||||
|
def test_show_vim_id_name(self):
|
||||||
|
cmd = vim.ShowVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
args = ['--fields', 'id', '--fields', 'name', self.test_id]
|
||||||
|
self._test_show_resource(self._RESOURCE, cmd, self.test_id,
|
||||||
|
args, ['id', 'name'])
|
||||||
|
|
||||||
|
def test_update_vim(self):
|
||||||
|
cmd = vim.UpdateVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
update_config = {'username': 'xyz', 'password': '12345',
|
||||||
|
'project_name': 'abc'}
|
||||||
|
my_id = 'my-id'
|
||||||
|
key = 'config'
|
||||||
|
value = str(update_config)
|
||||||
|
extra_fields = {'type': 'openstack', 'vim_project':
|
||||||
|
self.vim_project, 'auth_cred': self.auth_cred}
|
||||||
|
self._test_update_resource(self._RESOURCE, cmd, my_id, [my_id,
|
||||||
|
'--%s' %
|
||||||
|
key, value],
|
||||||
|
extra_fields)
|
||||||
|
|
||||||
|
def test_delete_vim(self):
|
||||||
|
cmd = vim.DeleteVIM(test_cli10.MyApp(sys.stdout), None)
|
||||||
|
my_id = 'my-id'
|
||||||
|
args = [my_id]
|
||||||
|
self._test_delete_resource(self._RESOURCE, cmd, my_id, args)
|
@@ -17,6 +17,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mox
|
import mox
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@@ -96,15 +97,20 @@ class CLITestV10VmVNFJSON(test_cli10.CLITestV10Base):
|
|||||||
cmd = vnf.CreateVNF(test_cli10.MyApp(sys.stdout), None)
|
cmd = vnf.CreateVNF(test_cli10.MyApp(sys.stdout), None)
|
||||||
my_id = 'my-id'
|
my_id = 'my-id'
|
||||||
vnfd_id = 'vnfd'
|
vnfd_id = 'vnfd'
|
||||||
|
vim_id = 'vim_id'
|
||||||
|
region_name = 'region'
|
||||||
key = 'key'
|
key = 'key'
|
||||||
value = 'value'
|
value = 'value'
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'--vnfd-id', vnfd_id,
|
'--vnfd-id', vnfd_id,
|
||||||
|
'--vim-id', vim_id,
|
||||||
|
'--vim-region-name', region_name,
|
||||||
'--%s' % key, value]
|
'--%s' % key, value]
|
||||||
position_names = ['vnfd_id', 'attributes']
|
position_names = ['vnfd_id', 'vim_id', 'attributes']
|
||||||
position_values = [vnfd_id, {}]
|
position_values = [vnfd_id, vim_id, {}]
|
||||||
extra_body = {key: value}
|
extra_body = {key: value, 'placement_attr': {'region_name':
|
||||||
|
region_name}}
|
||||||
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||||
args, position_names, position_values,
|
args, position_names, position_values,
|
||||||
extra_body=extra_body)
|
extra_body=extra_body)
|
||||||
|
@@ -28,7 +28,6 @@ from tackerclient.common import serializer
|
|||||||
from tackerclient.common import utils
|
from tackerclient.common import utils
|
||||||
from tackerclient.i18n import _
|
from tackerclient.i18n import _
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
DEFAULT_DESC_LENGTH = 25
|
DEFAULT_DESC_LENGTH = 25
|
||||||
|
|
||||||
@@ -339,6 +338,9 @@ class Client(ClientBase):
|
|||||||
vnfs_path = '/vnfs'
|
vnfs_path = '/vnfs'
|
||||||
vnf_path = '/vnfs/%s'
|
vnf_path = '/vnfs/%s'
|
||||||
|
|
||||||
|
vims_path = '/vims'
|
||||||
|
vim_path = '/vims/%s'
|
||||||
|
|
||||||
# API has no way to report plurals, so we have to hard code them
|
# API has no way to report plurals, so we have to hard code them
|
||||||
# EXTED_PLURALS = {}
|
# EXTED_PLURALS = {}
|
||||||
|
|
||||||
@@ -405,3 +407,25 @@ class Client(ClientBase):
|
|||||||
@APIParamsCall
|
@APIParamsCall
|
||||||
def update_vnf(self, vnf, body=None):
|
def update_vnf(self, vnf, body=None):
|
||||||
return self.put(self.vnf_path % vnf, body=body)
|
return self.put(self.vnf_path % vnf, body=body)
|
||||||
|
|
||||||
|
@APIParamsCall
|
||||||
|
def show_vim(self, vim, **_params):
|
||||||
|
return self.get(self.vim_path % vim, params=_params)
|
||||||
|
|
||||||
|
_VIM = "vim"
|
||||||
|
|
||||||
|
@APIParamsCall
|
||||||
|
def create_vim(self, body=None):
|
||||||
|
return self.post(self.vims_path, body=body)
|
||||||
|
|
||||||
|
@APIParamsCall
|
||||||
|
def delete_vim(self, vim):
|
||||||
|
return self.delete(self.vim_path % vim)
|
||||||
|
|
||||||
|
@APIParamsCall
|
||||||
|
def update_vim(self, vim, body=None):
|
||||||
|
return self.put(self.vim_path % vim, body=body)
|
||||||
|
|
||||||
|
@APIParamsCall
|
||||||
|
def list_vims(self, retrieve_all=True, **_params):
|
||||||
|
return self.list('vims', self.vims_path, retrieve_all, **_params)
|
||||||
|
Reference in New Issue
Block a user