Adding testcase for create and delete VIM
Closes-Bug: #1558319 Depends-On: I7dd19a0c1ce948474bb3069073b3608ce265beb4 Change-Id: If701b4434ee5a24baa8bb0abff052e8e6a1bf418
This commit is contained in:
parent
189d562db6
commit
28136ae1fd
|
@ -0,0 +1,4 @@
|
|||
auth_url: http://127.0.0.1:5000
|
||||
username: nfv_user
|
||||
password: devstack
|
||||
project_name: nfv
|
|
@ -118,3 +118,14 @@ class BaseTackerTest(base.TestCase):
|
|||
constants.ACTIVE_SLEEP_TIME)
|
||||
self.assertEqual(vnf_current_status, 'ACTIVE')
|
||||
self.validate_vnf_instance(vnfd_instance, vnf_instance)
|
||||
|
||||
def verify_vim(self, vim_instance, config_data, name, description):
|
||||
self.assertIsNotNone(vim_instance)
|
||||
self.assertEqual(vim_instance['vim']['description'], description)
|
||||
self.assertEqual(vim_instance['vim']['name'], name)
|
||||
self.assertIsNotNone(vim_instance['vim']['tenant_id'])
|
||||
self.assertIsNotNone(vim_instance['vim']['id'])
|
||||
self.assertEqual(vim_instance['vim']['auth_cred']['username'],
|
||||
config_data['username'])
|
||||
self.assertEqual(vim_instance['vim']['auth_cred']['project_name'],
|
||||
config_data['project_name'])
|
|
@ -0,0 +1,59 @@
|
|||
# Copyright 2016 Brocade Communications System, Inc.
|
||||
#
|
||||
# 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 tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class VimTestCreate(base.BaseTackerTest):
|
||||
def _test_create_delete_vim(self, vim_file, name,
|
||||
description, vim_type):
|
||||
data = dict()
|
||||
data = yaml.load(read_file(vim_file))
|
||||
|
||||
password = data['password']
|
||||
username = data['username']
|
||||
project_name = data['project_name']
|
||||
auth_url = data['auth_url']
|
||||
vim_arg = {'vim': {'name': name, 'description': description,
|
||||
'type': vim_type,
|
||||
'auth_url': auth_url,
|
||||
'auth_cred': {'username': username,
|
||||
'password': password},
|
||||
'vim_project': {'name': project_name}}}
|
||||
|
||||
# Register vim
|
||||
vim_instance = self.client.create_vim(vim_arg)
|
||||
vim_id = vim_instance['vim']['id']
|
||||
self.verify_vim(vim_instance, data, name, description)
|
||||
|
||||
# Read vim
|
||||
vim_instance_show = self.client.show_vim(vim_id)
|
||||
self.verify_vim(vim_instance_show, data, name, description)
|
||||
|
||||
# Delete vim
|
||||
try:
|
||||
self.client.delete_vim(vim_id)
|
||||
except Exception:
|
||||
assert False, ("Failed to delete vim %s" %
|
||||
vim_id)
|
||||
|
||||
def test_create_delete_local_vim(self):
|
||||
name = 'Default vim'
|
||||
description = 'Local vim description'
|
||||
vim_type = 'openstack'
|
||||
self._test_create_delete_vim(
|
||||
'local-vim.yaml', name, description, vim_type)
|
|
@ -15,7 +15,7 @@
|
|||
from oslo_config import cfg
|
||||
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from oslo_config import cfg
|
|||
|
||||
from tacker.common import utils
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
from tacker.vm.tosca import utils as toscautils
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from oslo_config import cfg
|
||||
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from oslo_config import cfg
|
|||
|
||||
from tacker.common import utils
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
import yaml
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
from tacker.tests import constants
|
||||
from tacker.tests.functional.vnfm import base
|
||||
from tacker.tests.functional import base
|
||||
from tacker.tests.utils import read_file
|
||||
|
||||
import yaml
|
||||
|
|
Loading…
Reference in New Issue