blob: 123caccde3e38468bd9119ce67a9cfb5d6af26a8 [file] [log] [blame]
Hyunsun Moonb974fca2016-06-30 21:20:39 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Hyunsun Moonb974fca2016-06-30 21:20:39 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Hyunsun Moon05400872017-02-07 17:11:25 +090016package org.onosproject.openstacknetworking.api;
Hyunsun Moonb974fca2016-06-30 21:20:39 -070017
Ray Milkey9dc57392018-06-08 08:52:31 -070018import com.google.common.collect.ImmutableMap;
sangho6032f342016-07-07 14:32:03 +090019import org.onlab.packet.MacAddress;
Hyunsun Moonb974fca2016-06-30 21:20:39 -070020
Daniel Parkc4d06402018-05-28 15:57:37 +090021import java.util.Map;
22
Hyunsun Moonb974fca2016-06-30 21:20:39 -070023/**
sangho6032f342016-07-07 14:32:03 +090024 * Provides constants used in OpenStackSwitching.
Hyunsun Moonb974fca2016-06-30 21:20:39 -070025 */
26public final class Constants {
27
28 private Constants() {
29 }
30
Daniel Park7e8c4d82018-08-13 23:47:49 +090031 /**
32 * List of valid openstack port types.
33 */
34 public enum VnicType {
35 NORMAL,
36 DIRECT,
37 UNSUPPORTED
38 }
39 public static final String PORT_NAME_PREFIX_VM = "tap";
40 public static final String PORT_NAME_VHOST_USER_PREFIX_VM = "vhu";
41
Hyunsun Moon44aac662017-02-18 02:07:01 +090042 public static final String OPENSTACK_NETWORKING_APP_ID = "org.onosproject.openstacknetworking";
sangho6032f342016-07-07 14:32:03 +090043
Jian Lieae12362018-04-10 18:48:32 +090044 public static final String ARP_BROADCAST_MODE = "broadcast";
45 public static final String ARP_PROXY_MODE = "proxy";
46
Hyunsun Moonb3eb84d2016-07-27 19:10:52 -070047 public static final String DEFAULT_GATEWAY_MAC_STR = "fe:00:00:00:00:02";
Daniel Park6041f102018-07-06 18:49:45 +090048 public static final String DEFAULT_ARP_MODE_STR = ARP_PROXY_MODE;
Hyunsun Moonb3eb84d2016-07-27 19:10:52 -070049 public static final MacAddress DEFAULT_GATEWAY_MAC = MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
Hyunsun Moonb3eb84d2016-07-27 19:10:52 -070050 public static final MacAddress DEFAULT_EXTERNAL_ROUTER_MAC = MacAddress.valueOf("fe:00:00:00:00:01");
Hyunsun Moonb974fca2016-06-30 21:20:39 -070051
Daniel Parkc4d06402018-05-28 15:57:37 +090052 public static final String PCI_VENDOR_INFO = "pci_vendor_info";
53 public static final String DIRECT = "direct";
54 public static final String PCISLOT = "pci_slot";
55
Jian Liec5c32b2018-07-13 14:28:58 +090056 public static final String ANNOTATION_NETWORK_ID = "networkId";
57 public static final String ANNOTATION_PORT_ID = "portId";
58 public static final String ANNOTATION_CREATE_TIME = "createTime";
59 public static final String ANNOTATION_SEGMENT_ID = "segId";
Daniel Parkec9d1132018-08-19 11:18:03 +090060 public static final String UNSUPPORTED_VENDOR = "unsupported_vendor";
Daniel Parkc4d06402018-05-28 15:57:37 +090061
Hyunsun Moon44aac662017-02-18 02:07:01 +090062 public static final int PRIORITY_TUNNEL_TAG_RULE = 30000;
63 public static final int PRIORITY_FLOATING_INTERNAL = 42000;
64 public static final int PRIORITY_FLOATING_EXTERNAL = 41000;
sanghoe765ce22017-06-23 17:54:57 +090065 public static final int PRIORITY_STATEFUL_SNAT_RULE = 40500;
Hyunsun Moon44aac662017-02-18 02:07:01 +090066 public static final int PRIORITY_ICMP_RULE = 43000;
67 public static final int PRIORITY_INTERNAL_ROUTING_RULE = 28000;
68 public static final int PRIORITY_EXTERNAL_ROUTING_RULE = 25000;
Daniel Park5cdf3ac2018-05-29 10:10:31 +090069 public static final int PRIORITY_EXTERNAL_FLOATING_ROUTING_RULE = 27000;
Hyunsun Moon44aac662017-02-18 02:07:01 +090070 public static final int PRIORITY_SNAT_RULE = 26000;
71 public static final int PRIORITY_SWITCHING_RULE = 30000;
Daniel Parkd1b14d32018-06-12 16:10:28 +090072 public static final int PRIORITY_FLAT_JUMP_UPSTREAM_RULE = 41000;
73 public static final int PRIORITY_FLAT_JUMP_DOWNSTREAM_RULE = 41000;
74 public static final int PRIORITY_FLAT_UPSTREAM_RULE = 41000;
75 public static final int PRIORITY_FLAT_DOWNSTREAM_RULE = 42000;
daniel park796c2eb2018-03-22 17:01:51 +090076 public static final int PRIORITY_DHCP_RULE = 42000;
sangho1aaa7882017-05-31 13:22:47 +090077 public static final int PRIORITY_ADMIN_RULE = 32000;
78 public static final int PRIORITY_ACL_RULE = 31000;
79 public static final int PRIORITY_CT_HOOK_RULE = 30500;
80 public static final int PRIORITY_CT_RULE = 32000;
81 public static final int PRIORITY_CT_DROP_RULE = 32500;
Jian Lieae12362018-04-10 18:48:32 +090082 public static final int PRIORITY_ARP_GATEWAY_RULE = 41000;
83 public static final int PRIORITY_ARP_SUBNET_RULE = 40000;
84 public static final int PRIORITY_ARP_CONTROL_RULE = 40000;
85 public static final int PRIORITY_ARP_REPLY_RULE = 40000;
86 public static final int PRIORITY_ARP_REQUEST_RULE = 40000;
Daniel Park0e1c7b52018-07-07 01:00:14 +090087 public static final int PRIORITY_FORCED_ACL_RULE = 50000;
Jian Li0b93b002018-07-31 13:41:08 +090088 public static final int PRIORITY_ICMP_PROBE_RULE = 50000;
sangho6a9ff0d2017-03-27 11:23:37 +090089
Jian Li87ded822018-07-02 18:31:22 +090090 // flow table index
Jian Li8abf2fe2018-06-12 18:42:30 +090091 public static final int STAT_INBOUND_TABLE = 0;
Jian Li87ded822018-07-02 18:31:22 +090092 public static final int VTAP_INBOUND_TABLE = 1;
93 public static final int VTAP_INBOUND_MIRROR_TABLE = 2;
94 public static final int STAT_FLAT_OUTBOUND_TABLE = 10;
95 public static final int VTAP_FLAT_OUTBOUND_TABLE = 11;
96 public static final int VTAP_FLAT_OUTBOUND_MIRROR_TABLE = 12;
97 public static final int DHCP_ARP_TABLE = 5;
98 public static final int FLAT_TABLE = 20;
99 public static final int VTAG_TABLE = 30;
100 public static final int ACL_TABLE = 40;
101 public static final int CT_TABLE = 41;
102 public static final int JUMP_TABLE = 50;
103 public static final int ROUTING_TABLE = 60;
104 public static final int STAT_OUTBOUND_TABLE = 70;
105 public static final int VTAP_OUTBOUND_TABLE = 71;
106 public static final int VTAP_OUTBOUND_MIRROR_TABLE = 72;
107 public static final int FORWARDING_TABLE = 80;
sanghodc375372017-06-08 10:41:30 +0900108 public static final int GW_COMMON_TABLE = 0;
Jian Li70a2c3f2018-04-13 17:26:31 +0900109 public static final int ERROR_TABLE = 100;
Ray Milkey9dc57392018-06-08 08:52:31 -0700110
Jian Li87ded822018-07-02 18:31:22 +0900111 // group table index
112 public static final int VTAP_INBOUND_GROUP_TABLE = 1;
113 public static final int VTAP_FLAT_OUTBOUND_GROUP_TABLE = 2;
114 public static final int VTAP_OUTBOUND_GROUP_TABLE = 3;
115
Ray Milkey9dc57392018-06-08 08:52:31 -0700116 public static Map<String, String> portNamePrefixMap() {
117 return PORT_NAME_PREFIX_MAP;
118 }
Jian Liec5c32b2018-07-13 14:28:58 +0900119
120 private static final String CAVIUM_PCI_VENDOR_INFO = "177d:9712";
121 private static final String PORT_NAME_PREFIX_CAVIUM = "enp";
122
123 private static final Map<String, String> PORT_NAME_PREFIX_MAP = createPortNamePrefixMap();
124 private static Map<String, String> createPortNamePrefixMap() {
125 //Additional pci vendor information will be added
126 return ImmutableMap.of(CAVIUM_PCI_VENDOR_INFO, PORT_NAME_PREFIX_CAVIUM);
127 }
Hyunsun Moonb974fca2016-06-30 21:20:39 -0700128}