diff --git a/API_REFERENCE.rst b/API_REFERENCE.rst index 0f763c43..a2c84dd6 100644 --- a/API_REFERENCE.rst +++ b/API_REFERENCE.rst @@ -39,9 +39,6 @@ Any service (VM) that uses the mirrored data is attached to the port. 'port_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, - 'network_id': {'allow_post': True, 'allow_put': False, - 'validate': {'type:uuid': None}, - 'is_visible': False} } TapFlow @@ -103,7 +100,6 @@ extension "tap_service": { "description": "Test_Tap", "name": "Test", - "network_id": "8686f7d1-14e3-46ab-be3c-ccc0eead93cd", "port_id": "c9beb5a1-21f5-4225-9eaf-02ddccdd50a9", "tenant_id": "97e1586d580745d7b311406697aaf097" } diff --git a/neutron_taas/db/migration/alembic_migration/versions/CONTRACT_HEAD b/neutron_taas/db/migration/alembic_migration/versions/CONTRACT_HEAD index e3e34246..192304df 100644 --- a/neutron_taas/db/migration/alembic_migration/versions/CONTRACT_HEAD +++ b/neutron_taas/db/migration/alembic_migration/versions/CONTRACT_HEAD @@ -1 +1 @@ -80c85b675b6e +1817af933379 diff --git a/neutron_taas/db/migration/alembic_migration/versions/newton/contract/1817af933379_remove_network_id_from_tap_service.py b/neutron_taas/db/migration/alembic_migration/versions/newton/contract/1817af933379_remove_network_id_from_tap_service.py new file mode 100644 index 00000000..5af35ba7 --- /dev/null +++ b/neutron_taas/db/migration/alembic_migration/versions/newton/contract/1817af933379_remove_network_id_from_tap_service.py @@ -0,0 +1,32 @@ +# Copyright (c) 2016 Midokura SARL +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Remove network-id from tap-service + +Revision ID: 1817af933379 +Revises: 80c85b675b6e +Create Date: 2016-04-05 21:59:28.829793 + +""" + +# revision identifiers, used by Alembic. +revision = '1817af933379' +down_revision = '80c85b675b6e' + +from alembic import op + + +def upgrade(): + op.drop_column('tap_services', 'network_id') diff --git a/neutron_taas/db/taas_db.py b/neutron_taas/db/taas_db.py index 2625511d..c54dd28b 100755 --- a/neutron_taas/db/taas_db.py +++ b/neutron_taas/db/taas_db.py @@ -35,7 +35,6 @@ class TapService(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): name = sa.Column(sa.String(255), nullable=True) description = sa.Column(sa.String(1024), nullable=True) port_id = sa.Column(sa.String(36), nullable=False) - network_id = sa.Column(sa.String(36), nullable=True) class TapFlow(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): @@ -92,8 +91,7 @@ class Tass_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin): 'tenant_id': tap_service['tenant_id'], 'name': tap_service['name'], 'description': tap_service['description'], - 'port_id': tap_service['port_id'], - 'network_id': tap_service['network_id']} + 'port_id': tap_service['port_id']} return self._fields(res, fields) @@ -125,7 +123,6 @@ class Tass_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin): name=t_s['name'], description=t_s['description'], port_id=t_s['port_id'], - network_id=t_s['network_id'] ) context.session.add(tap_service_db) diff --git a/neutron_taas/extensions/taas.py b/neutron_taas/extensions/taas.py index 2abccacb..520d536b 100644 --- a/neutron_taas/extensions/taas.py +++ b/neutron_taas/extensions/taas.py @@ -69,11 +69,8 @@ Resource Attribute Map: Note: -'tap_services' data model refers to the Tap Service created. The port_id -can be specified by the tenant to which the mirrored data is sent. If port_id -is specified then the network_id will not be used. If the port_id is not -specified, the TaaS will create a port on the network specified by the -network_id. +'tap_services' data model refers to the Tap Service created. +port_id specifies destination port to which the mirrored data is sent. ''' RESOURCE_ATTRIBUTE_MAP = { @@ -93,9 +90,6 @@ RESOURCE_ATTRIBUTE_MAP = { 'port_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, - 'network_id': {'allow_post': True, 'allow_put': False, - 'validate': {'type:uuid': None}, - 'is_visible': False} }, 'tap_flows': { 'id': {'allow_post': False, 'allow_put': False, diff --git a/neutron_taas/taas_client/tapservice.py b/neutron_taas/taas_client/tapservice.py index 750b0295..e95c4ad9 100644 --- a/neutron_taas/taas_client/tapservice.py +++ b/neutron_taas/taas_client/tapservice.py @@ -55,7 +55,7 @@ class CreateTapService(extension.ClientExtensionCreate, TapService): """Create a tap service.""" shell_command = 'tap-service-create' - list_columns = ['id', 'name', 'port', 'network'] + list_columns = ['id', 'name', 'port'] def add_known_arguments(self, parser): _add_updatable_args(parser) @@ -65,23 +65,13 @@ class CreateTapService(extension.ClientExtensionCreate, TapService): required=True, metavar="PORT", help=_('Port to which the Tap service is connected.')) - parser.add_argument( - '--network', - dest='network_id', - required=True, - metavar="NETWORK", - help=_('Network to which the Tap service is connected.')) def args2body(self, parsed_args): client = self.get_client() port_id = neutronv20.find_resourceid_by_name_or_id( client, 'port', parsed_args.port_id) - network_id = neutronv20.find_resourceid_by_name_or_id( - client, 'network', - parsed_args.network_id) - body = {'port_id': port_id, - 'network_id': network_id} + body = {'port_id': port_id} if parsed_args.tenant_id: body['tenant_id'] = parsed_args.tenant_id _updatable_args2body(parsed_args, body) diff --git a/neutron_taas/tests/tempest_plugin/tests/api/test_taas.py b/neutron_taas/tests/tempest_plugin/tests/api/test_taas.py index fcfbbbf1..ccf5a025 100644 --- a/neutron_taas/tests/tempest_plugin/tests/api/test_taas.py +++ b/neutron_taas/tests/tempest_plugin/tests/api/test_taas.py @@ -13,10 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools - from tempest import config -from tempest.lib import exceptions as lib_exc from tempest import test from neutron_taas.tests.tempest_plugin.tests.api import base @@ -37,13 +34,6 @@ class TaaSExtensionTestJSON(base.BaseTaaSTest): def test_create_tap_service_and_flow(self): network = self.create_network() port = self.create_port(network) - tap_service = self.create_tap_service(network_id=network['id'], - port_id=port['id']) + tap_service = self.create_tap_service(port_id=port['id']) self.create_tap_flow(tap_service_id=tap_service['id'], direction='BOTH', source_port=port['id']) - - @test.attr(type=['negative']) - @test.idempotent_id('2d5024f5-bc80-4a31-a4a5-5bf5b14a8f3e') - def test_create_tap_service_with_wrong_network(self): - with testtools.ExpectedException(lib_exc.BadRequest): - self.create_tap_service(network_id='nonexistent') diff --git a/neutron_taas/tests/unit/services/taas/test_taas_plugin.py b/neutron_taas/tests/unit/services/taas/test_taas_plugin.py index 12df9390..a31046a0 100644 --- a/neutron_taas/tests/unit/services/taas/test_taas_plugin.py +++ b/neutron_taas/tests/unit/services/taas/test_taas_plugin.py @@ -55,7 +55,6 @@ class TestTaasPlugin(testlib_api.SqlTestCase): 'name': 'MyTap', 'description': 'This is my tap service', 'port_id': self._port_id, - 'network_id': self._network_id, } self._tap_flow = { 'description': 'This is my tap flow', diff --git a/neutron_taas/tests/unit/taas_client/test_cli20_tapservice.py b/neutron_taas/tests/unit/taas_client/test_cli20_tapservice.py index c6ab8f7a..622fed98 100644 --- a/neutron_taas/tests/unit/taas_client/test_cli20_tapservice.py +++ b/neutron_taas/tests/unit/taas_client/test_cli20_tapservice.py @@ -52,7 +52,7 @@ class CLITestV20TapServiceJSON(test_cli20.CLITestV20Base): self.assertDictContainsSubset(extension_cmd, shell.COMMANDS['2.0']) def _test_create_tap_service(self, port_id="random_port", - network_id="random_net", name='', + name='', args_attr=None, position_names_attr=None, position_values_attr=None): cmd = tapservice.CreateTapService(test_cli20.MyApp(sys.stdout), None) @@ -63,16 +63,15 @@ class CLITestV20TapServiceJSON(test_cli20.CLITestV20Base): tenant_id = 'my-tenant' my_id = 'my-id' args = ['--tenant-id', tenant_id, - '--port', port_id, - '--network', network_id] + args_attr - position_names = ['port_id', 'network_id'] + position_names_attr - position_values = [port_id, network_id] + position_values_attr + '--port', port_id] + args_attr + position_names = ['port_id'] + position_names_attr + position_values = [port_id] + position_values_attr self._test_create_resource(self.resource, cmd, name, my_id, args, position_names, position_values, tenant_id=tenant_id) def test_create_tap_service_mandatory_params(self): - # Create tap_service: --port random_port --network random_network + # Create tap_service: --port random_port self._test_create_tap_service() def test_create_tap_service_all_params(self):