diff options
-rw-r--r-- | apex/common/constants.py | 3 | ||||
-rw-r--r-- | apex/overcloud/deploy.py | 13 | ||||
-rw-r--r-- | apex/tests/test_apex_overcloud_deploy.py | 51 |
3 files changed, 47 insertions, 20 deletions
diff --git a/apex/common/constants.py b/apex/common/constants.py index e9c99a34..0d71e6e3 100644 --- a/apex/common/constants.py +++ b/apex/common/constants.py @@ -70,6 +70,9 @@ VALID_DOCKER_SERVICES = { DOCKERHUB_OOO = 'https://registry.hub.docker.com/v2/repositories' \ '/tripleomaster/' KUBESPRAY_URL = 'https://github.com/kubernetes-incubator/kubespray.git' +OPNFV_ARTIFACTS = 'http://artifacts.opnfv.org' +CUSTOM_OVS = '{}/apex/random/openvswitch-2.9.0-9.el7fdn.x86_64.' \ + 'rpm'.format(OPNFV_ARTIFACTS) QUAGGA_URL = "http://artifacts.opnfv.org/sdnvpn/quagga/quagga-4.tar.gz" diff --git a/apex/overcloud/deploy.py b/apex/overcloud/deploy.py index fcd7f0f6..6e1d5bb4 100644 --- a/apex/overcloud/deploy.py +++ b/apex/overcloud/deploy.py @@ -360,6 +360,19 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None, if dataplane == 'ovs': if ds_opts['sfc']: oc_builder.inject_ovs_nsh(tmp_oc_image, tmp_dir) + elif sdn == 'opendaylight': + # FIXME(trozet) remove this after RDO is updated with fix for + # https://bugzilla.redhat.com/show_bug.cgi?id=1544892 + ovs_file = os.path.basename(con.CUSTOM_OVS) + ovs_url = con.CUSTOM_OVS.replace(ovs_file, '') + utils.fetch_upstream_and_unpack(dest=tmp_dir, url=ovs_url, + targets=[ovs_file]) + virt_cmds.extend([ + {con.VIRT_UPLOAD: "{}:/root/".format(os.path.join(tmp_dir, + ovs_file))}, + {con.VIRT_RUN_CMD: "yum downgrade -y /root/{}".format( + ovs_file)} + ]) if dataplane == 'fdio': # Patch neutron with using OVS external interface for router diff --git a/apex/tests/test_apex_overcloud_deploy.py b/apex/tests/test_apex_overcloud_deploy.py index 71ef80b4..a70057b9 100644 --- a/apex/tests/test_apex_overcloud_deploy.py +++ b/apex/tests/test_apex_overcloud_deploy.py @@ -197,10 +197,11 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.builders.overcloud_builder.inject_opendaylight') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image(self, mock_os_path, mock_shutil, mock_virt_utils, + def test_prep_image(self, mock_is_file, mock_shutil, mock_virt_utils, mock_inject_odl): + mock_is_file.return_value = True ds_opts = {'dataplane': 'fdio', 'sdn_controller': 'opendaylight', 'odl_version': 'master', @@ -217,10 +218,11 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_false(self, mock_os_path, mock_shutil, + def test_prep_image_sdn_false(self, mock_is_file, mock_shutil, mock_virt_utils): + mock_is_file.return_value = True ds_opts = {'dataplane': 'fdio', 'vpn': False, 'sdn_controller': False} @@ -232,13 +234,15 @@ class TestOvercloudDeploy(unittest.TestCase): prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test') mock_virt_utils.virt_customize.assert_called() + @patch('apex.overcloud.deploy.utils.fetch_upstream_and_unpack') @patch('apex.builders.overcloud_builder.inject_opendaylight') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_odl(self, mock_os_path, mock_shutil, - mock_virt_utils, mock_inject_odl): + def test_prep_image_sdn_odl(self, mock_is_file, mock_shutil, + mock_virt_utils, mock_inject_odl, mock_fetch): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': 'opendaylight', 'vpn': False, @@ -260,11 +264,12 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.overcloud.deploy.oc_builder') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) def test_prep_image_sdn_odl_upstream_containers_patches( - self, mock_os_path, mock_shutil, mock_virt_utils, + self, mock_is_file, mock_shutil, mock_virt_utils, mock_oc_builder, mock_c_builder): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': 'opendaylight', 'odl_version': con.DEFAULT_ODL_VERSION, @@ -289,11 +294,12 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.overcloud.deploy.oc_builder') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) def test_prep_image_nosdn_upstream_containers_patches( - self, mock_os_path, mock_shutil, mock_virt_utils, + self, mock_is_file, mock_shutil, mock_virt_utils, mock_oc_builder, mock_c_builder): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': False, 'odl_version': con.DEFAULT_ODL_VERSION, @@ -316,11 +322,12 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.overcloud.deploy.oc_builder') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_odl_not_def(self, mock_os_path, + def test_prep_image_sdn_odl_not_def(self, mock_is_file, mock_shutil, mock_virt_utils, mock_oc_builder): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': 'opendaylight', 'odl_version': 'uncommon'} @@ -335,10 +342,11 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_ovn(self, mock_os_path, mock_shutil, + def test_prep_image_sdn_ovn(self, mock_is_file, mock_shutil, mock_virt_utils): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'vpn': False, 'sfc': False, @@ -351,15 +359,17 @@ class TestOvercloudDeploy(unittest.TestCase): prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test') mock_virt_utils.virt_customize.assert_called() + @patch('apex.overcloud.deploy.utils.fetch_upstream_and_unpack') @patch('apex.builders.overcloud_builder.inject_quagga') @patch('apex.builders.overcloud_builder.inject_opendaylight') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_odl_vpn(self, mock_os_path, mock_shutil, + def test_prep_image_sdn_odl_vpn(self, mock_is_file, mock_shutil, mock_virt_utils, mock_inject_odl, - mock_inject_quagga): + mock_inject_quagga, mock_fetch): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': 'opendaylight', 'vpn': True, @@ -382,11 +392,12 @@ class TestOvercloudDeploy(unittest.TestCase): @patch('apex.builders.overcloud_builder.inject_opendaylight') @patch('apex.overcloud.deploy.virt_utils') @patch('apex.overcloud.deploy.shutil') - @patch('apex.overcloud.deploy.os.path') + @patch('apex.overcloud.deploy.os.path.isfile') @patch('builtins.open', mock_open()) - def test_prep_image_sdn_odl_sfc(self, mock_os_path, mock_shutil, + def test_prep_image_sdn_odl_sfc(self, mock_is_file, mock_shutil, mock_virt_utils, mock_inject_odl, mock_inject_ovs_nsh): + mock_is_file.return_value = True ds_opts = {'dataplane': 'ovs', 'sdn_controller': 'opendaylight', 'vpn': False, |