blob: 4ad780d0261d94b7f8a63f19706ff3cb2c14df1e [file] [log] [blame]
Chandan Kumar5e619872017-09-07 22:23:55 +05301# Copyright (c) 2012 OpenStack Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from neutron_lib import constants as lib_constants
17
18
19ROUTER_PORT_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \
20 (lib_constants.DEVICE_OWNER_ROUTER_GW,)
21
22ROUTER_STATUS_ACTIVE = 'ACTIVE'
23ROUTER_STATUS_ERROR = 'ERROR'
24
25DEVICE_ID_RESERVED_DHCP_PORT = "reserved_dhcp_port"
26
27HA_ROUTER_STATE_KEY = '_ha_state'
28METERING_LABEL_KEY = '_metering_labels'
29FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces'
30SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces'
31DVR_SNAT_BOUND = 'dvr_snat_bound'
32L3_AGENT_MODE_DVR_NO_EXTERNAL = 'dvr_no_external'
33
34HA_NETWORK_NAME = 'HA network tenant %s'
35HA_SUBNET_NAME = 'HA subnet tenant %s'
36HA_PORT_NAME = 'HA port tenant %s'
37HA_ROUTER_STATE_ACTIVE = 'active'
38HA_ROUTER_STATE_STANDBY = 'standby'
39
40PAGINATION_INFINITE = 'infinite'
41
42SORT_DIRECTION_ASC = 'asc'
43SORT_DIRECTION_DESC = 'desc'
44
45ETHERTYPE_NAME_ARP = 'arp'
46ETHERTYPE_ARP = 0x0806
47ETHERTYPE_IP = 0x0800
48ETHERTYPE_IPV6 = 0x86DD
49
50IP_PROTOCOL_NAME_ALIASES = {lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY:
51 lib_constants.PROTO_NAME_IPV6_ICMP}
52
53VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
54 36, 38, 40, 46, 48, 56]
55
56IP_PROTOCOL_NUM_TO_NAME_MAP = {
57 str(v): k for k, v in lib_constants.IP_PROTOCOL_MAP.items()}
58
59# When using iptables-save we specify '-p {proto} -m {module}',
60# but sometimes those values are not identical. This is a map
61# of known protocols that require a '-m {module}', along with
62# the module name that should be used.
63IPTABLES_PROTOCOL_MAP = {lib_constants.PROTO_NAME_DCCP: 'dccp',
64 lib_constants.PROTO_NAME_ICMP: 'icmp',
65 lib_constants.PROTO_NAME_IPV6_ICMP: 'icmp6',
66 lib_constants.PROTO_NAME_SCTP: 'sctp',
67 lib_constants.PROTO_NAME_TCP: 'tcp',
68 lib_constants.PROTO_NAME_UDP: 'udp'}
69
70# Special provisional prefix for IPv6 Prefix Delegation
71PROVISIONAL_IPV6_PD_PREFIX = '::/64'
72
73# Timeout in seconds for getting an IPv6 LLA
74LLA_TASK_TIMEOUT = 40
75
76# length of all device prefixes (e.g. qvo, tap, qvb)
77LINUX_DEV_PREFIX_LEN = 3
78# must be shorter than linux IFNAMSIZ (which is 16)
79LINUX_DEV_LEN = 14
80
81# Possible prefixes to partial port IDs in interface names used by the OVS,
82# Linux Bridge, and IVS VIF drivers in Nova and the neutron agents. See the
83# 'get_ovs_interfaceid' method in Nova (nova/virt/libvirt/vif.py) for details.
84INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX,
85 lib_constants.VETH_DEVICE_PREFIX,
86 lib_constants.SNAT_INT_DEV_PREFIX)
87
88ATTRIBUTES_TO_UPDATE = 'attributes_to_update'
89
90# Maximum value integer can take in MySQL and PostgreSQL
91# In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes,
92# but here it will be limited by this value for consistency.
93DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
94
95# TODO(amuller): Re-define the RPC namespaces once Oslo messaging supports
96# Targets with multiple namespaces. Neutron will then implement callbacks
97# for its RPC clients in order to support rolling upgrades.
98
99# RPC Interface for agents to call DHCP API implemented on the plugin side
100RPC_NAMESPACE_DHCP_PLUGIN = None
101# RPC interface for the metadata service to get info from the plugin side
102RPC_NAMESPACE_METADATA = None
103# RPC interface for agent to plugin security group API
104RPC_NAMESPACE_SECGROUP = None
105# RPC interface for agent to plugin DVR api
106RPC_NAMESPACE_DVR = None
107# RPC interface for reporting state back to the plugin
108RPC_NAMESPACE_STATE = None
109# RPC interface for agent to plugin resources API
110RPC_NAMESPACE_RESOURCES = None
111
112# Default network MTU value when not configured
113DEFAULT_NETWORK_MTU = 1500
114IPV6_MIN_MTU = 1280
115
116ROUTER_MARK_MASK = "0xffff"
117
118# Agent states as detected by server, used to reply on agent's state report
119# agent has just been registered
120AGENT_NEW = 'new'
121# agent is alive
122AGENT_ALIVE = 'alive'
123# agent has just returned to alive after being dead
124AGENT_REVIVED = 'revived'
125
126INGRESS_DIRECTION = 'ingress'
127EGRESS_DIRECTION = 'egress'
128
129VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION)
130VALID_ETHERTYPES = (lib_constants.IPv4, lib_constants.IPv6)
131
132IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6]
133
134PORT_RANGE_MIN = 1
135PORT_RANGE_MAX = 65535
136
137# Configuration values for accept_ra sysctl, copied from linux kernel
138# networking (netdev) tree, file Documentation/networking/ip-sysctl.txt
139#
140# Possible values are:
141# 0 Do not accept Router Advertisements.
142# 1 Accept Router Advertisements if forwarding is disabled.
143# 2 Overrule forwarding behaviour. Accept Router Advertisements
144# even if forwarding is enabled.
145ACCEPT_RA_DISABLED = 0
146ACCEPT_RA_WITHOUT_FORWARDING = 1
147ACCEPT_RA_WITH_FORWARDING = 2
148
149# Some components communicate using private address ranges, define
150# them all here. These address ranges should not cause any issues
151# even if they overlap since they are used in disjoint namespaces,
152# but for now they are unique.
153# We define the metadata cidr since it falls in the range.
154PRIVATE_CIDR_RANGE = '169.254.0.0/16'
155DVR_FIP_LL_CIDR = '169.254.64.0/18'
156L3_HA_NET_CIDR = '169.254.192.0/18'
157METADATA_CIDR = '169.254.169.254/32'
158
159# The only defined IpamAllocation status at this stage is 'ALLOCATED'.
160# More states will be available in the future - e.g.: RECYCLABLE
161IPAM_ALLOCATION_STATUS_ALLOCATED = 'ALLOCATED'
162
163VALID_IPAM_ALLOCATION_STATUSES = (IPAM_ALLOCATION_STATUS_ALLOCATED,)
164
165# Port binding states for Live Migration
166PORT_BINDING_STATUS_ACTIVE = 'ACTIVE'
167PORT_BINDING_STATUS_INACTIVE = 'INACTIVE'
168PORT_BINDING_STATUSES = (PORT_BINDING_STATUS_ACTIVE,
169 PORT_BINDING_STATUS_INACTIVE)
170
171VALID_FLOATINGIP_STATUS = (lib_constants.FLOATINGIP_STATUS_ACTIVE,
172 lib_constants.FLOATINGIP_STATUS_DOWN,
173 lib_constants.FLOATINGIP_STATUS_ERROR)
174
175# Possible types of values (e.g. in QoS rule types)
176VALUES_TYPE_CHOICES = "choices"
177VALUES_TYPE_RANGE = "range"