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"; |
| 38 | public static final String UDP = "udp"; |
| 39 | public static final String STANDARD_METADATA = "standard_metadata"; |
| 40 | public static final String MPLS = "mpls"; |
| 41 | public static final String TCP = "tcp"; |
| 42 | public static final String FABRIC_METADATA = "fabric_metadata"; |
| 43 | public static final String IPV4 = "ipv4"; |
| 44 | public static final String IPV6 = "ipv6"; |
| 45 | public static final String ETHERNET = "ethernet"; |
| 46 | public static final String VLAN_TAG = "vlan_tag"; |
| 47 | public static final String ICMP = "icmp"; |
| 48 | |
| 49 | // Header field IDs |
| 50 | public static final PiMatchFieldId HF_VLAN_TAG_VLAN_ID_ID = buildPiMatchField(VLAN_TAG, "vlan_id", true); |
| 51 | public static final PiMatchFieldId HF_MPLS_LABEL_ID = buildPiMatchField(MPLS, "label", true); |
| 52 | public static final PiMatchFieldId HF_STANDARD_METADATA_INGRESS_PORT_ID = |
| 53 | buildPiMatchField(STANDARD_METADATA, "ingress_port", false); |
| 54 | public static final PiMatchFieldId HF_UDP_SRC_PORT_ID = buildPiMatchField(UDP, "src_port", true); |
| 55 | public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID = buildPiMatchField(VLAN_TAG, "is_valid", true); |
| 56 | public static final PiMatchFieldId HF_IPV6_NEXT_HDR_ID = buildPiMatchField(IPV6, "next_hdr", true); |
| 57 | public static final PiMatchFieldId HF_ETHERNET_SRC_ADDR_ID = buildPiMatchField(ETHERNET, "src_addr", true); |
| 58 | public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID = buildPiMatchField(ICMP, "icmp_type", true); |
| 59 | public static final PiMatchFieldId HF_MPLS_TC_ID = buildPiMatchField(MPLS, "tc", true); |
| 60 | public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID = buildPiMatchField(IPV4, "dst_addr", true); |
| 61 | public static final PiMatchFieldId HF_VLAN_TAG_PRI_ID = buildPiMatchField(VLAN_TAG, "pri", true); |
| 62 | public static final PiMatchFieldId HF_TCP_SRC_PORT_ID = buildPiMatchField(TCP, "src_port", true); |
| 63 | public static final PiMatchFieldId HF_ETHERNET_ETHER_TYPE_ID = buildPiMatchField(ETHERNET, "ether_type", true); |
| 64 | public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID = buildPiMatchField(ICMP, "icmp_code", true); |
| 65 | public static final PiMatchFieldId HF_MPLS_BOS_ID = buildPiMatchField(MPLS, "bos", true); |
| 66 | public static final PiMatchFieldId HF_FABRIC_METADATA_IP_PROTO_ID = |
| 67 | buildPiMatchField(FABRIC_METADATA, "ip_proto", false); |
| 68 | public static final PiMatchFieldId HF_FABRIC_METADATA_NEXT_ID_ID = |
| 69 | buildPiMatchField(FABRIC_METADATA, "next_id", false); |
| 70 | public static final PiMatchFieldId HF_UDP_DST_PORT_ID = buildPiMatchField(UDP, "dst_port", true); |
| 71 | public static final PiMatchFieldId HF_IPV4_PROTOCOL_ID = buildPiMatchField(IPV4, "protocol", true); |
| 72 | public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID = buildPiMatchField(IPV4, "src_addr", true); |
| 73 | public static final PiMatchFieldId HF_IPV6_SRC_ADDR_ID = buildPiMatchField(IPV6, "src_addr", true); |
| 74 | public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID = buildPiMatchField(IPV6, "dst_addr", true); |
| 75 | public static final PiMatchFieldId HF_TCP_DST_PORT_ID = buildPiMatchField(TCP, "dst_port", true); |
| 76 | public static final PiMatchFieldId HF_ETHERNET_DST_ADDR_ID = buildPiMatchField(ETHERNET, "dst_addr", true); |
| 77 | |
| 78 | private static PiMatchFieldId buildPiMatchField(String header, String field, boolean withHdrPrefix) { |
| 79 | if (withHdrPrefix) { |
| 80 | return PiMatchFieldId.of(HDR + DOT + header + DOT + field); |
| 81 | } else { |
| 82 | return PiMatchFieldId.of(header + DOT + field); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // Table IDs |
| 87 | public static final PiTableId TBL_MULTICAST_V4_ID = PiTableId.of("forwarding.multicast_v4"); |
| 88 | public static final PiTableId TBL_MULTICAST_V6_ID = PiTableId.of("forwarding.multicast_v6"); |
| 89 | public static final PiTableId TBL_ACL_ID = PiTableId.of("forwarding.acl"); |
| 90 | public static final PiTableId TBL_BROADCAST_ID = PiTableId.of("next.broadcast"); |
| 91 | public static final PiTableId TBL_HASHED_ID = PiTableId.of("next.hashed"); |
| 92 | public static final PiTableId TBL_INGRESS_PORT_VLAN_ID = PiTableId.of("filtering.ingress_port_vlan"); |
| 93 | public static final PiTableId TBL_FWD_CLASSIFIER_ID = PiTableId.of("filtering.fwd_classifier"); |
| 94 | public static final PiTableId TBL_NEXT_ID_MAPPING_ID = PiTableId.of("next.next_id_mapping"); |
| 95 | public static final PiTableId TBL_UNICAST_V6_ID = PiTableId.of("forwarding.unicast_v6"); |
| 96 | public static final PiTableId TBL_SIMPLE_ID = PiTableId.of("next.simple"); |
| 97 | public static final PiTableId TBL_BRIDGING_ID = PiTableId.of("forwarding.bridging"); |
| 98 | public static final PiTableId TBL_UNICAST_V4_ID = PiTableId.of("forwarding.unicast_v4"); |
| 99 | public static final PiTableId TBL_MPLS_ID = PiTableId.of("forwarding.mpls"); |
| 100 | |
| 101 | // Indirect Counter IDs |
| 102 | public static final PiCounterId CNT_EGRESS_PORT_COUNTER_ID = |
| 103 | PiCounterId.of("port_counters_control.egress_port_counter"); |
| 104 | public static final PiCounterId CNT_INGRESS_PORT_COUNTER_ID = |
| 105 | PiCounterId.of("port_counters_control.ingress_port_counter"); |
| 106 | |
| 107 | // Direct Counter IDs |
| 108 | public static final PiCounterId CNT_MULTICAST_V6_COUNTER_ID = PiCounterId.of("forwarding.multicast_v6_counter"); |
| 109 | public static final PiCounterId CNT_ACL_COUNTER_ID = PiCounterId.of("forwarding.acl_counter"); |
| 110 | public static final PiCounterId CNT_UNICAST_V4_COUNTER_ID = PiCounterId.of("forwarding.unicast_v4_counter"); |
| 111 | public static final PiCounterId CNT_INGRESS_PORT_VLAN_COUNTER_ID = |
| 112 | PiCounterId.of("filtering.ingress_port_vlan_counter"); |
| 113 | public static final PiCounterId CNT_FWD_CLASSIFIER_COUNTER_ID = PiCounterId.of("filtering.fwd_classifier_counter"); |
| 114 | public static final PiCounterId CNT_UNICAST_V6_COUNTER_ID = PiCounterId.of("forwarding.unicast_v6_counter"); |
| 115 | public static final PiCounterId CNT_BRIDGING_COUNTER_ID = PiCounterId.of("forwarding.bridging_counter"); |
| 116 | public static final PiCounterId CNT_NEXT_ID_MAPPING_COUNTER_ID = PiCounterId.of("next.next_id_mapping_counter"); |
| 117 | public static final PiCounterId CNT_SIMPLE_COUNTER_ID = PiCounterId.of("next.simple_counter"); |
| 118 | public static final PiCounterId CNT_HASHED_COUNTER_ID = PiCounterId.of("next.hashed_counter"); |
| 119 | public static final PiCounterId CNT_BROADCAST_COUNTER_ID = PiCounterId.of("next.broadcast_counter"); |
| 120 | public static final PiCounterId CNT_MULTICAST_V4_COUNTER_ID = PiCounterId.of("forwarding.multicast_v4_counter"); |
| 121 | public static final PiCounterId CNT_MPLS_COUNTER_ID = PiCounterId.of("forwarding.mpls_counter"); |
| 122 | |
| 123 | // Action IDs |
| 124 | public static final PiActionId ACT_SET_MCAST_GROUP_ID = PiActionId.of("next.set_mcast_group"); |
| 125 | public static final PiActionId ACT_DROP_ID = PiActionId.of("drop"); |
| 126 | public static final PiActionId ACT_PUSH_INTERNAL_VLAN_ID = PiActionId.of("filtering.push_internal_vlan"); |
| 127 | public static final PiActionId ACT_SET_VLAN_OUTPUT_ID = PiActionId.of("next.set_vlan_output"); |
| 128 | public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction"); |
| 129 | public static final PiActionId ACT_PUSH_MPLS_AND_NEXT_V6_ID = PiActionId.of("forwarding.push_mpls_and_next_v6"); |
| 130 | public static final PiActionId ACT_PUSH_MPLS_AND_NEXT_V4_ID = PiActionId.of("forwarding.push_mpls_and_next_v4"); |
| 131 | public static final PiActionId ACT_SET_FORWARDING_TYPE_ID = PiActionId.of("filtering.set_forwarding_type"); |
| 132 | public static final PiActionId ACT_POP_MPLS_AND_NEXT_ID = PiActionId.of("forwarding.pop_mpls_and_next"); |
| 133 | public static final PiActionId ACT_SET_NEXT_TYPE_ID = PiActionId.of("next.set_next_type"); |
| 134 | public static final PiActionId ACT_L3_ROUTING_ID = PiActionId.of("next.l3_routing"); |
| 135 | public static final PiActionId ACT_OUTPUT_ID = PiActionId.of("next.output"); |
| 136 | public static final PiActionId ACT_NOP_ID = PiActionId.of("nop"); |
| 137 | public static final PiActionId ACT_SET_NEXT_ID_ID = PiActionId.of("forwarding.set_next_id"); |
| 138 | public static final PiActionId ACT_SET_VLAN_ID = PiActionId.of("filtering.set_vlan"); |
| 139 | public static final PiActionId ACT_DUPLICATE_TO_CONTROLLER_ID = PiActionId.of("forwarding.duplicate_to_controller"); |
| 140 | |
| 141 | // Action Param IDs |
| 142 | public static final PiActionParamId ACT_PRM_DMAC_ID = PiActionParamId.of("dmac"); |
| 143 | public static final PiActionParamId ACT_PRM_PORT_NUM_ID = PiActionParamId.of("port_num"); |
| 144 | public static final PiActionParamId ACT_PRM_LABEL_ID = PiActionParamId.of("label"); |
| 145 | public static final PiActionParamId ACT_PRM_SMAC_ID = PiActionParamId.of("smac"); |
| 146 | public static final PiActionParamId ACT_PRM_GID_ID = PiActionParamId.of("gid"); |
| 147 | public static final PiActionParamId ACT_PRM_NEW_VLAN_ID_ID = PiActionParamId.of("new_vlan_id"); |
| 148 | public static final PiActionParamId ACT_PRM_FWD_TYPE_ID = PiActionParamId.of("fwd_type"); |
| 149 | public static final PiActionParamId ACT_PRM_NEXT_TYPE_ID = PiActionParamId.of("next_type"); |
| 150 | public static final PiActionParamId ACT_PRM_NEXT_ID_ID = PiActionParamId.of("next_id"); |
| 151 | |
| 152 | // Action Profile IDs |
| 153 | public static final PiActionProfileId ACT_PRF_ECMP_SELECTOR_ID = PiActionProfileId.of("ecmp_selector"); |
| 154 | |
| 155 | // Packet Metadata IDs |
| 156 | public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port"); |
| 157 | public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID = PiControlMetadataId.of("ingress_port"); |
| 158 | } |