From eb7a55bdcade3e9ceda0d3b6506a1014ee939f6d Mon Sep 17 00:00:00 2001 From: Boden R Date: Fri, 2 Jun 2017 10:53:17 -0600 Subject: [PATCH] rehome consumed neutron.common.constants This patch rehomes those constants found in neutron.common.constants.py that are used outside of neutron and are thus candidates for rehoming. The remaining public attributes from neutron.common.constants will be made private upon consumption of this rehome patch. Change-Id: I360545b6ee4291547e0c5c8e668ad03d3efa4725 --- neutron_lib/agent/constants.py | 9 +++++++++ neutron_lib/constants.py | 10 ++++++++++ neutron_lib/db/constants.py | 5 +++++ .../rehome-common-constants-8ac9580e52fd3618.yaml | 6 ++++++ 4 files changed, 30 insertions(+) create mode 100644 releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml diff --git a/neutron_lib/agent/constants.py b/neutron_lib/agent/constants.py index eefc3e61a..2c080570d 100644 --- a/neutron_lib/agent/constants.py +++ b/neutron_lib/agent/constants.py @@ -21,3 +21,12 @@ LB_EXTENSION_DRIVER = 'linuxbridge' MACVTAP_EXTENSION_DRIVER = 'macvtap' # Extension driver type for SR-IOV mech driver SRIOV_EXTENSION_DRIVER = 'sriov' + + +# Agent states as detected by server, used to reply on agent's state report +# agent has just been registered +AGENT_NEW = 'new' +# agent is alive +AGENT_ALIVE = 'alive' +# agent has just returned to alive after being dead +AGENT_REVIVED = 'revived' diff --git a/neutron_lib/constants.py b/neutron_lib/constants.py index f0627ad9b..79fe3facf 100644 --- a/neutron_lib/constants.py +++ b/neutron_lib/constants.py @@ -74,6 +74,9 @@ ROUTER_INTERFACE_OWNERS_SNAT = (DEVICE_OWNER_ROUTER_INTF, DEVICE_OWNER_HA_REPLICATED_INT, DEVICE_OWNER_DVR_INTERFACE, DEVICE_OWNER_ROUTER_SNAT) + +DEVICE_ID_RESERVED_DHCP_PORT = 'reserved_dhcp_port' + FLOATINGIP_KEY = '_floatingips' INTERFACE_KEY = '_interfaces' HA_INTERFACE_KEY = '_ha_interface' @@ -310,6 +313,13 @@ DNS_DOMAIN_DEFAULT = 'openstacklocal.' DNS_LABEL_MAX_LEN = 63 DNS_LABEL_REGEX = "^[a-z0-9-]{1,%d}$" % DNS_LABEL_MAX_LEN +VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, + 36, 38, 40, 46, 48, 56] + +INGRESS_DIRECTION = 'ingress' +EGRESS_DIRECTION = 'egress' +VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION) + class Sentinel(object): """A constant object that does not change even when copied.""" diff --git a/neutron_lib/db/constants.py b/neutron_lib/db/constants.py index 4dc241f8d..2682834ab 100644 --- a/neutron_lib/db/constants.py +++ b/neutron_lib/db/constants.py @@ -27,3 +27,8 @@ FQDN_FIELD_SIZE = 255 # Alembic branches EXPAND_BRANCH = 'expand' CONTRACT_BRANCH = 'contract' + +# Maximum value integer can take in MySQL and PostgreSQL +# In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes, +# but here it will be limited by this value for consistency. +DB_INTEGER_MAX_VALUE = 2 ** 31 - 1 diff --git a/releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml b/releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml new file mode 100644 index 000000000..684e2a8cf --- /dev/null +++ b/releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml @@ -0,0 +1,6 @@ +--- +features: + - Constants from ``neutron.common.constants`` are now available in + neutron-lib. Note that consumers using ``ROUTER_STATUS_ACTIVE`` or + ``ROUTER_STATUS_ERROR`` should now just use ``ACTIVE`` and ``ERROR`` + from ``neutron_lib.constants``.