Chandan Kumar | 5e61987 | 2017-09-07 22:23:55 +0530 | [diff] [blame] | 1 | # 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 | |
| 16 | from neutron_lib import constants as lib_constants |
| 17 | |
| 18 | |
| 19 | ROUTER_PORT_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \ |
| 20 | (lib_constants.DEVICE_OWNER_ROUTER_GW,) |
| 21 | |
| 22 | ROUTER_STATUS_ACTIVE = 'ACTIVE' |
| 23 | ROUTER_STATUS_ERROR = 'ERROR' |
| 24 | |
| 25 | DEVICE_ID_RESERVED_DHCP_PORT = "reserved_dhcp_port" |
| 26 | |
| 27 | HA_ROUTER_STATE_KEY = '_ha_state' |
| 28 | METERING_LABEL_KEY = '_metering_labels' |
| 29 | FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces' |
| 30 | SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces' |
| 31 | DVR_SNAT_BOUND = 'dvr_snat_bound' |
| 32 | L3_AGENT_MODE_DVR_NO_EXTERNAL = 'dvr_no_external' |
| 33 | |
| 34 | HA_NETWORK_NAME = 'HA network tenant %s' |
| 35 | HA_SUBNET_NAME = 'HA subnet tenant %s' |
| 36 | HA_PORT_NAME = 'HA port tenant %s' |
| 37 | HA_ROUTER_STATE_ACTIVE = 'active' |
| 38 | HA_ROUTER_STATE_STANDBY = 'standby' |
| 39 | |
| 40 | PAGINATION_INFINITE = 'infinite' |
| 41 | |
| 42 | SORT_DIRECTION_ASC = 'asc' |
| 43 | SORT_DIRECTION_DESC = 'desc' |
| 44 | |
| 45 | ETHERTYPE_NAME_ARP = 'arp' |
| 46 | ETHERTYPE_ARP = 0x0806 |
| 47 | ETHERTYPE_IP = 0x0800 |
| 48 | ETHERTYPE_IPV6 = 0x86DD |
| 49 | |
| 50 | IP_PROTOCOL_NAME_ALIASES = {lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY: |
| 51 | lib_constants.PROTO_NAME_IPV6_ICMP} |
| 52 | |
| 53 | VALID_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 | |
| 56 | IP_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. |
| 63 | IPTABLES_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 |
| 71 | PROVISIONAL_IPV6_PD_PREFIX = '::/64' |
| 72 | |
| 73 | # Timeout in seconds for getting an IPv6 LLA |
| 74 | LLA_TASK_TIMEOUT = 40 |
| 75 | |
| 76 | # length of all device prefixes (e.g. qvo, tap, qvb) |
| 77 | LINUX_DEV_PREFIX_LEN = 3 |
| 78 | # must be shorter than linux IFNAMSIZ (which is 16) |
| 79 | LINUX_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. |
| 84 | INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX, |
| 85 | lib_constants.VETH_DEVICE_PREFIX, |
| 86 | lib_constants.SNAT_INT_DEV_PREFIX) |
| 87 | |
| 88 | ATTRIBUTES_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. |
| 93 | DB_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 |
| 100 | RPC_NAMESPACE_DHCP_PLUGIN = None |
| 101 | # RPC interface for the metadata service to get info from the plugin side |
| 102 | RPC_NAMESPACE_METADATA = None |
| 103 | # RPC interface for agent to plugin security group API |
| 104 | RPC_NAMESPACE_SECGROUP = None |
| 105 | # RPC interface for agent to plugin DVR api |
| 106 | RPC_NAMESPACE_DVR = None |
| 107 | # RPC interface for reporting state back to the plugin |
| 108 | RPC_NAMESPACE_STATE = None |
| 109 | # RPC interface for agent to plugin resources API |
| 110 | RPC_NAMESPACE_RESOURCES = None |
| 111 | |
| 112 | # Default network MTU value when not configured |
| 113 | DEFAULT_NETWORK_MTU = 1500 |
| 114 | IPV6_MIN_MTU = 1280 |
| 115 | |
| 116 | ROUTER_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 |
| 120 | AGENT_NEW = 'new' |
| 121 | # agent is alive |
| 122 | AGENT_ALIVE = 'alive' |
| 123 | # agent has just returned to alive after being dead |
| 124 | AGENT_REVIVED = 'revived' |
| 125 | |
| 126 | INGRESS_DIRECTION = 'ingress' |
| 127 | EGRESS_DIRECTION = 'egress' |
| 128 | |
| 129 | VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION) |
| 130 | VALID_ETHERTYPES = (lib_constants.IPv4, lib_constants.IPv6) |
| 131 | |
| 132 | IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6] |
| 133 | |
| 134 | PORT_RANGE_MIN = 1 |
| 135 | PORT_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. |
| 145 | ACCEPT_RA_DISABLED = 0 |
| 146 | ACCEPT_RA_WITHOUT_FORWARDING = 1 |
| 147 | ACCEPT_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. |
| 154 | PRIVATE_CIDR_RANGE = '169.254.0.0/16' |
| 155 | DVR_FIP_LL_CIDR = '169.254.64.0/18' |
| 156 | L3_HA_NET_CIDR = '169.254.192.0/18' |
| 157 | METADATA_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 |
| 161 | IPAM_ALLOCATION_STATUS_ALLOCATED = 'ALLOCATED' |
| 162 | |
| 163 | VALID_IPAM_ALLOCATION_STATUSES = (IPAM_ALLOCATION_STATUS_ALLOCATED,) |
| 164 | |
| 165 | # Port binding states for Live Migration |
| 166 | PORT_BINDING_STATUS_ACTIVE = 'ACTIVE' |
| 167 | PORT_BINDING_STATUS_INACTIVE = 'INACTIVE' |
| 168 | PORT_BINDING_STATUSES = (PORT_BINDING_STATUS_ACTIVE, |
| 169 | PORT_BINDING_STATUS_INACTIVE) |
| 170 | |
| 171 | VALID_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) |
| 176 | VALUES_TYPE_CHOICES = "choices" |
| 177 | VALUES_TYPE_RANGE = "range" |