blob: 6352bb298d4b89e3a6a1e342d6a97487bb76427c [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";
48 public static final MacAddress DEFAULT_GATEWAY_MAC = MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
Hyunsun Moonb3eb84d2016-07-27 19:10:52 -070049 public static final MacAddress DEFAULT_EXTERNAL_ROUTER_MAC = MacAddress.valueOf("fe:00:00:00:00:01");
Hyunsun Moonb974fca2016-06-30 21:20:39 -070050
Daniel Parkc4d06402018-05-28 15:57:37 +090051 public static final String PCI_VENDOR_INFO = "pci_vendor_info";
52 public static final String DIRECT = "direct";
53 public static final String PCISLOT = "pci_slot";
54
Jian Liec5c32b2018-07-13 14:28:58 +090055 public static final String ANNOTATION_NETWORK_ID = "networkId";
56 public static final String ANNOTATION_PORT_ID = "portId";
57 public static final String ANNOTATION_CREATE_TIME = "createTime";
58 public static final String ANNOTATION_SEGMENT_ID = "segId";
Daniel Parkec9d1132018-08-19 11:18:03 +090059 public static final String UNSUPPORTED_VENDOR = "unsupported_vendor";
Daniel Parkc4d06402018-05-28 15:57:37 +090060
Hyunsun Moon44aac662017-02-18 02:07:01 +090061 public static final int PRIORITY_TUNNEL_TAG_RULE = 30000;
62 public static final int PRIORITY_FLOATING_INTERNAL = 42000;
63 public static final int PRIORITY_FLOATING_EXTERNAL = 41000;
sanghoe765ce22017-06-23 17:54:57 +090064 public static final int PRIORITY_STATEFUL_SNAT_RULE = 40500;
Hyunsun Moon44aac662017-02-18 02:07:01 +090065 public static final int PRIORITY_ICMP_RULE = 43000;
66 public static final int PRIORITY_INTERNAL_ROUTING_RULE = 28000;
67 public static final int PRIORITY_EXTERNAL_ROUTING_RULE = 25000;
Daniel Park5cdf3ac2018-05-29 10:10:31 +090068 public static final int PRIORITY_EXTERNAL_FLOATING_ROUTING_RULE = 27000;
Hyunsun Moon44aac662017-02-18 02:07:01 +090069 public static final int PRIORITY_SNAT_RULE = 26000;
70 public static final int PRIORITY_SWITCHING_RULE = 30000;
Daniel Parkd1b14d32018-06-12 16:10:28 +090071 public static final int PRIORITY_FLAT_JUMP_UPSTREAM_RULE = 41000;
72 public static final int PRIORITY_FLAT_JUMP_DOWNSTREAM_RULE = 41000;
73 public static final int PRIORITY_FLAT_UPSTREAM_RULE = 41000;
74 public static final int PRIORITY_FLAT_DOWNSTREAM_RULE = 42000;
daniel park796c2eb2018-03-22 17:01:51 +090075 public static final int PRIORITY_DHCP_RULE = 42000;
sangho1aaa7882017-05-31 13:22:47 +090076 public static final int PRIORITY_ADMIN_RULE = 32000;
77 public static final int PRIORITY_ACL_RULE = 31000;
Jian Li1e9cb732018-11-25 23:17:21 +090078 public static final int PRIORITY_ACL_INGRESS_RULE = 30000;
sangho1aaa7882017-05-31 13:22:47 +090079 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;
Jian Li5c09e212018-10-24 18:23:58 +090087 public static final int PRIORITY_ARP_FLOOD_RULE = 39000;
Daniel Park0e1c7b52018-07-07 01:00:14 +090088 public static final int PRIORITY_FORCED_ACL_RULE = 50000;
Jian Li0b93b002018-07-31 13:41:08 +090089 public static final int PRIORITY_ICMP_PROBE_RULE = 50000;
sangho6a9ff0d2017-03-27 11:23:37 +090090
Jian Li87ded822018-07-02 18:31:22 +090091 // flow table index
Jian Li8abf2fe2018-06-12 18:42:30 +090092 public static final int STAT_INBOUND_TABLE = 0;
Jian Li87ded822018-07-02 18:31:22 +090093 public static final int VTAP_INBOUND_TABLE = 1;
94 public static final int VTAP_INBOUND_MIRROR_TABLE = 2;
95 public static final int STAT_FLAT_OUTBOUND_TABLE = 10;
96 public static final int VTAP_FLAT_OUTBOUND_TABLE = 11;
97 public static final int VTAP_FLAT_OUTBOUND_MIRROR_TABLE = 12;
Jian Li5c09e212018-10-24 18:23:58 +090098 public static final int DHCP_TABLE = 5;
Jian Li87ded822018-07-02 18:31:22 +090099 public static final int FLAT_TABLE = 20;
100 public static final int VTAG_TABLE = 30;
Jian Li5c09e212018-10-24 18:23:58 +0900101 public static final int ARP_TABLE = 35;
Jian Li1e9cb732018-11-25 23:17:21 +0900102 public static final int ACL_EGRESS_TABLE = 40;
103 public static final int ACL_INGRESS_TABLE = 44;
104 public static final int CT_TABLE = 45;
105 public static final int ACL_RECIRC_TABLE = 43;
Jian Li87ded822018-07-02 18:31:22 +0900106 public static final int JUMP_TABLE = 50;
107 public static final int ROUTING_TABLE = 60;
108 public static final int STAT_OUTBOUND_TABLE = 70;
109 public static final int VTAP_OUTBOUND_TABLE = 71;
110 public static final int VTAP_OUTBOUND_MIRROR_TABLE = 72;
111 public static final int FORWARDING_TABLE = 80;
sanghodc375372017-06-08 10:41:30 +0900112 public static final int GW_COMMON_TABLE = 0;
Jian Li70a2c3f2018-04-13 17:26:31 +0900113 public static final int ERROR_TABLE = 100;
Ray Milkey9dc57392018-06-08 08:52:31 -0700114
Jian Li87ded822018-07-02 18:31:22 +0900115 // group table index
116 public static final int VTAP_INBOUND_GROUP_TABLE = 1;
117 public static final int VTAP_FLAT_OUTBOUND_GROUP_TABLE = 2;
118 public static final int VTAP_OUTBOUND_GROUP_TABLE = 3;
119
Ray Milkey9dc57392018-06-08 08:52:31 -0700120 public static Map<String, String> portNamePrefixMap() {
121 return PORT_NAME_PREFIX_MAP;
122 }
Jian Liec5c32b2018-07-13 14:28:58 +0900123
124 private static final String CAVIUM_PCI_VENDOR_INFO = "177d:9712";
125 private static final String PORT_NAME_PREFIX_CAVIUM = "enp";
126
127 private static final Map<String, String> PORT_NAME_PREFIX_MAP = createPortNamePrefixMap();
128 private static Map<String, String> createPortNamePrefixMap() {
129 //Additional pci vendor information will be added
130 return ImmutableMap.of(CAVIUM_PCI_VENDOR_INFO, PORT_NAME_PREFIX_CAVIUM);
131 }
Hyunsun Moonb974fca2016-06-30 21:20:39 -0700132}