diff options
author | Tim Rozet <trozet@redhat.com> | 2017-09-12 17:32:56 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2017-11-06 04:35:02 +0000 |
commit | b3c610b205f88dddb02cdac39638c52eafaaf82c (patch) | |
tree | 4826027e2d968e61c8024d972f3665ff3a8a09d7 /apex/tests/test_apex_network_data.py | |
parent | 3c7556eb0734706f28588fb952eedea2d424c6d2 (diff) |
Adds ability to deploy from upstream openstack
To deploy with upstream openstack branch, use new deploy setting 'os_version'.
A default scenario file for nosdn with pike has been included in this patch.
If 'os_version' is a version other than the default version for this OPNFV
release, then upstream is used.
In order to use upstream with the current OS version use '--upstream'
argument to the deploy command, to force an upstream deployment.
Also include '-e upstream-environment.yaml' to use default upstream
deployment settings.
Supports nosdn and odl-nofeature deployments.
Change-Id: Ic07e308827b449637b4e86cdd086434e4de2fb69
Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'apex/tests/test_apex_network_data.py')
-rw-r--r-- | apex/tests/test_apex_network_data.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/apex/tests/test_apex_network_data.py b/apex/tests/test_apex_network_data.py new file mode 100644 index 00000000..9197e1a8 --- /dev/null +++ b/apex/tests/test_apex_network_data.py @@ -0,0 +1,76 @@ +############################################################################## +# Copyright (c) 2017 Tim Rozet (Red Hat) +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import os + +from nose.tools import ( + assert_equal, + assert_is_instance, + assert_raises +) + +from apex.common.constants import ( + EXTERNAL_NETWORK, + STORAGE_NETWORK, + ADMIN_NETWORK, +) +from apex import NetworkSettings +from apex.network import network_data +from apex.settings.network_settings import NetworkSettingsException +from apex.tests.constants import TEST_CONFIG_DIR + +files_dir = os.path.join(TEST_CONFIG_DIR, 'network') + +REQUIRED_KEYS = [ + 'name', + 'vip', + 'name_lower', + 'enabled' +] + + +class TestNetworkData: + @classmethod + def setup_class(cls): + """This method is run once for each class before any tests are run""" + + @classmethod + def teardown_class(cls): + """This method is run once for each class _after_ all tests are run""" + + def setup(self): + """This method is run once before _each_ test method is executed""" + + def teardown(self): + """This method is run once after _each_ test method is executed""" + + def test_create_network_data(self): + ns = NetworkSettings(os.path.join(files_dir, 'network_settings.yaml')) + output = network_data.create_network_data(ns) + assert_is_instance(output, list) + # TODO(trozet) change this back to 4 after OOO bug is fixed + assert len(output) is 5 + for net in output: + assert_is_instance(net, dict) + for key in REQUIRED_KEYS: + assert key in net + if key == 'vip' or key == 'enabled': + assert_is_instance(net[key], bool) + else: + assert net[key] is not None + + def test_negative_create_network_data(self): + assert_raises(network_data.NetworkDataException, + network_data.create_network_data, 'blah') + + def test_create_network_data_with_write(self): + ns = NetworkSettings(os.path.join(files_dir, 'network_settings.yaml')) + network_data.create_network_data(ns, '/tmp/blah_network_data.yaml') + assert os.path.isfile('/tmp/blah_network_data.yaml') + os.remove('/tmp/blah_network_data.yaml') |