blob: f695f6ce10d35a2ff62d0b48280f8cc8642cf475 [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
Chandan Kumar5e619872017-09-07 22:23:55 +0530126VALID_ETHERTYPES = (lib_constants.IPv4, lib_constants.IPv6)
127
128IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6]
129
130PORT_RANGE_MIN = 1
131PORT_RANGE_MAX = 65535
132
133# Configuration values for accept_ra sysctl, copied from linux kernel
134# networking (netdev) tree, file Documentation/networking/ip-sysctl.txt
135#
136# Possible values are:
137# 0 Do not accept Router Advertisements.
138# 1 Accept Router Advertisements if forwarding is disabled.
139# 2 Overrule forwarding behaviour. Accept Router Advertisements
140# even if forwarding is enabled.
141ACCEPT_RA_DISABLED = 0
142ACCEPT_RA_WITHOUT_FORWARDING = 1
143ACCEPT_RA_WITH_FORWARDING = 2
144
145# Some components communicate using private address ranges, define
146# them all here. These address ranges should not cause any issues
147# even if they overlap since they are used in disjoint namespaces,
148# but for now they are unique.
149# We define the metadata cidr since it falls in the range.
150PRIVATE_CIDR_RANGE = '169.254.0.0/16'
151DVR_FIP_LL_CIDR = '169.254.64.0/18'
152L3_HA_NET_CIDR = '169.254.192.0/18'
153METADATA_CIDR = '169.254.169.254/32'
154
155# The only defined IpamAllocation status at this stage is 'ALLOCATED'.
156# More states will be available in the future - e.g.: RECYCLABLE
157IPAM_ALLOCATION_STATUS_ALLOCATED = 'ALLOCATED'
158
159VALID_IPAM_ALLOCATION_STATUSES = (IPAM_ALLOCATION_STATUS_ALLOCATED,)
160
161# Port binding states for Live Migration
162PORT_BINDING_STATUS_ACTIVE = 'ACTIVE'
163PORT_BINDING_STATUS_INACTIVE = 'INACTIVE'
164PORT_BINDING_STATUSES = (PORT_BINDING_STATUS_ACTIVE,
165 PORT_BINDING_STATUS_INACTIVE)
166
167VALID_FLOATINGIP_STATUS = (lib_constants.FLOATINGIP_STATUS_ACTIVE,
168 lib_constants.FLOATINGIP_STATUS_DOWN,
169 lib_constants.FLOATINGIP_STATUS_ERROR)
170
171# Possible types of values (e.g. in QoS rule types)
172VALUES_TYPE_CHOICES = "choices"
173VALUES_TYPE_RANGE = "range"
Federico Ressi4c590d72018-10-10 14:01:08 +0200174
175# Security group parameters values mapped by IP version
176DEFAULT_SECURITY_GROUP_RULE_PARAMS = {
177 lib_constants.IP_VERSION_4: {'ethertype': lib_constants.IPv4,
178 'remote_ip_prefix': lib_constants.IPv4_ANY},
179 lib_constants.IP_VERSION_6: {'ethertype': lib_constants.IPv6,
180 'remote_ip_prefix': lib_constants.IPv6_ANY},
181}