Merge "Add status field in the TaaS API"
This commit is contained in:
commit
675af77205
@ -1 +1 @@
|
|||||||
04625466c6fa
|
fddbdec8711a
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
# Copyright 2016 FUJITSU LABORATORIES LTD.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""add status
|
||||||
|
|
||||||
|
Revision ID: fddbdec8711a
|
||||||
|
Revises: 04625466c6fa
|
||||||
|
Create Date: 2016-06-06 10:54:42.252898
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'fddbdec8711a'
|
||||||
|
down_revision = '04625466c6fa'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
from neutron_lib import constants
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.add_column('tap_services', sa.Column('status', sa.String(16),
|
||||||
|
server_default=constants.ACTIVE,
|
||||||
|
nullable=False))
|
||||||
|
op.add_column('tap_flows', sa.Column('status', sa.String(16),
|
||||||
|
server_default=constants.ACTIVE,
|
||||||
|
nullable=False))
|
@ -20,6 +20,7 @@ from sqlalchemy.orm import exc
|
|||||||
|
|
||||||
from neutron.db import common_db_mixin as base_db
|
from neutron.db import common_db_mixin as base_db
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron_lib import constants
|
||||||
from neutron_lib.db import model_base
|
from neutron_lib.db import model_base
|
||||||
from neutron_taas.extensions import taas
|
from neutron_taas.extensions import taas
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
@ -37,6 +38,8 @@ class TapService(model_base.BASEV2, model_base.HasId,
|
|||||||
name = sa.Column(sa.String(255), nullable=True)
|
name = sa.Column(sa.String(255), nullable=True)
|
||||||
description = sa.Column(sa.String(1024), nullable=True)
|
description = sa.Column(sa.String(1024), nullable=True)
|
||||||
port_id = sa.Column(sa.String(36), nullable=False)
|
port_id = sa.Column(sa.String(36), nullable=False)
|
||||||
|
status = sa.Column(sa.String(16), nullable=False,
|
||||||
|
server_default=constants.ACTIVE)
|
||||||
|
|
||||||
|
|
||||||
class TapFlow(model_base.BASEV2, model_base.HasId,
|
class TapFlow(model_base.BASEV2, model_base.HasId,
|
||||||
@ -54,6 +57,8 @@ class TapFlow(model_base.BASEV2, model_base.HasId,
|
|||||||
direction = sa.Column(sa.Enum('IN', 'OUT', 'BOTH',
|
direction = sa.Column(sa.Enum('IN', 'OUT', 'BOTH',
|
||||||
name='tapflows_direction'),
|
name='tapflows_direction'),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
|
status = sa.Column(sa.String(16), nullable=False,
|
||||||
|
server_default=constants.ACTIVE)
|
||||||
|
|
||||||
|
|
||||||
class TapIdAssociation(model_base.BASEV2):
|
class TapIdAssociation(model_base.BASEV2):
|
||||||
@ -102,7 +107,8 @@ class Taas_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin):
|
|||||||
'tenant_id': tap_service['tenant_id'],
|
'tenant_id': tap_service['tenant_id'],
|
||||||
'name': tap_service['name'],
|
'name': tap_service['name'],
|
||||||
'description': tap_service['description'],
|
'description': tap_service['description'],
|
||||||
'port_id': tap_service['port_id']}
|
'port_id': tap_service['port_id'],
|
||||||
|
'status': tap_service['status']}
|
||||||
|
|
||||||
return self._fields(res, fields)
|
return self._fields(res, fields)
|
||||||
|
|
||||||
@ -119,7 +125,8 @@ class Taas_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin):
|
|||||||
'name': tap_flow['name'],
|
'name': tap_flow['name'],
|
||||||
'description': tap_flow['description'],
|
'description': tap_flow['description'],
|
||||||
'source_port': tap_flow['source_port'],
|
'source_port': tap_flow['source_port'],
|
||||||
'direction': tap_flow['direction']}
|
'direction': tap_flow['direction'],
|
||||||
|
'status': tap_flow['status']}
|
||||||
|
|
||||||
return self._fields(res, fields)
|
return self._fields(res, fields)
|
||||||
|
|
||||||
@ -134,6 +141,7 @@ class Taas_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin):
|
|||||||
name=t_s['name'],
|
name=t_s['name'],
|
||||||
description=t_s['description'],
|
description=t_s['description'],
|
||||||
port_id=t_s['port_id'],
|
port_id=t_s['port_id'],
|
||||||
|
status=constants.ACTIVE,
|
||||||
)
|
)
|
||||||
context.session.add(tap_service_db)
|
context.session.add(tap_service_db)
|
||||||
|
|
||||||
@ -164,7 +172,8 @@ class Taas_db_Mixin(taas.TaasPluginBase, base_db.CommonDbMixin):
|
|||||||
description=t_f['description'],
|
description=t_f['description'],
|
||||||
tap_service_id=t_f['tap_service_id'],
|
tap_service_id=t_f['tap_service_id'],
|
||||||
source_port=t_f['source_port'],
|
source_port=t_f['source_port'],
|
||||||
direction=t_f['direction']
|
direction=t_f['direction'],
|
||||||
|
status=constants.ACTIVE,
|
||||||
)
|
)
|
||||||
context.session.add(tap_flow_db)
|
context.session.add(tap_flow_db)
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||||||
'port_id': {'allow_post': True, 'allow_put': False,
|
'port_id': {'allow_post': True, 'allow_put': False,
|
||||||
'validate': {'type:uuid': None},
|
'validate': {'type:uuid': None},
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
|
'status': {'allow_post': False, 'allow_put': False,
|
||||||
|
'is_visible': True}
|
||||||
},
|
},
|
||||||
'tap_flows': {
|
'tap_flows': {
|
||||||
'id': {'allow_post': False, 'allow_put': False,
|
'id': {'allow_post': False, 'allow_put': False,
|
||||||
@ -113,7 +115,9 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||||||
'required_by_policy': True, 'is_visible': True},
|
'required_by_policy': True, 'is_visible': True},
|
||||||
'direction': {'allow_post': True, 'allow_put': False,
|
'direction': {'allow_post': True, 'allow_put': False,
|
||||||
'validate': {'type:values': direction_enum},
|
'validate': {'type:values': direction_enum},
|
||||||
'is_visible': True}
|
'is_visible': True},
|
||||||
|
'status': {'allow_post': False, 'allow_put': False,
|
||||||
|
'is_visible': True}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class ListTapFlow(extension.ClientExtensionList, TapFlow):
|
|||||||
"""List tap flows."""
|
"""List tap flows."""
|
||||||
|
|
||||||
shell_command = 'tap-flow-list'
|
shell_command = 'tap-flow-list'
|
||||||
list_columns = ['id', 'name', 'source_port', 'tap_service_id']
|
list_columns = ['id', 'name', 'source_port', 'tap_service_id', 'status']
|
||||||
pagination_support = True
|
pagination_support = True
|
||||||
sorting_support = True
|
sorting_support = True
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class ListTapService(extension.ClientExtensionList, TapService):
|
|||||||
"""List tap services."""
|
"""List tap services."""
|
||||||
|
|
||||||
shell_command = 'tap-service-list'
|
shell_command = 'tap-service-list'
|
||||||
list_columns = ['id', 'name', 'port']
|
list_columns = ['id', 'name', 'port', 'status']
|
||||||
pagination_support = True
|
pagination_support = True
|
||||||
sorting_support = True
|
sorting_support = True
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase):
|
|||||||
return_value=self._port_details):
|
return_value=self._port_details):
|
||||||
yield self._plugin.create_tap_service(self._context, req)
|
yield self._plugin.create_tap_service(self._context, req)
|
||||||
self._tap_service['id'] = mock.ANY
|
self._tap_service['id'] = mock.ANY
|
||||||
|
self._tap_service['status'] = 'ACTIVE'
|
||||||
|
|
||||||
self.driver.assert_has_calls([
|
self.driver.assert_has_calls([
|
||||||
mock.call.create_tap_service_precommit(mock.ANY),
|
mock.call.create_tap_service_precommit(mock.ANY),
|
||||||
@ -111,6 +112,7 @@ class TestTaasPlugin(testlib_api.SqlTestCase):
|
|||||||
return_value=self._port_details):
|
return_value=self._port_details):
|
||||||
yield self._plugin.create_tap_flow(self._context, req)
|
yield self._plugin.create_tap_flow(self._context, req)
|
||||||
self._tap_flow['id'] = mock.ANY
|
self._tap_flow['id'] = mock.ANY
|
||||||
|
self._tap_flow['status'] = 'ACTIVE'
|
||||||
self._tap_service['id'] = mock.ANY
|
self._tap_service['id'] = mock.ANY
|
||||||
|
|
||||||
self.driver.assert_has_calls([
|
self.driver.assert_has_calls([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user