Use DB field sizes instead of _MAX_LEN constants

Remove The following _MAX_LEN constants from
neutron/api/v2/attributes.py and use the corresponding DB field size
constants from neutron_lib.db.constants instead.

 NAME_MAX_LEN              -->  NAME_FIELD_SIZE
 TENANT_ID_MAX_LEN         -->  PROJECT_ID_FIELD_SIZE
 DESCRIPTION_MAX_LEN       -->  DESCRIPTION_FIELD_SIZE
 LONG_DESCRIPTION_MAX_LEN  -->  LONG_DESCRIPTION_FIELD_SIZE
 DEVICE_ID_MAX_LEN         -->  DEVICE_ID_FIELD_SIZE
 DEVICE_OWNER_MAX_LEN      -->  DEVICE_NAME_FIELD_SIZE

In alembic migration scripts, the raw numerical value is used.

For more information, see:
http://lists.openstack.org/pipermail/openstack-dev/2016-October/105789.html

NeutronLibImpact

Change-Id: I734890372584fe27e5d6ec38c0cad2de882ff11c
diff --git a/neutron/tests/tempest/api/test_metering_extensions.py b/neutron/tests/tempest/api/test_metering_extensions.py
index 7b03386..9bbcdce 100644
--- a/neutron/tests/tempest/api/test_metering_extensions.py
+++ b/neutron/tests/tempest/api/test_metering_extensions.py
@@ -12,13 +12,13 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+from neutron_lib.db import constants as db_const
 from tempest.lib.common.utils import data_utils
 from tempest import test
 
-from neutron.api.v2 import attributes as attr
 from neutron.tests.tempest.api import base
 
-LONG_NAME_OK = 'x' * (attr.NAME_MAX_LEN)
+LONG_NAME_OK = 'x' * db_const.NAME_FIELD_SIZE
 
 
 class MeteringTestJSON(base.BaseAdminNetworkTest):
diff --git a/neutron/tests/tempest/api/test_metering_negative.py b/neutron/tests/tempest/api/test_metering_negative.py
index 39fdae8..dece9e4 100644
--- a/neutron/tests/tempest/api/test_metering_negative.py
+++ b/neutron/tests/tempest/api/test_metering_negative.py
@@ -12,13 +12,13 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from neutron_lib.db import constants as db_const
 from tempest.lib import exceptions as lib_exc
 from tempest import test
 
-from neutron.api.v2 import attributes as attr
 from neutron.tests.tempest.api import base
 
-LONG_NAME_NG = 'x' * (attr.NAME_MAX_LEN + 1)
+LONG_NAME_NG = 'x' * (db_const.NAME_FIELD_SIZE + 1)
 
 
 class MeteringNegativeTestJSON(base.BaseAdminNetworkTest):
diff --git a/neutron/tests/tempest/api/test_qos_negative.py b/neutron/tests/tempest/api/test_qos_negative.py
index bc3222a..5057c72 100644
--- a/neutron/tests/tempest/api/test_qos_negative.py
+++ b/neutron/tests/tempest/api/test_qos_negative.py
@@ -10,15 +10,15 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from neutron_lib.db import constants as db_const
 from tempest.lib import exceptions as lib_exc
 from tempest import test
 
-from neutron.api.v2 import attributes as attr
 from neutron.tests.tempest.api import base
 
-LONG_NAME_NG = 'z' * (attr.NAME_MAX_LEN + 1)
-LONG_DESCRIPTION_NG = 'z' * (attr.LONG_DESCRIPTION_MAX_LEN + 1)
-LONG_TENANT_ID_NG = 'z' * (attr.TENANT_ID_MAX_LEN + 1)
+LONG_NAME_NG = 'z' * (db_const.NAME_FIELD_SIZE + 1)
+LONG_DESCRIPTION_NG = 'z' * (db_const.LONG_DESCRIPTION_FIELD_SIZE + 1)
+LONG_TENANT_ID_NG = 'z' * (db_const.PROJECT_ID_FIELD_SIZE + 1)
 
 
 class QosNegativeTestJSON(base.BaseAdminNetworkTest):