Jian Li | 7e8f57e | 2019-01-24 18:31:03 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Foundation |
| 3 | * |
| 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 | */ |
| 16 | package org.onosproject.k8snetworking.api; |
| 17 | |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 18 | import org.onlab.packet.MacAddress; |
| 19 | |
Jian Li | 7e8f57e | 2019-01-24 18:31:03 +0900 | [diff] [blame] | 20 | /** |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 21 | * Provides constants used in kubernetes network switching and routing. |
Jian Li | 7e8f57e | 2019-01-24 18:31:03 +0900 | [diff] [blame] | 22 | */ |
| 23 | public final class Constants { |
| 24 | |
| 25 | private Constants() { |
| 26 | } |
| 27 | |
| 28 | public static final String K8S_NETWORKING_APP_ID = "org.onosproject.k8snetworking"; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 29 | |
| 30 | public static final String ARP_BROADCAST_MODE = "broadcast"; |
| 31 | public static final String ARP_PROXY_MODE = "proxy"; |
| 32 | |
Jian Li | 004526d | 2019-02-25 16:26:27 +0900 | [diff] [blame] | 33 | public static final String NAT_STATEFUL = "stateful"; |
| 34 | public static final String NAT_STATELESS = "stateless"; |
| 35 | |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 36 | public static final String DEFAULT_GATEWAY_MAC_STR = "fe:00:00:00:00:02"; |
Jian Li | 7d111d7 | 2019-04-12 13:58:44 +0900 | [diff] [blame] | 37 | public static final String DEFAULT_ARP_MODE_STR = ARP_PROXY_MODE; |
| 38 | public static final String DEFAULT_HOST_MAC_STR = "fe:00:00:00:00:08"; |
| 39 | public static final String DEFAULT_SERVICE_IP_NAT_MODE_STR = NAT_STATELESS; |
| 40 | public static final String CONTROLLER_MAC_STR = "fe:00:00:00:00:10"; |
| 41 | public static final String SERVICE_FAKE_MAC_STR = "fe:00:00:00:00:20"; |
Jian Li | d89db46 | 2019-02-08 18:21:57 +0900 | [diff] [blame] | 42 | |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 43 | public static final MacAddress DEFAULT_GATEWAY_MAC = |
| 44 | MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR); |
| 45 | |
Jian Li | 004526d | 2019-02-25 16:26:27 +0900 | [diff] [blame] | 46 | public static final String SHIFTED_IP_CIDR = "172.10.0.0/16"; |
| 47 | public static final String SHIFTED_IP_PREFIX = "172.10"; |
Jian Li | 1a2eb5d | 2019-08-27 02:07:05 +0900 | [diff] [blame] | 48 | public static final String SHIFTED_LOCAL_IP_PREFIX = "172.11"; |
Jian Li | 140d8a2 | 2019-04-24 23:41:44 +0900 | [diff] [blame] | 49 | public static final String NODE_IP_PREFIX = "182"; |
Jian Li | 004526d | 2019-02-25 16:26:27 +0900 | [diff] [blame] | 50 | |
Jian Li | 5e8a22a | 2019-02-27 11:48:42 +0900 | [diff] [blame] | 51 | public static final String SRC = "src"; |
| 52 | public static final String DST = "dst"; |
Jian Li | 140d8a2 | 2019-04-24 23:41:44 +0900 | [diff] [blame] | 53 | public static final String A_CLASS = "a"; |
| 54 | public static final String B_CLASS = "b"; |
Jian Li | 5e8a22a | 2019-02-27 11:48:42 +0900 | [diff] [blame] | 55 | |
Jian Li | 1c6156c | 2019-12-24 15:02:05 +0900 | [diff] [blame] | 56 | public static final String DEFAULT_SERVICE_IP_CIDR = "10.96.0.0/12"; |
| 57 | public static final String DEFAULT_SERVICE_IP_NONE = "none"; |
| 58 | |
Jian Li | bde20bf | 2019-01-25 17:34:43 +0900 | [diff] [blame] | 59 | public static final String PORT_NAME_PREFIX_CONTAINER = "veth"; |
| 60 | |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 61 | public static final String ANNOTATION_NETWORK_ID = "networkId"; |
| 62 | public static final String ANNOTATION_PORT_ID = "portId"; |
| 63 | public static final String ANNOTATION_CREATE_TIME = "createTime"; |
| 64 | public static final String ANNOTATION_SEGMENT_ID = "segId"; |
| 65 | |
Jian Li | e1a5b8f | 2019-07-23 17:13:19 +0900 | [diff] [blame] | 66 | public static final long DEFAULT_METADATA_MASK = 0xffffffffffffffffL; |
| 67 | public static final int DEFAULT_NAMESPACE_HASH = 0xffffffff; |
| 68 | |
| 69 | public static final int DEFAULT_SEGMENT_ID = 100; |
| 70 | |
Jian Li | 1a2eb5d | 2019-08-27 02:07:05 +0900 | [diff] [blame] | 71 | public static final int HOST_PREFIX = 32; |
| 72 | |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 73 | // flow priority |
| 74 | public static final int PRIORITY_SNAT_RULE = 26000; |
Jian Li | 4aa1764 | 2019-01-30 00:01:11 +0900 | [diff] [blame] | 75 | public static final int PRIORITY_TUNNEL_TAG_RULE = 30000; |
Jian Li | d89db46 | 2019-02-08 18:21:57 +0900 | [diff] [blame] | 76 | public static final int PRIORITY_TRANSLATION_RULE = 30000; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 77 | public static final int PRIORITY_CT_HOOK_RULE = 30500; |
Jian Li | 7d111d7 | 2019-04-12 13:58:44 +0900 | [diff] [blame] | 78 | public static final int PRIORITY_INTER_ROUTING_RULE = 29000; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 79 | public static final int PRIORITY_CT_RULE = 32000; |
| 80 | public static final int PRIORITY_CT_DROP_RULE = 32500; |
Jian Li | 004526d | 2019-02-25 16:26:27 +0900 | [diff] [blame] | 81 | public static final int PRIORITY_NAT_RULE = 30000; |
Jian Li | 1a2eb5d | 2019-08-27 02:07:05 +0900 | [diff] [blame] | 82 | public static final int PRIORITY_GATEWAY_RULE = 31000; |
| 83 | public static final int PRIORITY_LOCAL_BRIDGE_RULE = 32000; |
Jian Li | 4aa1764 | 2019-01-30 00:01:11 +0900 | [diff] [blame] | 84 | public static final int PRIORITY_SWITCHING_RULE = 30000; |
Jian Li | 7d111d7 | 2019-04-12 13:58:44 +0900 | [diff] [blame] | 85 | public static final int PRIORITY_CIDR_RULE = 30000; |
Jian Li | e1a5b8f | 2019-07-23 17:13:19 +0900 | [diff] [blame] | 86 | public static final int PRIORITY_NAMESPACE_RULE = 31000; |
Jian Li | eb488ea | 2019-04-16 01:50:02 +0900 | [diff] [blame] | 87 | public static final int PRIORITY_STATEFUL_SNAT_RULE = 41000; |
| 88 | public static final int PRIORITY_EXTERNAL_ROUTING_RULE = 25000; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 89 | public static final int PRIORITY_ARP_CONTROL_RULE = 40000; |
| 90 | public static final int PRIORITY_ARP_REPLY_RULE = 40000; |
Jian Li | 44c2b12 | 2019-05-03 14:46:34 +0900 | [diff] [blame] | 91 | public static final int PRIORITY_ARP_POD_RULE = 39000; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 92 | public static final int PRIORITY_ARP_FLOOD_RULE = 39000; |
| 93 | public static final int PRIORITY_FORCED_ACL_RULE = 50000; |
| 94 | public static final int PRIORITY_ICMP_PROBE_RULE = 50000; |
Jian Li | 140d8a2 | 2019-04-24 23:41:44 +0900 | [diff] [blame] | 95 | public static final int PRIORITY_NODE_PORT_RULE = 42000; |
| 96 | public static final int PRIORITY_NODE_PORT_REMOTE_RULE = 41500; |
| 97 | public static final int PRIORITY_NODE_PORT_INTER_RULE = 40000; |
Jian Li | 619fa28 | 2020-09-02 14:45:35 +0900 | [diff] [blame^] | 98 | public static final int PRIORITY_DEFAULT_RULE = 0; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 99 | |
| 100 | // flow table index |
Jian Li | 73d3b6a | 2019-07-08 18:07:53 +0900 | [diff] [blame] | 101 | public static final int STAT_INGRESS_TABLE = 0; |
| 102 | public static final int VTAP_INGRESS_TABLE = 1; |
| 103 | public static final int VTAP_INGRESS_MIRROR_TABLE = 2; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 104 | public static final int VTAG_TABLE = 30; |
| 105 | public static final int ARP_TABLE = 35; |
Jian Li | 73d3b6a | 2019-07-08 18:07:53 +0900 | [diff] [blame] | 106 | public static final int JUMP_TABLE = 40; |
Jian Li | e1a5b8f | 2019-07-23 17:13:19 +0900 | [diff] [blame] | 107 | public static final int NAMESPACE_TABLE = 49; |
Jian Li | 73d3b6a | 2019-07-08 18:07:53 +0900 | [diff] [blame] | 108 | public static final int GROUPING_TABLE = 50; |
Jian Li | 2cc2b63 | 2019-02-18 00:56:40 +0900 | [diff] [blame] | 109 | public static final int NAT_TABLE = 51; |
Jian Li | 004526d | 2019-02-25 16:26:27 +0900 | [diff] [blame] | 110 | public static final int SERVICE_TABLE = 52; |
| 111 | public static final int POD_TABLE = 53; |
Jian Li | 73d3b6a | 2019-07-08 18:07:53 +0900 | [diff] [blame] | 112 | public static final int ACL_TABLE = 55; |
Jian Li | 0f45961 | 2019-07-11 10:38:02 +0900 | [diff] [blame] | 113 | public static final int ACL_INGRESS_WHITE_TABLE = 56; |
| 114 | public static final int ACL_INGRESS_BLACK_TABLE = 57; |
| 115 | public static final int ACL_EGRESS_WHITE_TABLE = 58; |
| 116 | public static final int ACL_EGRESS_BLACK_TABLE = 59; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 117 | public static final int ROUTING_TABLE = 60; |
Jian Li | 73d3b6a | 2019-07-08 18:07:53 +0900 | [diff] [blame] | 118 | public static final int STAT_EGRESS_TABLE = 70; |
| 119 | public static final int VTAP_EGRESS_TABLE = 71; |
| 120 | public static final int VTAP_EGRESS_MIRROR_TABLE = 72; |
Jian Li | 66f6e3c | 2019-01-25 10:24:44 +0900 | [diff] [blame] | 121 | public static final int FORWARDING_TABLE = 80; |
| 122 | public static final int ERROR_TABLE = 100; |
Jian Li | 140d8a2 | 2019-04-24 23:41:44 +0900 | [diff] [blame] | 123 | |
| 124 | public static final int EXT_ENTRY_TABLE = 0; |
| 125 | public static final int POD_RESOLUTION_TABLE = 11; |
Jian Li | 1a2eb5d | 2019-08-27 02:07:05 +0900 | [diff] [blame] | 126 | |
| 127 | public static final int LOCAL_ENTRY_TABLE = 0; |
Jian Li | a6f5838 | 2019-12-16 14:22:13 +0900 | [diff] [blame] | 128 | |
Jian Li | 619fa28 | 2020-09-02 14:45:35 +0900 | [diff] [blame^] | 129 | public static final int TUN_ENTRY_TABLE = 0; |
| 130 | |
Jian Li | a6f5838 | 2019-12-16 14:22:13 +0900 | [diff] [blame] | 131 | // CLI item length |
| 132 | public static final int CLI_ID_LENGTH = 30; |
| 133 | public static final int CLI_NAME_LENGTH = 30; |
| 134 | public static final int CLI_IP_ADDRESSES_LENGTH = 50; |
| 135 | public static final int CLI_IP_ADDRESS_LENGTH = 25; |
| 136 | public static final int CLI_MAC_ADDRESS_LENGTH = 25; |
| 137 | public static final int CLI_PORTS_LENGTH = 20; |
| 138 | public static final int CLI_NAMESPACE_LENGTH = 15; |
| 139 | public static final int CLI_PHASE_LENGTH = 15; |
| 140 | public static final int CLI_TYPE_LENGTH = 15; |
| 141 | public static final int CLI_TYPES_LENGTH = 30; |
| 142 | public static final int CLI_SEG_ID_LENGTH = 10; |
| 143 | public static final int CLI_LABELS_LENGTH = 30; |
| 144 | public static final int CLI_CONTAINERS_LENGTH = 30; |
| 145 | |
| 146 | public static final int CLI_MARGIN_LENGTH = 2; |
Jian Li | 7e8f57e | 2019-01-24 18:31:03 +0900 | [diff] [blame] | 147 | } |