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 | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 90 | public static final PiTableId TBL_MULTICAST_V4_ID = |
| 91 | PiTableId.of("forwarding.multicast_v4"); |
| 92 | public static final PiTableId TBL_MULTICAST_V6_ID = |
| 93 | PiTableId.of("forwarding.multicast_v6"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 94 | public static final PiTableId TBL_ACL_ID = PiTableId.of("forwarding.acl"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 95 | public static final PiTableId TBL_BROADCAST_ID = |
| 96 | PiTableId.of("next.broadcast"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 97 | public static final PiTableId TBL_HASHED_ID = PiTableId.of("next.hashed"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 98 | public static final PiTableId TBL_INGRESS_PORT_VLAN_ID = |
| 99 | PiTableId.of("filtering.ingress_port_vlan"); |
| 100 | public static final PiTableId TBL_FWD_CLASSIFIER_ID = |
| 101 | PiTableId.of("filtering.fwd_classifier"); |
| 102 | public static final PiTableId TBL_UNICAST_V6_ID = |
| 103 | PiTableId.of("forwarding.unicast_v6"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 104 | public static final PiTableId TBL_SIMPLE_ID = PiTableId.of("next.simple"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 105 | public static final PiTableId TBL_BRIDGING_ID = |
| 106 | PiTableId.of("forwarding.bridging"); |
| 107 | public static final PiTableId TBL_UNICAST_V4_ID = |
| 108 | PiTableId.of("forwarding.unicast_v4"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 109 | public static final PiTableId TBL_MPLS_ID = PiTableId.of("forwarding.mpls"); |
| 110 | |
| 111 | // Indirect Counter IDs |
| 112 | public static final PiCounterId CNT_EGRESS_PORT_COUNTER_ID = |
| 113 | PiCounterId.of("port_counters_control.egress_port_counter"); |
| 114 | public static final PiCounterId CNT_INGRESS_PORT_COUNTER_ID = |
| 115 | PiCounterId.of("port_counters_control.ingress_port_counter"); |
| 116 | |
| 117 | // Direct Counter IDs |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 118 | |
| 119 | // Action IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 120 | public static final PiActionId ACT_NEXT_SET_MCAST_GROUP_ID = |
| 121 | PiActionId.of("next.set_mcast_group"); |
| 122 | public static final PiActionId ACT_FORWARDING_DUPLICATE_TO_CONTROLLER_ID = |
| 123 | PiActionId.of("forwarding.duplicate_to_controller"); |
| 124 | public static final PiActionId ACT_NEXT_MPLS_ROUTING_V4_ID = |
| 125 | PiActionId.of("next.mpls_routing_v4"); |
| 126 | public static final PiActionId ACT_FILTERING_PUSH_INTERNAL_VLAN_ID = |
| 127 | PiActionId.of("filtering.push_internal_vlan"); |
| 128 | public static final PiActionId ACT_NEXT_SET_VLAN_OUTPUT_ID = |
| 129 | PiActionId.of("next.set_vlan_output"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 130 | public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 131 | public static final PiActionId ACT_FILTERING_DROP_ID = |
| 132 | PiActionId.of("filtering.drop"); |
| 133 | public static final PiActionId ACT_NEXT_MPLS_ROUTING_V6_ID = |
| 134 | PiActionId.of("next.mpls_routing_v6"); |
| 135 | public static final PiActionId ACT_FILTERING_SET_FORWARDING_TYPE_ID = |
| 136 | PiActionId.of("filtering.set_forwarding_type"); |
| 137 | public static final PiActionId ACT_FORWARDING_DROP_ID = |
| 138 | PiActionId.of("forwarding.drop"); |
| 139 | public static final PiActionId ACT_NEXT_L3_ROUTING_ID = |
| 140 | PiActionId.of("next.l3_routing"); |
| 141 | public static final PiActionId ACT_NEXT_OUTPUT_ID = |
| 142 | PiActionId.of("next.output"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 143 | public static final PiActionId ACT_NOP_ID = PiActionId.of("nop"); |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 144 | public static final PiActionId ACT_FORWARDING_SET_NEXT_ID_ID = |
| 145 | PiActionId.of("forwarding.set_next_id"); |
| 146 | public static final PiActionId ACT_FILTERING_SET_VLAN_ID = |
| 147 | PiActionId.of("filtering.set_vlan"); |
| 148 | public static final PiActionId ACT_FORWARDING_POP_MPLS_AND_NEXT_ID = |
| 149 | PiActionId.of("forwarding.pop_mpls_and_next"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 150 | |
| 151 | // Action Param IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 152 | public static final PiActionParamId ACT_PRM_DMAC_ID = |
| 153 | PiActionParamId.of("dmac"); |
| 154 | public static final PiActionParamId ACT_PRM_PORT_NUM_ID = |
| 155 | PiActionParamId.of("port_num"); |
| 156 | public static final PiActionParamId ACT_PRM_LABEL_ID = |
| 157 | PiActionParamId.of("label"); |
| 158 | public static final PiActionParamId ACT_PRM_SMAC_ID = |
| 159 | PiActionParamId.of("smac"); |
| 160 | public static final PiActionParamId ACT_PRM_GID_ID = |
| 161 | PiActionParamId.of("gid"); |
| 162 | public static final PiActionParamId ACT_PRM_NEW_VLAN_ID_ID = |
| 163 | PiActionParamId.of("new_vlan_id"); |
| 164 | public static final PiActionParamId ACT_PRM_FWD_TYPE_ID = |
| 165 | PiActionParamId.of("fwd_type"); |
| 166 | public static final PiActionParamId ACT_PRM_NEXT_ID_ID = |
| 167 | PiActionParamId.of("next_id"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 168 | |
| 169 | // Action Profile IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 170 | public static final PiActionProfileId ACT_PRF_NEXT_ECMP_SELECTOR_ID = |
| 171 | PiActionProfileId.of("next.ecmp_selector"); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 172 | |
| 173 | // Packet Metadata IDs |
Yi Tseng | c6844f5 | 2017-12-19 11:58:25 -0800 | [diff] [blame^] | 174 | public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID = |
| 175 | PiControlMetadataId.of("ingress_port"); |
| 176 | public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = |
| 177 | PiControlMetadataId.of("egress_port"); |
Yi Tseng | fa4a1c7 | 2017-11-03 10:22:38 -0700 | [diff] [blame] | 178 | |
| 179 | public static final int PORT_BITWIDTH = 9; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 180 | } |