aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-28 09:55:27 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-28 09:55:27 +0100
commitd30a79ce464a596a29cb1385b88dd00ac42a2c61 (patch)
tree7209b9dd6e16be8cd2f2b1637e0e6a0e0f0ace35
parent2aab5c48df64b044ab9bae6e883e6e0acaabbf52 (diff)
Remove all OpenStack operations in vnf.py
Change-Id: I356305f3c59b51f97f5fb1335369834a77fda9b1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--api/requirements.txt3
-rw-r--r--requirements.txt19
-rw-r--r--xtesting/core/vnf.py42
-rw-r--r--xtesting/tests/unit/core/test_vnf.py53
4 files changed, 5 insertions, 112 deletions
diff --git a/api/requirements.txt b/api/requirements.txt
deleted file mode 100644
index 0d38313b..00000000
--- a/api/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
-sphinx>=1.6.2 # BSD
-sphinx-rtd-theme
diff --git a/requirements.txt b/requirements.txt
index 86d4b9a0..54e5d883 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,26 +3,9 @@
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
PyYAML>=3.10.0 # MIT
-GitPython>=1.0.1 # BSD License (3 clause)
+enum34;python_version=='2.7' or python_version=='2.6' or python_version=='3.3' # BSD
requests>=2.14.2 # Apache-2.0
robotframework>=3.0
-scp
-dnspython>=1.14.0;python_version=='2.7' # http://www.dnspython.org/LICENSE
-dnspython3!=1.13.0,!=1.14.0,>=1.12.0;python_version>='3.0' # http://www.dnspython.org/LICENSE
-click
-openbaton-cli
-cloudify-rest-client
-Flask!=0.11,<1.0,>=0.10 # BSD
-Flask-RESTful>=0.3.5 # BSD
-IPy
-flasgger # MIT
mock>=2.0 # BSD
PrettyTable<0.8,>=0.7.1 # BSD
six>=1.9.0 # MIT
-snaps
-SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
-paramiko>=2.0 # LGPLv2.1+
-Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause)
-httplib2>=0.7.5 # MIT
-oslo.serialization!=2.19.1,>=1.10.0 # Apache-2.0
-oslo.utils>=3.20.0 # Apache-2.0
diff --git a/xtesting/core/vnf.py b/xtesting/core/vnf.py
index 95ebde04..8aab2337 100644
--- a/xtesting/core/vnf.py
+++ b/xtesting/core/vnf.py
@@ -13,14 +13,7 @@ import logging
import time
import uuid
-from snaps.config.user import UserConfig
-from snaps.config.project import ProjectConfig
-from snaps.openstack.create_user import OpenStackUser
-from snaps.openstack.create_project import OpenStackProject
-from snaps.openstack.tests import openstack_tests
-
from xtesting.core import testcase
-from xtesting.utils import constants
__author__ = ("Morgan Richomme <morgan.richomme@orange.com>, "
"Valentin Boucher <valentin.boucher@orange.com>")
@@ -97,43 +90,12 @@ class VnfOnBoarding(testcase.TestCase):
"""
Prepare the environment for VNF testing:
- * Creation of a user,
- * Creation of a tenant,
- * Allocation admin role to the user on this tenant
-
Returns base.TestCase.EX_OK if preparation is successfull
Raise VnfPreparationException in case of problem
"""
- try:
- self.__logger.info(
- "Prepare VNF: %s, description: %s", self.case_name,
- self.tenant_description)
- snaps_creds = openstack_tests.get_credentials(
- os_env_file=constants.ENV_FILE)
-
- self.os_project = OpenStackProject(
- snaps_creds,
- ProjectConfig(
- name=self.tenant_name,
- description=self.tenant_description
- ))
- self.os_project.create()
- self.created_object.append(self.os_project)
- user_creator = OpenStackUser(
- snaps_creds,
- UserConfig(
- name=self.user_name,
- password=str(uuid.uuid4()),
- roles={'admin': self.tenant_name}))
- user_creator.create()
- self.created_object.append(user_creator)
- self.snaps_creds = user_creator.get_os_creds(self.tenant_name)
-
- return testcase.TestCase.EX_OK
- except Exception: # pylint: disable=broad-except
- self.__logger.exception("Exception raised during VNF preparation")
- raise VnfPreparationException
+ self.__logger.exception("VNF must be prepared")
+ raise VnfPreparationException
def deploy_orchestrator(self):
"""
diff --git a/xtesting/tests/unit/core/test_vnf.py b/xtesting/tests/unit/core/test_vnf.py
index ec8a783e..34380a69 100644
--- a/xtesting/tests/unit/core/test_vnf.py
+++ b/xtesting/tests/unit/core/test_vnf.py
@@ -16,9 +16,6 @@ import mock
from xtesting.core import vnf
from xtesting.core import testcase
-from xtesting.utils import constants
-
-from snaps.openstack.os_credentials import OSCreds
class VnfBaseTesting(unittest.TestCase):
@@ -107,45 +104,9 @@ class VnfBaseTesting(unittest.TestCase):
return_value=True):
self.assertEqual(self.test.run(), testcase.TestCase.EX_OK)
- @mock.patch('xtesting.core.vnf.OpenStackUser')
- @mock.patch('xtesting.core.vnf.OpenStackProject')
- @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials',
- side_effect=Exception)
- def test_prepare_exc1(self, *args):
- with self.assertRaises(Exception):
- self.test.prepare()
- args[0].assert_called_with(os_env_file=constants.ENV_FILE)
- args[1].assert_not_called()
- args[2].assert_not_called()
-
- @mock.patch('xtesting.core.vnf.OpenStackUser')
- @mock.patch('xtesting.core.vnf.OpenStackProject', side_effect=Exception)
- @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials')
- def test_prepare_exc2(self, *args):
- with self.assertRaises(Exception):
- self.test.prepare()
- args[0].assert_called_with(os_env_file=constants.ENV_FILE)
- args[1].assert_called_with(mock.ANY, mock.ANY)
- args[2].assert_not_called()
-
- @mock.patch('xtesting.core.vnf.OpenStackUser', side_effect=Exception)
- @mock.patch('xtesting.core.vnf.OpenStackProject')
- @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials')
- def test_prepare_exc3(self, *args):
- with self.assertRaises(Exception):
+ def test_prepare(self):
+ with self.assertRaises(vnf.VnfPreparationException):
self.test.prepare()
- args[0].assert_called_with(os_env_file=constants.ENV_FILE)
- args[1].assert_called_with(mock.ANY, mock.ANY)
- args[2].assert_called_with(mock.ANY, mock.ANY)
-
- @mock.patch('xtesting.core.vnf.OpenStackUser')
- @mock.patch('xtesting.core.vnf.OpenStackProject')
- @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials')
- def test_prepare_default(self, *args):
- self.assertEqual(self.test.prepare(), testcase.TestCase.EX_OK)
- args[0].assert_called_with(os_env_file=constants.ENV_FILE)
- args[1].assert_called_with(mock.ANY, mock.ANY)
- args[2].assert_called_with(mock.ANY, mock.ANY)
def test_deploy_vnf_unimplemented(self):
with self.assertRaises(vnf.VnfDeploymentException):
@@ -158,16 +119,6 @@ class VnfBaseTesting(unittest.TestCase):
def test_deploy_orch_unimplemented(self):
self.assertTrue(self.test.deploy_orchestrator())
- @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials',
- return_value=OSCreds(
- username='user', password='pass',
- auth_url='http://foo.com:5000/v3', project_name='bar'),
- side_effect=Exception)
- def test_prepare_keystone_client_ko(self, *args):
- with self.assertRaises(vnf.VnfPreparationException):
- self.test.prepare()
- args[0].assert_called_once()
-
def test_vnf_clean_exc(self):
obj = mock.Mock()
obj.clean.side_effect = Exception