def test_create_chain(self): auth_attr = utils.get_vim_auth_obj() flow_classifier = {'name': 'test_create_chain_fc', 'description': 'fc for testing create chain', 'source_port_range': '1997-2008', 'ip_proto': 6, 'destination_port_range': '80-100'} fc_id = self.sfc_driver.\ create_flow_classifier(name='fake_ffg', fc=flow_classifier, auth_attr=auth_attr) self.assertIsNotNone(fc_id) mea_1 = {'name': 'test_create_chain_mea_1', 'connection_points': [uuidutils.generate_uuid(), uuidutils.generate_uuid()]} mea_2 = {'name': 'test_create_chain_mea_2', 'connection_points': [uuidutils.generate_uuid(), uuidutils.generate_uuid()]} mea_3 = {'name': 'test_create_chain_mea_3', 'connection_points': [uuidutils.generate_uuid(), uuidutils.generate_uuid()]} meas = [mea_1, mea_2, mea_3] result = self.sfc_driver.create_chain(name='fake_ffg', fc_id=fc_id, meas=meas, auth_attr=auth_attr) self.assertIsNotNone(result)
def test_delete_flow_classifier(self): flow_classifier = {'name': 'another_fake_fc', 'description': 'another flow-classifier', 'source_port_range': '1999-2005', 'ip_proto': 6, 'destination_port_range': '80-100'} fc_id = self.sfc_driver.\ create_flow_classifier(name='fake_ffg', fc=flow_classifier, auth_attr=utils.get_vim_auth_obj()) self.assertIsNotNone(fc_id) try: self.sfc_driver.\ delete_flow_classifier(fc_id=fc_id, auth_attr=utils.get_vim_auth_obj()) except Exception: self.assertTrue(True)
def test_create_flow_classifier(self): flow_classifier = {'name': 'fake_fc', 'source_port_range': '2005-2010', 'ip_proto': 6, 'destination_port_range': '80-180'} result = self.sfc_driver.\ create_flow_classifier(name='fake_ffg', fc=flow_classifier, auth_attr=utils.get_vim_auth_obj()) self.assertIsNotNone(result)
def test_update_flow_classifier(self): flow_classifier = {'name': 'next_fake_fc', 'description': 'fake flow-classifier', 'source_port_range': '2005-2010', 'ip_proto': 6, 'destination_port_range': '80-180'} fc_id = self.sfc_driver.\ create_flow_classifier(name='fake_ffg', fc=flow_classifier, auth_attr=utils.get_vim_auth_obj()) self.assertIsNotNone(fc_id) flow_classifier['description'] = 'next fake flow-classifier' result = self.sfc_driver.\ update_flow_classifier(fc_id=fc_id, fc=flow_classifier, auth_attr=utils.get_vim_auth_obj()) self.assertIsNotNone(result)
def setUp(self): super(TestOpenstack_Driver, self).setUp() self._mock_keystone() self.keystone.create_key_dir.return_value = 'test_keys' self.config_fixture.config(group='vim_keys', openstack='/tmp/') self.config_fixture.config(group='vim_keys', use_barbican=False) self.openstack_driver = openstack_driver.OpenStack_Driver() self.vim_obj = self.get_vim_obj() self.auth_obj = utils.get_vim_auth_obj() self.addCleanup(mock.patch.stopall) self._mock_keymgr()
def dummy_get_vim(*args, **kwargs): vim_obj = dict() vim_obj['auth_cred'] = utils.get_vim_auth_obj() vim_obj['type'] = 'openstack' return vim_obj