Remove network-id from tap-service
Currently it's unused. Thus no good reason to force users to specify it. It can be re-introduced when/if we decide automatic port creation is desirable. For db models, a boolean to say if the port has been automatically created might be more appropriate, though. Change-Id: Ia183635c183fd4ad731fd1ee48c58f6b10f06c5b
This commit is contained in:
parent
38f1ab3bd2
commit
d7c5b3c5e0
@ -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"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
80c85b675b6e
|
||||
1817af933379
|
||||
|
@ -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')
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
|
@ -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',
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user