blob: 6475a7ad9f513df1744b3ed545a596dd2b93cbc2 [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
Jian Li7b8c3682019-05-12 13:57:15 +090021import java.nio.charset.StandardCharsets;
Daniel Parkc4d06402018-05-28 15:57:37 +090022import java.util.Map;
23
Hyunsun Moonb974fca2016-06-30 21:20:39 -070024/**
sangho6032f342016-07-07 14:32:03 +090025 * Provides constants used in OpenStackSwitching.
Hyunsun Moonb974fca2016-06-30 21:20:39 -070026 */
27public final class Constants {
28
29 private Constants() {
30 }
31
Daniel Park7e8c4d82018-08-13 23:47:49 +090032 /**
33 * List of valid openstack port types.
34 */
35 public enum VnicType {
36 NORMAL,
37 DIRECT,
38 UNSUPPORTED
39 }
40 public static final String PORT_NAME_PREFIX_VM = "tap";
41 public static final String PORT_NAME_VHOST_USER_PREFIX_VM = "vhu";
42
Jian Li5ecfd1a2018-12-10 11:41:03 +090043 public static final String OPENSTACK_NETWORKING_APP_ID =
44 "org.onosproject.openstacknetworking";
Jian Li7b8c3682019-05-12 13:57:15 +090045 public static final String OPENSTACK_NETWORKING_REST_PATH = "onos/openstacknetworking";
46 public static final int REST_PORT = 8181;
47 public static final String REST_USER = "onos";
48 public static final String REST_PASSWORD = "rocks";
49 public static final String REST_UTF8 = StandardCharsets.UTF_8.name();
sangho6032f342016-07-07 14:32:03 +090050
Jian Lieae12362018-04-10 18:48:32 +090051 public static final String ARP_BROADCAST_MODE = "broadcast";
52 public static final String ARP_PROXY_MODE = "proxy";
53
Hyunsun Moonb3eb84d2016-07-27 19:10:52 -070054 public static final String DEFAULT_GATEWAY_MAC_STR = "fe:00:00:00:00:02";
Jian Li5ecfd1a2018-12-10 11:41:03 +090055 public static final MacAddress DEFAULT_GATEWAY_MAC =
56 MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
57 public static final MacAddress DEFAULT_EXTERNAL_ROUTER_MAC =
58 MacAddress.valueOf("fe:00:00:00:00:01");
Hyunsun Moonb974fca2016-06-30 21:20:39 -070059
Daniel Parkc4d06402018-05-28 15:57:37 +090060 public static final String PCI_VENDOR_INFO = "pci_vendor_info";
61 public static final String DIRECT = "direct";
62 public static final String PCISLOT = "pci_slot";
63
Jian Liec5c32b2018-07-13 14:28:58 +090064 public static final String ANNOTATION_NETWORK_ID = "networkId";
65 public static final String ANNOTATION_PORT_ID = "portId";
66 public static final String ANNOTATION_CREATE_TIME = "createTime";
67 public static final String ANNOTATION_SEGMENT_ID = "segId";
Daniel Parkec9d1132018-08-19 11:18:03 +090068 public static final String UNSUPPORTED_VENDOR = "unsupported_vendor";
Daniel Parkc4d06402018-05-28 15:57:37 +090069
Hyunsun Moon44aac662017-02-18 02:07:01 +090070 public static final int PRIORITY_TUNNEL_TAG_RULE = 30000;
71 public static final int PRIORITY_FLOATING_INTERNAL = 42000;
72 public static final int PRIORITY_FLOATING_EXTERNAL = 41000;
sanghoe765ce22017-06-23 17:54:57 +090073 public static final int PRIORITY_STATEFUL_SNAT_RULE = 40500;
Hyunsun Moon44aac662017-02-18 02:07:01 +090074 public static final int PRIORITY_ICMP_RULE = 43000;
Jian Lifdb8d872019-04-08 10:38:58 +090075 public static final int PRIORITY_ICMP_REQUEST_RULE = 40800;
Hyunsun Moon44aac662017-02-18 02:07:01 +090076 public static final int PRIORITY_INTERNAL_ROUTING_RULE = 28000;
77 public static final int PRIORITY_EXTERNAL_ROUTING_RULE = 25000;
Daniel Park5cdf3ac2018-05-29 10:10:31 +090078 public static final int PRIORITY_EXTERNAL_FLOATING_ROUTING_RULE = 27000;
Hyunsun Moon44aac662017-02-18 02:07:01 +090079 public static final int PRIORITY_SNAT_RULE = 26000;
80 public static final int PRIORITY_SWITCHING_RULE = 30000;
Daniel Parkd1b14d32018-06-12 16:10:28 +090081 public static final int PRIORITY_FLAT_JUMP_UPSTREAM_RULE = 41000;
82 public static final int PRIORITY_FLAT_JUMP_DOWNSTREAM_RULE = 41000;
83 public static final int PRIORITY_FLAT_UPSTREAM_RULE = 41000;
84 public static final int PRIORITY_FLAT_DOWNSTREAM_RULE = 42000;
daniel park796c2eb2018-03-22 17:01:51 +090085 public static final int PRIORITY_DHCP_RULE = 42000;
sangho1aaa7882017-05-31 13:22:47 +090086 public static final int PRIORITY_ADMIN_RULE = 32000;
87 public static final int PRIORITY_ACL_RULE = 31000;
Jian Li1e9cb732018-11-25 23:17:21 +090088 public static final int PRIORITY_ACL_INGRESS_RULE = 30000;
sangho1aaa7882017-05-31 13:22:47 +090089 public static final int PRIORITY_CT_HOOK_RULE = 30500;
90 public static final int PRIORITY_CT_RULE = 32000;
91 public static final int PRIORITY_CT_DROP_RULE = 32500;
Jian Lieae12362018-04-10 18:48:32 +090092 public static final int PRIORITY_ARP_GATEWAY_RULE = 41000;
93 public static final int PRIORITY_ARP_SUBNET_RULE = 40000;
94 public static final int PRIORITY_ARP_CONTROL_RULE = 40000;
95 public static final int PRIORITY_ARP_REPLY_RULE = 40000;
96 public static final int PRIORITY_ARP_REQUEST_RULE = 40000;
Jian Li5c09e212018-10-24 18:23:58 +090097 public static final int PRIORITY_ARP_FLOOD_RULE = 39000;
Daniel Park0e1c7b52018-07-07 01:00:14 +090098 public static final int PRIORITY_FORCED_ACL_RULE = 50000;
Jian Li0b93b002018-07-31 13:41:08 +090099 public static final int PRIORITY_ICMP_PROBE_RULE = 50000;
sangho6a9ff0d2017-03-27 11:23:37 +0900100
Jian Li87ded822018-07-02 18:31:22 +0900101 // flow table index
Jian Li8abf2fe2018-06-12 18:42:30 +0900102 public static final int STAT_INBOUND_TABLE = 0;
Jian Li87ded822018-07-02 18:31:22 +0900103 public static final int VTAP_INBOUND_TABLE = 1;
104 public static final int VTAP_INBOUND_MIRROR_TABLE = 2;
105 public static final int STAT_FLAT_OUTBOUND_TABLE = 10;
106 public static final int VTAP_FLAT_OUTBOUND_TABLE = 11;
107 public static final int VTAP_FLAT_OUTBOUND_MIRROR_TABLE = 12;
Jian Li5c09e212018-10-24 18:23:58 +0900108 public static final int DHCP_TABLE = 5;
Jian Li87ded822018-07-02 18:31:22 +0900109 public static final int FLAT_TABLE = 20;
110 public static final int VTAG_TABLE = 30;
Jian Li5c09e212018-10-24 18:23:58 +0900111 public static final int ARP_TABLE = 35;
Jian Li1e9cb732018-11-25 23:17:21 +0900112 public static final int ACL_EGRESS_TABLE = 40;
113 public static final int ACL_INGRESS_TABLE = 44;
114 public static final int CT_TABLE = 45;
115 public static final int ACL_RECIRC_TABLE = 43;
Jian Li87ded822018-07-02 18:31:22 +0900116 public static final int JUMP_TABLE = 50;
117 public static final int ROUTING_TABLE = 60;
118 public static final int STAT_OUTBOUND_TABLE = 70;
119 public static final int VTAP_OUTBOUND_TABLE = 71;
120 public static final int VTAP_OUTBOUND_MIRROR_TABLE = 72;
121 public static final int FORWARDING_TABLE = 80;
sanghodc375372017-06-08 10:41:30 +0900122 public static final int GW_COMMON_TABLE = 0;
Jian Li70a2c3f2018-04-13 17:26:31 +0900123 public static final int ERROR_TABLE = 100;
Ray Milkey9dc57392018-06-08 08:52:31 -0700124
Jian Li87ded822018-07-02 18:31:22 +0900125 // group table index
126 public static final int VTAP_INBOUND_GROUP_TABLE = 1;
127 public static final int VTAP_FLAT_OUTBOUND_GROUP_TABLE = 2;
128 public static final int VTAP_OUTBOUND_GROUP_TABLE = 3;
129
Jian Li621f73c2018-12-15 01:49:22 +0900130 // network type
131 public static final String VXLAN = "VXLAN";
132 public static final String VLAN = "VLAN";
133 public static final String FLAT = "FLAT";
134 public static final String GRE = "GRE";
135 public static final String GENEVE = "GENEVE";
136
Ray Milkey9dc57392018-06-08 08:52:31 -0700137 public static Map<String, String> portNamePrefixMap() {
138 return PORT_NAME_PREFIX_MAP;
139 }
Jian Liec5c32b2018-07-13 14:28:58 +0900140
141 private static final String CAVIUM_PCI_VENDOR_INFO = "177d:9712";
142 private static final String PORT_NAME_PREFIX_CAVIUM = "enp";
143
144 private static final Map<String, String> PORT_NAME_PREFIX_MAP = createPortNamePrefixMap();
145 private static Map<String, String> createPortNamePrefixMap() {
146 //Additional pci vendor information will be added
147 return ImmutableMap.of(CAVIUM_PCI_VENDOR_INFO, PORT_NAME_PREFIX_CAVIUM);
148 }
Hyunsun Moonb974fca2016-06-30 21:20:39 -0700149}