Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-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 | |
| 17 | package org.onosproject.pipelines.fabric; |
| 18 | |
| 19 | import org.onosproject.net.pi.model.PiActionId; |
| 20 | import org.onosproject.net.pi.model.PiActionParamId; |
| 21 | import org.onosproject.net.pi.model.PiActionProfileId; |
| 22 | import org.onosproject.net.pi.model.PiControlMetadataId; |
| 23 | import org.onosproject.net.pi.model.PiCounterId; |
| 24 | import org.onosproject.net.pi.model.PiMatchFieldId; |
| 25 | import org.onosproject.net.pi.model.PiTableId; |
| 26 | /** |
| 27 | * Constants for fabric pipeline. |
| 28 | */ |
| 29 | public final class FabricConstants { |
| 30 | |
| 31 | // hide default constructor |
| 32 | private FabricConstants() { |
| 33 | } |
| 34 | |
| 35 | public static final String DOT = "."; |
| 36 | // Header IDs |
| 37 | public static final String HDR = "hdr"; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 38 | public static final String STANDARD_METADATA = "standard_metadata"; |
| 39 | public static final String MPLS = "mpls"; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 40 | public static final String FABRIC_METADATA = "fabric_metadata"; |
| 41 | public static final String IPV4 = "ipv4"; |
| 42 | public static final String IPV6 = "ipv6"; |
| 43 | public static final String ETHERNET = "ethernet"; |
| 44 | public static final String VLAN_TAG = "vlan_tag"; |
| 45 | public static final String ICMP = "icmp"; |
| 46 | |
| 47 | // Header field IDs |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 48 | public static final PiMatchFieldId HF_FABRIC_METADATA_L4_SRC_PORT_ID = |
| 49 | buildPiMatchField(FABRIC_METADATA, "l4_src_port", false); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 50 | public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID = |
| 51 | buildPiMatchField(IPV4, "src_addr", true); |
| 52 | public static final PiMatchFieldId HF_VLAN_TAG_VLAN_ID_ID = |
| 53 | buildPiMatchField(VLAN_TAG, "vlan_id", true); |
| 54 | public static final PiMatchFieldId HF_MPLS_LABEL_ID = |
| 55 | buildPiMatchField(MPLS, "label", true); |
| 56 | public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID = |
| 57 | buildPiMatchField(IPV6, "dst_addr", true); |
| 58 | public static final PiMatchFieldId HF_ETHERNET_SRC_ADDR_ID = |
| 59 | buildPiMatchField(ETHERNET, "src_addr", true); |
| 60 | public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID = |
| 61 | buildPiMatchField(ICMP, "icmp_type", true); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 62 | public static final PiMatchFieldId HF_FABRIC_METADATA_NEXT_ID_ID = |
| 63 | buildPiMatchField(FABRIC_METADATA, "next_id", false); |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 64 | public static final PiMatchFieldId HF_FABRIC_METADATA_L4_DST_PORT_ID = |
| 65 | buildPiMatchField(FABRIC_METADATA, "l4_dst_port", false); |
| 66 | public static final PiMatchFieldId HF_STANDARD_METADATA_INGRESS_PORT_ID = |
| 67 | buildPiMatchField(STANDARD_METADATA, "ingress_port", false); |
| 68 | public static final PiMatchFieldId HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID = |
| 69 | buildPiMatchField(FABRIC_METADATA, "original_ether_type", false); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 70 | public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID = |
| 71 | buildPiMatchField(IPV4, "dst_addr", true); |
| 72 | public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID = |
| 73 | buildPiMatchField(VLAN_TAG, "is_valid", true); |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 74 | public static final PiMatchFieldId HF_FABRIC_METADATA_IP_PROTO_ID = |
| 75 | buildPiMatchField(FABRIC_METADATA, "ip_proto", false); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 76 | public static final PiMatchFieldId HF_ETHERNET_DST_ADDR_ID = |
| 77 | buildPiMatchField(ETHERNET, "dst_addr", true); |
| 78 | public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID = |
| 79 | buildPiMatchField(ICMP, "icmp_code", true); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 80 | |
| 81 | private static PiMatchFieldId buildPiMatchField(String header, String field, boolean withHdrPrefix) { |
| 82 | if (withHdrPrefix) { |
| 83 | return PiMatchFieldId.of(HDR + DOT + header + DOT + field); |
| 84 | } else { |
| 85 | return PiMatchFieldId.of(header + DOT + field); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // Table IDs |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 90 | public static final PiTableId TBL_ACL_ID = |
| 91 | PiTableId.of("FabricIngress.forwarding.acl"); |
| 92 | public static final PiTableId TBL_HASHED_ID = |
| 93 | PiTableId.of("FabricIngress.next.hashed"); |
| 94 | public static final PiTableId TBL_MPLS_ID = |
| 95 | PiTableId.of("FabricIngress.forwarding.mpls"); |
| 96 | public static final PiTableId TBL_MULTICAST_ID = |
| 97 | PiTableId.of("FabricIngress.next.multicast"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 98 | public static final PiTableId TBL_MULTICAST_V4_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 99 | PiTableId.of("FabricIngress.forwarding.multicast_v4"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 100 | public static final PiTableId TBL_MULTICAST_V6_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 101 | PiTableId.of("FabricIngress.forwarding.multicast_v6"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 102 | public static final PiTableId TBL_UNICAST_V4_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 103 | PiTableId.of("FabricIngress.forwarding.unicast_v4"); |
| 104 | public static final PiTableId TBL_FWD_CLASSIFIER_ID = |
| 105 | PiTableId.of("FabricIngress.filtering.fwd_classifier"); |
| 106 | public static final PiTableId TBL_BRIDGING_ID = |
| 107 | PiTableId.of("FabricIngress.forwarding.bridging"); |
| 108 | public static final PiTableId TBL_INGRESS_PORT_VLAN_ID = |
| 109 | PiTableId.of("FabricIngress.filtering.ingress_port_vlan"); |
| 110 | public static final PiTableId TBL_UNICAST_V6_ID = |
| 111 | PiTableId.of("FabricIngress.forwarding.unicast_v6"); |
| 112 | public static final PiTableId TBL_SIMPLE_ID = |
| 113 | PiTableId.of("FabricIngress.next.simple"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 114 | |
| 115 | // Indirect Counter IDs |
| 116 | public static final PiCounterId CNT_EGRESS_PORT_COUNTER_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 117 | PiCounterId.of("FabricIngress.port_counters_control.egress_port_counter"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 118 | public static final PiCounterId CNT_INGRESS_PORT_COUNTER_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 119 | PiCounterId.of("FabricIngress.port_counters_control.ingress_port_counter"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 120 | |
| 121 | // Direct Counter IDs |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 122 | public static final PiCounterId CNT_ACL_COUNTER_ID = |
| 123 | PiCounterId.of("FabricIngress.forwarding.acl_counter"); |
| 124 | public static final PiCounterId CNT_MULTICAST_COUNTER_ID = |
| 125 | PiCounterId.of("FabricIngress.next.multicast_counter"); |
| 126 | public static final PiCounterId CNT_SIMPLE_COUNTER_ID = |
| 127 | PiCounterId.of("FabricIngress.next.simple_counter"); |
| 128 | public static final PiCounterId CNT_FWD_CLASSIFIER_COUNTER_ID = |
| 129 | PiCounterId.of("FabricIngress.filtering.fwd_classifier_counter"); |
| 130 | public static final PiCounterId CNT_BRIDGING_COUNTER_ID = |
| 131 | PiCounterId.of("FabricIngress.forwarding.bridging_counter"); |
| 132 | public static final PiCounterId CNT_MULTICAST_V6_COUNTER_ID = |
| 133 | PiCounterId.of("FabricIngress.forwarding.multicast_v6_counter"); |
| 134 | public static final PiCounterId CNT_MULTICAST_V4_COUNTER_ID = |
| 135 | PiCounterId.of("FabricIngress.forwarding.multicast_v4_counter"); |
| 136 | public static final PiCounterId CNT_UNICAST_V6_COUNTER_ID = |
| 137 | PiCounterId.of("FabricIngress.forwarding.unicast_v6_counter"); |
| 138 | public static final PiCounterId CNT_UNICAST_V4_COUNTER_ID = |
| 139 | PiCounterId.of("FabricIngress.forwarding.unicast_v4_counter"); |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 140 | public static final PiCounterId CNT_INGRESS_PORT_VLAN_COUNTER_ID = |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 141 | PiCounterId.of("FabricIngress.filtering.ingress_port_vlan_counter"); |
| 142 | public static final PiCounterId CNT_MPLS_COUNTER_ID = |
| 143 | PiCounterId.of("FabricIngress.forwarding.mpls_counter"); |
| 144 | public static final PiCounterId CNT_HASHED_COUNTER_ID = |
| 145 | PiCounterId.of("FabricIngress.next.hashed_counter"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 146 | |
| 147 | // Action IDs |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 148 | public static final PiActionId ACT_FABRICINGRESS_FILTERING_DROP_ID = |
| 149 | PiActionId.of("FabricIngress.filtering.drop"); |
| 150 | public static final PiActionId ACT_FABRICINGRESS_FORWARDING_POP_MPLS_AND_NEXT_ID = |
| 151 | PiActionId.of("FabricIngress.forwarding.pop_mpls_and_next"); |
| 152 | public static final PiActionId ACT_FABRICINGRESS_FILTERING_SET_FORWARDING_TYPE_ID = |
| 153 | PiActionId.of("FabricIngress.filtering.set_forwarding_type"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 154 | public static final PiActionId ACT_NOP_ID = PiActionId.of("nop"); |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 155 | public static final PiActionId ACT_FABRICINGRESS_FILTERING_SET_VLAN_ID = |
| 156 | PiActionId.of("FabricIngress.filtering.set_vlan"); |
| 157 | public static final PiActionId ACT_FABRICINGRESS_NEXT_MPLS_ROUTING_V6_ID = |
| 158 | PiActionId.of("FabricIngress.next.mpls_routing_v6"); |
| 159 | public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction"); |
| 160 | public static final PiActionId ACT_FABRICINGRESS_NEXT_SET_MCAST_GROUP_ID = |
| 161 | PiActionId.of("FabricIngress.next.set_mcast_group"); |
| 162 | public static final PiActionId ACT_FABRICINGRESS_FORWARDING_DUPLICATE_TO_CONTROLLER_ID = |
| 163 | PiActionId.of("FabricIngress.forwarding.duplicate_to_controller"); |
| 164 | public static final PiActionId ACT_FABRICINGRESS_NEXT_L3_ROUTING_ID = |
| 165 | PiActionId.of("FabricIngress.next.l3_routing"); |
| 166 | public static final PiActionId ACT_FABRICINGRESS_NEXT_MPLS_ROUTING_V4_ID = |
| 167 | PiActionId.of("FabricIngress.next.mpls_routing_v4"); |
| 168 | public static final PiActionId ACT_FABRICINGRESS_NEXT_SET_VLAN_OUTPUT_ID = |
| 169 | PiActionId.of("FabricIngress.next.set_vlan_output"); |
| 170 | public static final PiActionId ACT_FABRICINGRESS_FORWARDING_SET_NEXT_ID_ID = |
| 171 | PiActionId.of("FabricIngress.forwarding.set_next_id"); |
| 172 | public static final PiActionId ACT_FABRICINGRESS_FILTERING_PUSH_INTERNAL_VLAN_ID = |
| 173 | PiActionId.of("FabricIngress.filtering.push_internal_vlan"); |
| 174 | public static final PiActionId ACT_FABRICINGRESS_FORWARDING_DROP_ID = |
| 175 | PiActionId.of("FabricIngress.forwarding.drop"); |
| 176 | public static final PiActionId ACT_FABRICINGRESS_NEXT_OUTPUT_ID = |
| 177 | PiActionId.of("FabricIngress.next.output"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 178 | |
| 179 | // Action Param IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 180 | public static final PiActionParamId ACT_PRM_DMAC_ID = |
| 181 | PiActionParamId.of("dmac"); |
| 182 | public static final PiActionParamId ACT_PRM_PORT_NUM_ID = |
| 183 | PiActionParamId.of("port_num"); |
| 184 | public static final PiActionParamId ACT_PRM_LABEL_ID = |
| 185 | PiActionParamId.of("label"); |
| 186 | public static final PiActionParamId ACT_PRM_SMAC_ID = |
| 187 | PiActionParamId.of("smac"); |
| 188 | public static final PiActionParamId ACT_PRM_GID_ID = |
| 189 | PiActionParamId.of("gid"); |
| 190 | public static final PiActionParamId ACT_PRM_NEW_VLAN_ID_ID = |
| 191 | PiActionParamId.of("new_vlan_id"); |
| 192 | public static final PiActionParamId ACT_PRM_FWD_TYPE_ID = |
| 193 | PiActionParamId.of("fwd_type"); |
| 194 | public static final PiActionParamId ACT_PRM_NEXT_ID_ID = |
| 195 | PiActionParamId.of("next_id"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 196 | |
| 197 | // Action Profile IDs |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame^] | 198 | public static final PiActionProfileId ACT_PRF_FABRICINGRESS_NEXT_ECMP_SELECTOR_ID = |
| 199 | PiActionProfileId.of("FabricIngress.next.ecmp_selector"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 200 | |
| 201 | // Packet Metadata IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame] | 202 | public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID = |
| 203 | PiControlMetadataId.of("ingress_port"); |
| 204 | public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = |
| 205 | PiControlMetadataId.of("egress_port"); |
Yi Tseng | fa4a1c7 | 2017-11-03 10:22:38 -0700 | [diff] [blame] | 206 | |
| 207 | public static final int PORT_BITWIDTH = 9; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 208 | } |