Exemplo n.º 1
0
 def test_create_networks_invalid_cache(self, mock_deploy_snap,
                                        mock_libvirt_open, mock_pull_snap,
                                        mock_oc_node):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = '/doesnotexist/'
     self.assertRaises(exc.SnapshotDeployException, d.create_networks)
Exemplo n.º 2
0
 def test_create_networks(self, mock_deploy_snap, mock_libvirt_open,
                          mock_pull_snap, mock_oc_node):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     conn = mock_libvirt_open('qemu:///system')
     d.create_networks()
     conn.networkCreateXML.assert_called()
Exemplo n.º 3
0
 def test_get_controllers_none(self, mock_deploy_snap, mock_libvirt_open,
                               mock_pull_snap, mock_oc_node):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     node = mock_oc_node()
     node.role = 'compute'
     d.oc_nodes = [node]
     self.assertListEqual(d.get_controllers(), [])
Exemplo n.º 4
0
 def test_parse_and_create_nodes(self, mock_deploy_snap, mock_libvirt_open,
                                 mock_pull_snap, mock_oc_node):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     node = mock_oc_node()
     d.parse_and_create_nodes()
     node.start.assert_called()
     self.assertListEqual([node], d.oc_nodes)
Exemplo n.º 5
0
 def test_is_opendaylight_up(self, mock_deploy_snap, mock_libvirt_open,
                             mock_pull_snap, mock_oc_node, mock_utils,
                             mock_time, mock_get_ctrls):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     node = mock_oc_node()
     node.ip = '123.123.123.123'
     node.name = 'dummy-controller-0'
     mock_get_ctrls.return_value = [node]
     mock_utils.open_webpage.return_value = 0
     self.assertTrue(d.is_service_up('opendaylight'))
Exemplo n.º 6
0
 def test_is_openstack_up_false(self, mock_deploy_snap, mock_libvirt_open,
                                mock_pull_snap, mock_oc_node, mock_socket,
                                mock_time, mock_get_ctrls):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     node = mock_oc_node()
     node.ip = '123.123.123.123'
     node.name = 'dummy-controller-0'
     mock_get_ctrls.return_value = [node]
     sock = mock_socket.socket(mock_socket.AF_INET, mock_socket.SOCK_STREAM)
     sock.connect_ex.return_value = 1
     self.assertFalse(d.is_service_up('openstack'))
Exemplo n.º 7
0
 def test_parse_and_create_nodes_invalid_node_yaml(self, mock_deploy_snap,
                                                   mock_libvirt_open,
                                                   mock_pull_snap,
                                                   mock_oc_node,
                                                   mock_parse_yaml):
     ds_file = os.path.join(TEST_DUMMY_CONFIG, 'dummy-deploy-settings.yaml')
     ds = DeploySettings(ds_file)
     d = SnapshotDeployment(deploy_settings=ds,
                            snap_cache_dir=DUMMY_SNAP_DIR,
                            fetch=False,
                            all_in_one=False)
     d.snap_cache_dir = TEST_DUMMY_CONFIG
     node = mock_oc_node()
     mock_parse_yaml.return_value = {'blah': 'dummy'}
     self.assertRaises(exc.SnapshotDeployException,
                       d.parse_and_create_nodes)
     node.start.assert_not_called()