Merge "Use DB field sizes instead of _MAX_LEN constants"
This commit is contained in:
commit
1b27464030
@ -27,7 +27,6 @@ from neutron_lib import constants as lib_consts
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.db import common_db_mixin as common_db
|
||||
from neutron.db import l3_attrs_db
|
||||
from neutron.db import l3_db
|
||||
@ -89,7 +88,7 @@ class BgpSpeaker(model_base.BASEV2,
|
||||
|
||||
__tablename__ = 'bgp_speakers'
|
||||
|
||||
name = sa.Column(sa.String(attr.NAME_MAX_LEN), nullable=False)
|
||||
name = sa.Column(sa.String(255), nullable=False)
|
||||
local_as = sa.Column(sa.Integer, nullable=False, autoincrement=False)
|
||||
advertise_floating_ip_host_routes = sa.Column(sa.Boolean, nullable=False)
|
||||
advertise_tenant_networks = sa.Column(sa.Boolean, nullable=False)
|
||||
@ -112,7 +111,7 @@ class BgpPeer(model_base.BASEV2,
|
||||
|
||||
__tablename__ = 'bgp_peers'
|
||||
|
||||
name = sa.Column(sa.String(attr.NAME_MAX_LEN), nullable=False)
|
||||
name = sa.Column(sa.String(255), nullable=False)
|
||||
peer_ip = sa.Column(sa.String(64),
|
||||
nullable=False)
|
||||
remote_as = sa.Column(sa.Integer, nullable=False, autoincrement=False)
|
||||
|
@ -15,10 +15,10 @@
|
||||
#
|
||||
|
||||
from neutron_lib.api import converters as n_conv
|
||||
from neutron_lib.db import constants as db_const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.api.v2 import resource_helper as rh
|
||||
|
||||
from neutron_dynamic_routing._i18n import _
|
||||
@ -36,7 +36,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'validate': {'type:uuid': None},
|
||||
'is_visible': True, 'primary_key': True},
|
||||
'name': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:string': attr.NAME_MAX_LEN},
|
||||
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
|
||||
'is_visible': True, 'default': ''},
|
||||
'local_as': {'allow_post': True, 'allow_put': False,
|
||||
'validate': {'type:range': (bgp_consts.MIN_ASNUM,
|
||||
@ -51,7 +51,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'enforce_policy': False},
|
||||
'tenant_id': {'allow_post': True, 'allow_put': False,
|
||||
'required_by_policy': False,
|
||||
'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
|
||||
'validate': {
|
||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||
'is_visible': True},
|
||||
'peers': {'allow_post': False, 'allow_put': False,
|
||||
'validate': {'type:uuid_list': None},
|
||||
@ -85,7 +86,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'validate': {'type:uuid': None},
|
||||
'is_visible': True, 'primary_key': True},
|
||||
'name': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:string': attr.NAME_MAX_LEN},
|
||||
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
|
||||
'is_visible': True, 'default': ''},
|
||||
'peer_ip': {'allow_post': True, 'allow_put': False,
|
||||
'required_by_policy': True,
|
||||
@ -109,7 +110,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'default': None},
|
||||
'tenant_id': {'allow_post': True, 'allow_put': False,
|
||||
'required_by_policy': False,
|
||||
'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
|
||||
'validate': {
|
||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||
'is_visible': True}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user