alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 1 | package org.onlab.onos.provider.of.flow.impl; |
| 2 | |
| 3 | import static org.slf4j.LoggerFactory.getLogger; |
| 4 | |
| 5 | import java.util.List; |
| 6 | |
| 7 | import org.onlab.onos.net.DeviceId; |
| 8 | import org.onlab.onos.net.PortNumber; |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 9 | import org.onlab.onos.net.flow.DefaultFlowEntry; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 10 | import org.onlab.onos.net.flow.DefaultFlowRule; |
| 11 | import org.onlab.onos.net.flow.DefaultTrafficSelector; |
| 12 | import org.onlab.onos.net.flow.DefaultTrafficTreatment; |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 13 | import org.onlab.onos.net.flow.FlowEntry; |
| 14 | import org.onlab.onos.net.flow.FlowEntry.FlowEntryState; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 15 | import org.onlab.onos.net.flow.FlowRule; |
| 16 | import org.onlab.onos.net.flow.TrafficSelector; |
| 17 | import org.onlab.onos.net.flow.TrafficTreatment; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 18 | import org.onlab.onos.openflow.controller.Dpid; |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 19 | import org.onlab.packet.IpPrefix; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onlab.packet.VlanId; |
| 22 | import org.projectfloodlight.openflow.protocol.OFFlowRemoved; |
| 23 | import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 24 | import org.projectfloodlight.openflow.protocol.OFInstructionType; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 25 | import org.projectfloodlight.openflow.protocol.action.OFAction; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 26 | import org.projectfloodlight.openflow.protocol.action.OFActionCircuit; |
| 27 | import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 28 | import org.projectfloodlight.openflow.protocol.action.OFActionOutput; |
| 29 | import org.projectfloodlight.openflow.protocol.action.OFActionSetDlDst; |
| 30 | import org.projectfloodlight.openflow.protocol.action.OFActionSetDlSrc; |
| 31 | import org.projectfloodlight.openflow.protocol.action.OFActionSetNwDst; |
| 32 | import org.projectfloodlight.openflow.protocol.action.OFActionSetNwSrc; |
| 33 | import org.projectfloodlight.openflow.protocol.action.OFActionSetVlanPcp; |
| 34 | import org.projectfloodlight.openflow.protocol.action.OFActionSetVlanVid; |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 35 | import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; |
| 36 | import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 37 | import org.projectfloodlight.openflow.protocol.match.Match; |
| 38 | import org.projectfloodlight.openflow.protocol.match.MatchField; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 39 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 40 | import org.projectfloodlight.openflow.types.IPv4Address; |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 41 | import org.projectfloodlight.openflow.types.Masked; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 42 | import org.slf4j.Logger; |
| 43 | |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 44 | import com.google.common.collect.Lists; |
| 45 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 46 | public class FlowEntryBuilder { |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 47 | private final Logger log = getLogger(getClass()); |
| 48 | |
| 49 | private final OFFlowStatsEntry stat; |
| 50 | private final OFFlowRemoved removed; |
| 51 | |
| 52 | private final Match match; |
| 53 | private final List<OFAction> actions; |
| 54 | |
| 55 | private final Dpid dpid; |
| 56 | |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 57 | private final boolean addedRule; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 58 | |
| 59 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 60 | public FlowEntryBuilder(Dpid dpid, OFFlowStatsEntry entry) { |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 61 | this.stat = entry; |
| 62 | this.match = entry.getMatch(); |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 63 | this.actions = getActions(entry); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 64 | this.dpid = dpid; |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 65 | this.removed = null; |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 66 | this.addedRule = true; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 67 | } |
| 68 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 69 | public FlowEntryBuilder(Dpid dpid, OFFlowRemoved removed) { |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 70 | this.match = removed.getMatch(); |
| 71 | this.removed = removed; |
| 72 | |
| 73 | this.dpid = dpid; |
| 74 | this.actions = null; |
| 75 | this.stat = null; |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 76 | this.addedRule = false; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 77 | |
| 78 | } |
| 79 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 80 | public FlowEntry build() { |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 81 | if (addedRule) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 82 | FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 83 | buildSelector(), buildTreatment(), stat.getPriority(), |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 84 | stat.getCookie().getValue(), stat.getIdleTimeout(), false); |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 85 | return new DefaultFlowEntry(rule, FlowEntryState.ADDED, |
| 86 | stat.getDurationSec(), stat.getPacketCount().getValue(), |
| 87 | stat.getByteCount().getValue()); |
| 88 | |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 89 | } else { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 90 | FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 91 | buildSelector(), null, removed.getPriority(), |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 92 | removed.getCookie().getValue(), removed.getIdleTimeout(), false); |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 93 | return new DefaultFlowEntry(rule, FlowEntryState.REMOVED, removed.getDurationSec(), |
| 94 | removed.getPacketCount().getValue(), removed.getByteCount().getValue()); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 95 | } |
| 96 | } |
| 97 | |
alshabib | 19fdc12 | 2014-10-03 11:38:19 -0700 | [diff] [blame] | 98 | private List<OFAction> getActions(OFFlowStatsEntry entry) { |
| 99 | switch (entry.getVersion()) { |
| 100 | case OF_10: |
| 101 | return entry.getActions(); |
| 102 | case OF_11: |
| 103 | case OF_12: |
| 104 | case OF_13: |
| 105 | List<OFInstruction> ins = entry.getInstructions(); |
| 106 | for (OFInstruction in : ins) { |
| 107 | if (in.getType().equals(OFInstructionType.APPLY_ACTIONS)) { |
| 108 | OFInstructionApplyActions apply = (OFInstructionApplyActions) in; |
| 109 | return apply.getActions(); |
| 110 | } |
| 111 | } |
| 112 | return Lists.newLinkedList(); |
| 113 | default: |
| 114 | log.warn("Unknown OF version {}", entry.getVersion()); |
| 115 | } |
| 116 | return Lists.newLinkedList(); |
| 117 | } |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 118 | |
| 119 | private TrafficTreatment buildTreatment() { |
tom | 9a693fd | 2014-10-03 11:32:19 -0700 | [diff] [blame] | 120 | TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder(); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 121 | // If this is a drop rule |
| 122 | if (actions.size() == 0) { |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 123 | builder.drop(); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 124 | return builder.build(); |
| 125 | } |
| 126 | for (OFAction act : actions) { |
| 127 | switch (act.getType()) { |
| 128 | case OUTPUT: |
| 129 | OFActionOutput out = (OFActionOutput) act; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 130 | builder.setOutput( |
| 131 | PortNumber.portNumber(out.getPort().getPortNumber())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 132 | break; |
| 133 | case SET_VLAN_VID: |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 134 | OFActionSetVlanVid vlan = (OFActionSetVlanVid) act; |
| 135 | builder.setVlanId(VlanId.vlanId(vlan.getVlanVid().getVlan())); |
| 136 | break; |
| 137 | case SET_VLAN_PCP: |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 138 | OFActionSetVlanPcp pcp = (OFActionSetVlanPcp) act; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 139 | builder.setVlanId(VlanId.vlanId(pcp.getVlanPcp().getValue())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 140 | break; |
| 141 | case SET_DL_DST: |
| 142 | OFActionSetDlDst dldst = (OFActionSetDlDst) act; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 143 | builder.setEthDst( |
| 144 | MacAddress.valueOf(dldst.getDlAddr().getLong())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 145 | break; |
| 146 | case SET_DL_SRC: |
| 147 | OFActionSetDlSrc dlsrc = (OFActionSetDlSrc) act; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 148 | builder.setEthSrc( |
| 149 | MacAddress.valueOf(dlsrc.getDlAddr().getLong())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 150 | |
| 151 | break; |
| 152 | case SET_NW_DST: |
| 153 | OFActionSetNwDst nwdst = (OFActionSetNwDst) act; |
| 154 | IPv4Address di = nwdst.getNwAddr(); |
| 155 | if (di.isCidrMask()) { |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 156 | builder.setIpDst(IpPrefix.valueOf(di.getInt(), |
| 157 | di.asCidrMaskLength())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 158 | } else { |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 159 | builder.setIpDst(IpPrefix.valueOf(di.getInt())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 160 | } |
| 161 | break; |
| 162 | case SET_NW_SRC: |
| 163 | OFActionSetNwSrc nwsrc = (OFActionSetNwSrc) act; |
| 164 | IPv4Address si = nwsrc.getNwAddr(); |
| 165 | if (si.isCidrMask()) { |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 166 | builder.setIpSrc(IpPrefix.valueOf(si.getInt(), |
| 167 | si.asCidrMaskLength())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 168 | } else { |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 169 | builder.setIpSrc(IpPrefix.valueOf(si.getInt())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 170 | } |
| 171 | break; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 172 | case EXPERIMENTER: |
| 173 | OFActionExperimenter exp = (OFActionExperimenter) act; |
| 174 | if (exp.getExperimenter() == 0x80005A06) { |
| 175 | OFActionCircuit ct = (OFActionCircuit) exp; |
| 176 | builder.setLambda(((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber()); |
| 177 | } else { |
| 178 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); |
| 179 | } |
| 180 | break; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 181 | case SET_TP_DST: |
| 182 | case SET_TP_SRC: |
| 183 | case POP_MPLS: |
| 184 | case POP_PBB: |
| 185 | case POP_VLAN: |
| 186 | case PUSH_MPLS: |
| 187 | case PUSH_PBB: |
| 188 | case PUSH_VLAN: |
| 189 | case SET_FIELD: |
| 190 | case SET_MPLS_LABEL: |
| 191 | case SET_MPLS_TC: |
| 192 | case SET_MPLS_TTL: |
| 193 | case SET_NW_ECN: |
| 194 | case SET_NW_TOS: |
| 195 | case SET_NW_TTL: |
| 196 | case SET_QUEUE: |
| 197 | case STRIP_VLAN: |
| 198 | case COPY_TTL_IN: |
| 199 | case COPY_TTL_OUT: |
| 200 | case DEC_MPLS_TTL: |
| 201 | case DEC_NW_TTL: |
| 202 | case ENQUEUE: |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 203 | |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 204 | case GROUP: |
| 205 | default: |
| 206 | log.warn("Action type {} not yet implemented.", act.getType()); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | return builder.build(); |
| 211 | } |
| 212 | |
| 213 | private TrafficSelector buildSelector() { |
tom | 9a693fd | 2014-10-03 11:32:19 -0700 | [diff] [blame] | 214 | TrafficSelector.Builder builder = DefaultTrafficSelector.builder(); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 215 | for (MatchField<?> field : match.getMatchFields()) { |
| 216 | switch (field.id) { |
| 217 | case IN_PORT: |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 218 | builder.matchInport(PortNumber |
| 219 | .portNumber(match.get(MatchField.IN_PORT).getPortNumber())); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 220 | break; |
| 221 | case ETH_SRC: |
| 222 | MacAddress sMac = MacAddress.valueOf(match.get(MatchField.ETH_SRC).getLong()); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 223 | builder.matchEthSrc(sMac); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 224 | break; |
| 225 | case ETH_DST: |
| 226 | MacAddress dMac = MacAddress.valueOf(match.get(MatchField.ETH_DST).getLong()); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 227 | builder.matchEthDst(dMac); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 228 | break; |
| 229 | case ETH_TYPE: |
| 230 | int ethType = match.get(MatchField.ETH_TYPE).getValue(); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 231 | builder.matchEthType((short) ethType); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 232 | break; |
| 233 | case IPV4_DST: |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 234 | IpPrefix dip; |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 235 | if (match.isPartiallyMasked(MatchField.IPV4_DST)) { |
| 236 | Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST); |
| 237 | |
| 238 | dip = IpPrefix.valueOf( |
| 239 | maskedIp.getValue().getInt(), |
| 240 | maskedIp.getMask().asCidrMaskLength()); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 241 | } else { |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 242 | dip = IpPrefix.valueOf( |
| 243 | match.get(MatchField.IPV4_DST).getInt(), |
| 244 | IpPrefix.MAX_INET_MASK); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 245 | } |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 246 | |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 247 | builder.matchIPDst(dip); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 248 | break; |
| 249 | case IPV4_SRC: |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 250 | IpPrefix sip; |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 251 | if (match.isPartiallyMasked(MatchField.IPV4_SRC)) { |
| 252 | Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC); |
| 253 | |
| 254 | sip = IpPrefix.valueOf( |
| 255 | maskedIp.getValue().getInt(), |
| 256 | maskedIp.getMask().asCidrMaskLength()); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 257 | } else { |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 258 | sip = IpPrefix.valueOf( |
| 259 | match.get(MatchField.IPV4_SRC).getInt(), |
| 260 | IpPrefix.MAX_INET_MASK); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 261 | } |
Jonathan Hart | 0e12fad | 2014-10-17 14:54:58 -0700 | [diff] [blame] | 262 | |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 263 | builder.matchIPSrc(sip); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 264 | break; |
| 265 | case IP_PROTO: |
| 266 | short proto = match.get(MatchField.IP_PROTO).getIpProtocolNumber(); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 267 | builder.matchIPProtocol((byte) proto); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 268 | break; |
| 269 | case VLAN_PCP: |
| 270 | byte vlanPcp = match.get(MatchField.VLAN_PCP).getValue(); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 271 | builder.matchVlanPcp(vlanPcp); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 272 | break; |
| 273 | case VLAN_VID: |
| 274 | VlanId vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan()); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 275 | builder.matchVlanId(vlanId); |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 276 | break; |
Jonathan Hart | 34bc614 | 2014-10-17 11:00:43 -0700 | [diff] [blame] | 277 | case TCP_DST: |
| 278 | builder.matchTcpDst((short) match.get(MatchField.TCP_DST).getPort()); |
| 279 | break; |
| 280 | case TCP_SRC: |
| 281 | builder.matchTcpSrc((short) match.get(MatchField.TCP_SRC).getPort()); |
| 282 | break; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 283 | case OCH_SIGID: |
| 284 | builder.matchLambda(match.get(MatchField.OCH_SIGID).getChannelNumber()); |
| 285 | break; |
| 286 | case OCH_SIGTYPE_BASIC: |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 287 | case ARP_OP: |
| 288 | case ARP_SHA: |
| 289 | case ARP_SPA: |
| 290 | case ARP_THA: |
| 291 | case ARP_TPA: |
| 292 | case ICMPV4_CODE: |
| 293 | case ICMPV4_TYPE: |
| 294 | case ICMPV6_CODE: |
| 295 | case ICMPV6_TYPE: |
| 296 | case IN_PHY_PORT: |
| 297 | case IPV6_DST: |
| 298 | case IPV6_FLABEL: |
| 299 | case IPV6_ND_SLL: |
| 300 | case IPV6_ND_TARGET: |
| 301 | case IPV6_ND_TLL: |
| 302 | case IPV6_SRC: |
| 303 | case IP_DSCP: |
| 304 | case IP_ECN: |
| 305 | case METADATA: |
| 306 | case MPLS_LABEL: |
| 307 | case MPLS_TC: |
| 308 | case SCTP_DST: |
| 309 | case SCTP_SRC: |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 310 | case TUNNEL_ID: |
| 311 | case UDP_DST: |
| 312 | case UDP_SRC: |
| 313 | default: |
| 314 | log.warn("Match type {} not yet implemented.", field.id); |
| 315 | |
| 316 | |
| 317 | } |
| 318 | } |
| 319 | return builder.build(); |
| 320 | } |
| 321 | |
| 322 | } |