Debian Codegraph @

neutron_lib/plugins/ml2/ovs_constants.py

raw
1 # Copyright (c) 2021 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
17
18 # Special vlan_tci value indicating flat network
19 FLAT_VLAN_TCI = '0x0000/0x1fff'
20
21 # Topic for tunnel notifications between the plugin and agent
22 TUNNEL = 'tunnel'
23
24 # Name prefixes for veth device or patch port pair linking the integration
25 # bridge with the physical bridge for a physical network
26 PEER_INTEGRATION_PREFIX = 'int-'
27 PEER_PHYSICAL_PREFIX = 'phy-'
28
29 # Nonexistent peer used to create patch ports without associating them, it
30 # allows to define flows before association
31 NONEXISTENT_PEER = 'nonexistent-peer'
32
33 # The different types of tunnels
34 TUNNEL_NETWORK_TYPES = [
35 constants.TYPE_GRE,
36 constants.TYPE_VXLAN,
37 constants.TYPE_GENEVE
38 ]
39
40 # --- OpenFlow table IDs
41
42 # --- Integration bridge (int_br)
43
44 LOCAL_SWITCHING = 0
45
46 # The pyhsical network types of support DVR router
47 DVR_PHYSICAL_NETWORK_TYPES = [constants.TYPE_VLAN, constants.TYPE_FLAT]
48
49 # Various tables for DVR use of integration bridge flows
50 DVR_TO_SRC_MAC = 1
51 DVR_TO_SRC_MAC_PHYSICAL = 2
52 ARP_DVR_MAC_TO_DST_MAC = 3
53 ARP_DVR_MAC_TO_DST_MAC_PHYSICAL = 4
54 CANARY_TABLE = 23
55
56 # Table for ARP poison/spoofing prevention rules
57 ARP_SPOOF_TABLE = 24
58
59 # Table for MAC spoof filtering
60 MAC_SPOOF_TABLE = 25
61
62 LOCAL_EGRESS_TABLE = 30
63 LOCAL_IP_TABLE = 31
64
65 # packet rate limit table
66 PACKET_RATE_LIMIT = 58
67 # bandwidth rate limit table
68 BANDWIDTH_RATE_LIMIT = 59
69
70 # Table to decide whether further filtering is needed
71 TRANSIENT_TABLE = 60
72 LOCAL_MAC_DIRECT = 61
73 TRANSIENT_EGRESS_TABLE = 62
74
75 # Table for DHCP
76 DHCP_IPV4_TABLE = 77
77 DHCP_IPV6_TABLE = 78
78
79 # Tables used for ovs firewall
80 BASE_EGRESS_TABLE = 71
81 RULES_EGRESS_TABLE = 72
82 ACCEPT_OR_INGRESS_TABLE = 73
83 BASE_INGRESS_TABLE = 81
84 RULES_INGRESS_TABLE = 82
85
86 OVS_FIREWALL_TABLES = (
87 BASE_EGRESS_TABLE,
88 RULES_EGRESS_TABLE,
89 ACCEPT_OR_INGRESS_TABLE,
90 BASE_INGRESS_TABLE,
91 RULES_INGRESS_TABLE,
92 )
93
94 # Tables for parties interacting with ovs firewall
95 ACCEPTED_EGRESS_TRAFFIC_TABLE = 91
96 ACCEPTED_INGRESS_TRAFFIC_TABLE = 92
97 DROPPED_TRAFFIC_TABLE = 93
98 ACCEPTED_EGRESS_TRAFFIC_NORMAL_TABLE = 94
99
100 INT_BR_ALL_TABLES = (
101 LOCAL_SWITCHING,
102 DVR_TO_SRC_MAC,
103 DVR_TO_SRC_MAC_PHYSICAL,
104 CANARY_TABLE,
105 ARP_SPOOF_TABLE,
106 MAC_SPOOF_TABLE,
107 LOCAL_MAC_DIRECT,
108 LOCAL_EGRESS_TABLE,
109 LOCAL_IP_TABLE,
110 PACKET_RATE_LIMIT,
111 BANDWIDTH_RATE_LIMIT,
112 TRANSIENT_TABLE,
113 TRANSIENT_EGRESS_TABLE,
114 BASE_EGRESS_TABLE,
115 RULES_EGRESS_TABLE,
116 ACCEPT_OR_INGRESS_TABLE,
117 DHCP_IPV4_TABLE,
118 DHCP_IPV6_TABLE,
119 BASE_INGRESS_TABLE,
120 RULES_INGRESS_TABLE,
121 ACCEPTED_EGRESS_TRAFFIC_TABLE,
122 ACCEPTED_INGRESS_TRAFFIC_TABLE,
123 DROPPED_TRAFFIC_TABLE)
124
125 # --- Tunnel bridge (tun_br)
126
127 # Various tables for tunneling flows
128 DVR_PROCESS = 1
129 PATCH_LV_TO_TUN = 2
130 GRE_TUN_TO_LV = 3
131 VXLAN_TUN_TO_LV = 4
132 GENEVE_TUN_TO_LV = 6
133
134 DVR_NOT_LEARN = 9
135 LEARN_FROM_TUN = 10
136 UCAST_TO_TUN = 20
137 ARP_RESPONDER = 21
138 FLOOD_TO_TUN = 22
139 # NOTE(vsaienko): transit table used by networking-bagpipe driver to
140 # mirror traffic to EVPN and standard tunnels to gateway nodes
141 BAGPIPE_FLOOD_TO_TUN_BROADCAST = 222
142
143 TUN_BR_ALL_TABLES = (
144 LOCAL_SWITCHING,
145 DVR_PROCESS,
146 PATCH_LV_TO_TUN,
147 GRE_TUN_TO_LV,
148 VXLAN_TUN_TO_LV,
149 GENEVE_TUN_TO_LV,
150 DVR_NOT_LEARN,
151 LEARN_FROM_TUN,
152 UCAST_TO_TUN,
153 ARP_RESPONDER,
154 FLOOD_TO_TUN)
155
156 # --- Physical Bridges (phys_brs)
157
158 # Various tables for DVR use of physical bridge flows
159 DVR_PROCESS_PHYSICAL = 1
160 LOCAL_VLAN_TRANSLATION = 2
161 DVR_NOT_LEARN_PHYSICAL = 3
162
163 METADATA_EGRESS_NAT = 80
164 METADATA_EGRESS_OUTPUT = 87
165 METADATA_IP_ARP_RESPONDER = 90
166 METADATA_INGRESS_DIRECT = 91
167
168 PHY_BR_ALL_TABLES = (
169 LOCAL_SWITCHING,
170 DVR_PROCESS_PHYSICAL,
171 LOCAL_VLAN_TRANSLATION,
172 DVR_NOT_LEARN_PHYSICAL,
173 METADATA_EGRESS_NAT,
174 METADATA_EGRESS_OUTPUT,
175 METADATA_IP_ARP_RESPONDER,
176 METADATA_INGRESS_DIRECT,
177 )
178
179 # --- end of OpenFlow table IDs
180
181 # type for ARP reply in ARP header
182 ARP_REPLY = '0x2'
183
184 # Map tunnel types to tables number
185 TUN_TABLE = {constants.TYPE_GRE: GRE_TUN_TO_LV,
186 constants.TYPE_VXLAN: VXLAN_TUN_TO_LV,
187 constants.TYPE_GENEVE: GENEVE_TUN_TO_LV}
188
189
190 # The default respawn interval for the ovsdb monitor
191 DEFAULT_OVSDBMON_RESPAWN = 30
192
193 # Represent invalid OF Port
194 OFPORT_INVALID = -1
195
196 ARP_RESPONDER_ACTIONS = ('move:NXM_OF_ETH_SRC[]->NXM_OF_ETH_DST[],'
197 'mod_dl_src:%(mac)s,'
198 'load:0x2->NXM_OF_ARP_OP[],'
199 'move:NXM_NX_ARP_SHA[]->NXM_NX_ARP_THA[],'
200 'move:NXM_OF_ARP_SPA[]->NXM_OF_ARP_TPA[],'
201 'load:%(mac)#x->NXM_NX_ARP_SHA[],'
202 'load:%(ip)#x->NXM_OF_ARP_SPA[],'
203 'in_port')
204
205 # Represent ovs status
206 OVS_RESTARTED = 0
207 OVS_NORMAL = 1
208 OVS_DEAD = 2
209
210 EXTENSION_DRIVER_TYPE = 'ovs'
211
212 # ovs datapath types
213 OVS_DATAPATH_SYSTEM = 'system'
214 OVS_DATAPATH_NETDEV = 'netdev'
215 OVS_DPDK_VHOST_USER = 'dpdkvhostuser'
216 OVS_DPDK_VHOST_USER_CLIENT = 'dpdkvhostuserclient'
217 OVS_DPDK = 'dpdk'
218
219 OVS_DPDK_PORT_TYPES = [OVS_DPDK_VHOST_USER,
220 OVS_DPDK_VHOST_USER_CLIENT,
221 OVS_DPDK,
222 ]
223
224 # default ovs vhost-user socket location
225 VHOST_USER_SOCKET_DIR = '/var/run/openvswitch'
226
227 MAX_DEVICE_RETRIES = 5
228
229 # OpenFlow version constants
230 OPENFLOW10 = "OpenFlow10"
231 OPENFLOW11 = "OpenFlow11"
232 OPENFLOW12 = "OpenFlow12"
233 OPENFLOW13 = "OpenFlow13"
234 OPENFLOW14 = "OpenFlow14"
235 OPENFLOW15 = "OpenFlow15"
236
237 OPENFLOW_MAX_PRIORITY = 65535
238
239 # A placeholder for dead vlans.
240 DEAD_VLAN_TAG = constants.MAX_VLAN_TAG + 1
241
242 # callback resource for setting 'bridge_name' in the 'binding:vif_details'
243 OVS_BRIDGE_NAME = 'ovs_bridge_name'
244
245 # callback resource for notifying to ovsdb handler
246 OVSDB_RESOURCE = 'ovsdb'
247
248 # Used in ovs port 'external_ids' in order mark it for no cleanup when
249 # ovs_cleanup script is used.
250 SKIP_CLEANUP = 'skip_cleanup'