def test_create_vnf_from_template(self, mock_create_vnfd): self._insert_dummy_vnf_template_inline() mock_create_vnfd.return_value = { 'id': 'd58bcc4e-d0cf-11e6-bf26-cec0c932ce01' } vnf_obj = utils.get_dummy_inline_vnf_obj() result = self.vnfm_plugin.create_vnf(self.context, vnf_obj) self.assertIsNotNone(result) self.assertIn('id', result) self.assertIn('instance_id', result) self.assertIn('status', result) self.assertIn('attributes', result) self.assertIn('mgmt_ip_address', result) self.assertIn('created_at', result) self.assertIn('updated_at', result) self.assertEqual('ACTIVE', result['status']) mock_create_vnfd.assert_called_once_with(mock.ANY, mock.ANY) self._cos_db_plugin.create_event.assert_called_with( self.context, evt_type=constants.RES_EVT_CREATE, res_id=mock.ANY, res_state=mock.ANY, res_type=constants.RES_TYPE_VNF, tstamp=mock.ANY, details=mock.ANY)
def test_create_vnf_from_template(self, mock_create_vnfd): self._insert_dummy_device_template_inline() mock_create_vnfd.return_value = {'id': 'd58bcc4e-d0cf-11e6-bf26-cec0c932ce01'} vnf_obj = utils.get_dummy_inline_vnf_obj() result = self.vnfm_plugin.create_vnf(self.context, vnf_obj) self.assertIsNotNone(result) self.assertIn('id', result) self.assertIn('instance_id', result) self.assertIn('status', result) self.assertIn('attributes', result) self.assertIn('mgmt_url', result) self.assertIn('created_at', result) self.assertIn('updated_at', result) mock_create_vnfd.assert_called_once_with(mock.ANY, mock.ANY) self._device_manager.invoke.assert_called_with('test_vim', 'create', plugin=mock.ANY, context=mock.ANY, vnf=mock.ANY, auth_attr=mock.ANY) self._pool.spawn_n.assert_called_once_with(mock.ANY) self._cos_db_plugin.create_event.assert_called_with( self.context, evt_type=constants.RES_EVT_CREATE, res_id=mock.ANY, res_state=mock.ANY, res_type=constants.RES_TYPE_VNF, tstamp=mock.ANY, details=mock.ANY)
def test_create_vnf_from_template(self, mock_create_vnfd): self._insert_dummy_vnf_template_inline() mock_create_vnfd.return_value = {'id': 'd58bcc4e-d0cf-11e6-bf26-cec0c932ce01'} vnf_obj = utils.get_dummy_inline_vnf_obj() result = self.vnfm_plugin.create_vnf(self.context, vnf_obj) self.assertIsNotNone(result) self.assertIn('id', result) self.assertIn('instance_id', result) self.assertIn('status', result) self.assertIn('attributes', result) self.assertIn('mgmt_ip_address', result) self.assertIn('created_at', result) self.assertIn('updated_at', result) self.assertEqual('ACTIVE', result['status']) mock_create_vnfd.assert_called_once_with(mock.ANY, mock.ANY) self._cos_db_plugin.create_event.assert_called_with( self.context, evt_type=constants.RES_EVT_CREATE, res_id=mock.ANY, res_state=mock.ANY, res_type=constants.RES_TYPE_VNF, tstamp=mock.ANY, details=mock.ANY)