use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class AbstractTopoModelTest method createHost.
/**
* Creates a default host connected at the given edge device and port. Note
* that an identifying hex character ("a" - "f") should be supplied. This
* will be included in the MAC address of the host (and equivalent value
* as last byte in IP address).
*
* @param device edge device
* @param port port number
* @param hexChar identifying hex character
* @return host connected at that location
*/
protected static Host createHost(Device device, int port, String hexChar) {
DeviceId deviceId = device.id();
String devNum = deviceId.toString().substring(1);
MacAddress mac = MacAddress.valueOf(HOST_MAC_PREFIX + devNum + hexChar);
HostId hostId = hostId(String.format("%s/-1", mac));
int ipByte = Integer.valueOf(hexChar, 16);
if (ipByte < 10 || ipByte > 15) {
throw new IllegalArgumentException("hexChar must be a-f");
}
HostLocation loc = new HostLocation(deviceId, portNumber(port), 0);
IpAddress ip = ip("10." + devNum + ".0." + ipByte);
return new DefaultHost(ProviderId.NONE, hostId, mac, VlanId.NONE, loc, ImmutableSet.of(ip));
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class OpenstackTroubleshootManager method constructEastWestIcmpPacket.
/**
* Constructs an east-west ICMP packet with given source and destination IP/MAC.
*
* @param srcPort source instance port
* @param dstPort destination instance port
* @param icmpId ICMP identifier
* @param icmpSeq ICMP sequence number
* @return an ethernet frame which contains ICMP payload
*/
private Ethernet constructEastWestIcmpPacket(InstancePort srcPort, InstancePort dstPort, short icmpId, short icmpSeq) {
boolean isRemote = true;
if (srcPort.deviceId().equals(dstPort.deviceId()) && osNetworkService.gatewayIp(srcPort.portId()).equals(osNetworkService.gatewayIp(dstPort.portId()))) {
isRemote = false;
}
// if the source and destination VMs are located in different OVS,
// we will assign fake gateway MAC as the destination MAC
MacAddress dstMac = isRemote ? DEFAULT_GATEWAY_MAC : dstPort.macAddress();
return constructIcmpPacket(srcPort.ipAddress(), dstPort.ipAddress(), srcPort.macAddress(), dstMac, icmpId, icmpSeq);
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class PiFlowRuleTranslatorImplTest method testTranslateFlowRules.
@Test
public void testTranslateFlowRules() throws Exception {
ApplicationId appId = new DefaultApplicationId(1, "test");
MacAddress ethDstMac = MacAddress.valueOf(random.nextLong());
MacAddress ethSrcMac = MacAddress.valueOf(random.nextLong());
short ethType = (short) (0x0000FFFF & random.nextInt());
short outPort = (short) random.nextInt(65);
short inPort = (short) random.nextInt(65);
int timeout = random.nextInt(100);
int priority = random.nextInt(100);
TrafficSelector matchInPort1 = DefaultTrafficSelector.builder().matchInPort(PortNumber.portNumber(inPort)).matchEthDst(ethDstMac).matchEthSrc(ethSrcMac).matchEthType(ethType).build();
TrafficSelector emptySelector = DefaultTrafficSelector.builder().build();
TrafficTreatment outPort2 = DefaultTrafficTreatment.builder().setOutput(PortNumber.portNumber(outPort)).build();
FlowRule rule1 = DefaultFlowRule.builder().forDevice(DEVICE_ID).forTable(INGRESS_TABLE0_CONTROL_TABLE0).fromApp(appId).withSelector(matchInPort1).withTreatment(outPort2).makeTemporary(timeout).withPriority(priority).build();
FlowRule rule2 = DefaultFlowRule.builder().forDevice(DEVICE_ID).forTable(INGRESS_TABLE0_CONTROL_TABLE0).fromApp(appId).withSelector(matchInPort1).withTreatment(outPort2).makeTemporary(timeout).withPriority(priority).build();
FlowRule defActionRule = DefaultFlowRule.builder().forDevice(DEVICE_ID).forTable(INGRESS_TABLE0_CONTROL_TABLE0).fromApp(appId).withSelector(emptySelector).withTreatment(outPort2).makeTemporary(timeout).withPriority(priority).build();
PiTableEntry entry1 = PiFlowRuleTranslatorImpl.translate(rule1, pipeconf, null);
PiTableEntry entry2 = PiFlowRuleTranslatorImpl.translate(rule2, pipeconf, null);
PiTableEntry defActionEntry = PiFlowRuleTranslatorImpl.translate(defActionRule, pipeconf, null);
// check equality, i.e. same rules must produce same entries
new EqualsTester().addEqualityGroup(rule1, rule2).addEqualityGroup(entry1, entry2).testEquals();
// parse values stored in entry1
PiTernaryFieldMatch inPortParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_STANDARD_METADATA_INGRESS_PORT).get();
PiTernaryFieldMatch ethDstParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_HDR_ETHERNET_DST_ADDR).get();
PiTernaryFieldMatch ethSrcParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_HDR_ETHERNET_SRC_ADDR).get();
PiTernaryFieldMatch ethTypeParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_HDR_ETHERNET_ETHER_TYPE).get();
Optional<Double> expectedTimeout = pipeconf.pipelineModel().table(INGRESS_TABLE0_CONTROL_TABLE0).get().supportsAging() ? Optional.of((double) rule1.timeout()) : Optional.empty();
// check that values stored in entry are the same used for the flow rule
assertThat("Incorrect inPort match param value", inPortParam.value().asReadOnlyBuffer().getShort(), is(equalTo(inPort)));
assertThat("Incorrect inPort match param mask", inPortParam.mask().asReadOnlyBuffer().getShort(), is(equalTo(IN_PORT_MASK)));
assertThat("Incorrect ethDestMac match param value", ethDstParam.value().asArray(), is(equalTo(ethDstMac.toBytes())));
assertThat("Incorrect ethDestMac match param mask", ethDstParam.mask().asArray(), is(equalTo(MacAddress.BROADCAST.toBytes())));
assertThat("Incorrect ethSrcMac match param value", ethSrcParam.value().asArray(), is(equalTo(ethSrcMac.toBytes())));
assertThat("Incorrect ethSrcMac match param mask", ethSrcParam.mask().asArray(), is(equalTo(MacAddress.BROADCAST.toBytes())));
assertThat("Incorrect ethType match param value", ethTypeParam.value().asReadOnlyBuffer().getShort(), is(equalTo(ethType)));
assertThat("Incorrect ethType match param mask", ethTypeParam.mask().asReadOnlyBuffer().getShort(), is(equalTo(ETH_TYPE_MASK)));
// FIXME: re-enable when P4Runtime priority handling will be moved out of transltion service
// see PiFlowRuleTranslatorImpl
// assertThat("Incorrect priority value",
// entry1.priority().get(), is(equalTo(MAX_PI_PRIORITY - rule1.priority())));
assertThat("Incorrect timeout value", entry1.timeout(), is(equalTo(expectedTimeout)));
assertThat("Match key should be empty", defActionEntry.matchKey(), is(equalTo(PiMatchKey.EMPTY)));
assertThat("Priority should not be set", !defActionEntry.priority().isPresent());
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class LinkDiscoveryCiscoImpl method findRemoteDeviceByChassisId.
private Device findRemoteDeviceByChassisId(DeviceService deviceService, String remoteChassisIdString) {
String forMacTmp = remoteChassisIdString.replace(".", "").replaceAll("(.{2})", "$1:").trim().substring(0, 17);
MacAddress mac = MacAddress.valueOf(forMacTmp);
ChassisId remoteChassisId = new ChassisId(mac.toLong());
Optional<Device> remoteDeviceOptional;
Supplier<Stream<Device>> deviceStream = () -> StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false);
remoteDeviceOptional = deviceStream.get().filter(device -> device.chassisId() != null && MacAddress.valueOf(device.chassisId().value()).equals(mac)).findAny();
if (remoteDeviceOptional.isPresent()) {
return remoteDeviceOptional.get();
} else {
remoteDeviceOptional = deviceStream.get().filter(device -> Tools.stream(deviceService.getPorts(device.id())).anyMatch(port -> port.annotations().keys().contains(AnnotationKeys.PORT_MAC) && MacAddress.valueOf(port.annotations().value(AnnotationKeys.PORT_MAC)).equals(mac))).findAny();
if (remoteDeviceOptional.isPresent()) {
return remoteDeviceOptional.get();
} else {
log.debug("remote device not found. remoteChassisId value: {}", remoteChassisId);
return new DefaultDevice(ProviderId.NONE, DeviceId.deviceId(LLDP + mac.toString()), Device.Type.SWITCH, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, remoteChassisId, DefaultAnnotations.EMPTY);
}
}
}
use of org.onlab.packet.MacAddress in project onos by opennetworkinglab.
the class FlowEntryBuilder method buildSelector.
// CHECKSTYLE IGNORE MethodLength FOR NEXT 1 LINES
private TrafficSelector buildSelector() {
MacAddress mac;
Ip4Prefix ip4Prefix;
Ip6Address ip6Address;
Ip6Prefix ip6Prefix;
Ip4Address ip;
ExtensionSelectorInterpreter selectorInterpreter;
if (driverHandler.hasBehaviour(ExtensionSelectorInterpreter.class)) {
selectorInterpreter = driverHandler.behaviour(ExtensionSelectorInterpreter.class);
} else {
selectorInterpreter = null;
}
TrafficSelector.Builder builder = DefaultTrafficSelector.builder();
for (MatchField<?> field : match.getMatchFields()) {
switch(field.id) {
case IN_PORT:
builder.matchInPort(PortNumber.portNumber(match.get(MatchField.IN_PORT).getPortNumber()));
break;
case IN_PHY_PORT:
builder.matchInPhyPort(PortNumber.portNumber(match.get(MatchField.IN_PHY_PORT).getPortNumber()));
break;
case METADATA:
long metadata = match.get(MatchField.METADATA).getValue().getValue();
builder.matchMetadata(metadata);
break;
case ETH_DST:
if (match.isPartiallyMasked(MatchField.ETH_DST)) {
Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_DST);
builder.matchEthDstMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong()));
} else {
mac = MacAddress.valueOf(match.get(MatchField.ETH_DST).getLong());
builder.matchEthDst(mac);
}
break;
case ETH_SRC:
if (match.isPartiallyMasked(MatchField.ETH_SRC)) {
Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_SRC);
builder.matchEthSrcMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong()));
} else {
mac = MacAddress.valueOf(match.get(MatchField.ETH_SRC).getLong());
builder.matchEthSrc(mac);
}
break;
case ETH_TYPE:
int ethType = match.get(MatchField.ETH_TYPE).getValue();
builder.matchEthType((short) ethType);
break;
case VLAN_VID:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
if (isOF13OrLater(match)) {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.VLAN_VID);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} else {
break;
}
} else {
VlanId vlanId = null;
if (match.isPartiallyMasked(MatchField.VLAN_VID)) {
Masked<OFVlanVidMatch> masked = match.getMasked(MatchField.VLAN_VID);
if (masked.getValue().equals(OFVlanVidMatch.PRESENT) && masked.getMask().equals(OFVlanVidMatch.PRESENT)) {
vlanId = VlanId.ANY;
}
} else {
if (!match.get(MatchField.VLAN_VID).isPresentBitSet()) {
vlanId = VlanId.NONE;
} else {
vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan());
}
}
if (vlanId != null) {
builder.matchVlanId(vlanId);
}
}
break;
case VLAN_PCP:
byte vlanPcp = match.get(MatchField.VLAN_PCP).getValue();
builder.matchVlanPcp(vlanPcp);
break;
case IP_DSCP:
byte ipDscp = match.get(MatchField.IP_DSCP).getDscpValue();
builder.matchIPDscp(ipDscp);
break;
case IP_ECN:
byte ipEcn = match.get(MatchField.IP_ECN).getEcnValue();
builder.matchIPEcn(ipEcn);
break;
case IP_PROTO:
short proto = match.get(MatchField.IP_PROTO).getIpProtocolNumber();
builder.matchIPProtocol((byte) proto);
break;
case IPV4_SRC:
if (match.isPartiallyMasked(MatchField.IPV4_SRC)) {
Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC);
ip4Prefix = Ip4Prefix.valueOf(maskedIp.getValue().getInt(), maskedIp.getMask().asCidrMaskLength());
} else {
ip4Prefix = Ip4Prefix.valueOf(match.get(MatchField.IPV4_SRC).getInt(), Ip4Prefix.MAX_MASK_LENGTH);
}
builder.matchIPSrc(ip4Prefix);
break;
case IPV4_DST:
if (match.isPartiallyMasked(MatchField.IPV4_DST)) {
Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST);
ip4Prefix = Ip4Prefix.valueOf(maskedIp.getValue().getInt(), maskedIp.getMask().asCidrMaskLength());
} else {
ip4Prefix = Ip4Prefix.valueOf(match.get(MatchField.IPV4_DST).getInt(), Ip4Prefix.MAX_MASK_LENGTH);
}
builder.matchIPDst(ip4Prefix);
break;
case TCP_SRC:
if (match.isPartiallyMasked(MatchField.TCP_SRC)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.TCP_SRC);
builder.matchTcpSrcMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchTcpSrc(TpPort.tpPort(match.get(MatchField.TCP_SRC).getPort()));
}
break;
case TCP_DST:
if (match.isPartiallyMasked(MatchField.TCP_DST)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.TCP_DST);
builder.matchTcpDstMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchTcpDst(TpPort.tpPort(match.get(MatchField.TCP_DST).getPort()));
}
break;
case UDP_SRC:
if (match.isPartiallyMasked(MatchField.UDP_SRC)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.UDP_SRC);
builder.matchUdpSrcMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchUdpSrc(TpPort.tpPort(match.get(MatchField.UDP_SRC).getPort()));
}
break;
case UDP_DST:
if (match.isPartiallyMasked(MatchField.UDP_DST)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.UDP_DST);
builder.matchUdpDstMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchUdpDst(TpPort.tpPort(match.get(MatchField.UDP_DST).getPort()));
}
break;
case MPLS_LABEL:
builder.matchMplsLabel(MplsLabel.mplsLabel((int) match.get(MatchField.MPLS_LABEL).getValue()));
break;
case MPLS_BOS:
builder.matchMplsBos(match.get(MatchField.MPLS_BOS).getValue());
break;
case SCTP_SRC:
if (match.isPartiallyMasked(MatchField.SCTP_SRC)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.SCTP_SRC);
builder.matchSctpSrcMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchSctpSrc(TpPort.tpPort(match.get(MatchField.SCTP_SRC).getPort()));
}
break;
case SCTP_DST:
if (match.isPartiallyMasked(MatchField.SCTP_DST)) {
Masked<org.projectfloodlight.openflow.types.TransportPort> maskedPort = match.getMasked(MatchField.SCTP_DST);
builder.matchSctpDstMasked(TpPort.tpPort(maskedPort.getValue().getPort()), TpPort.tpPort(maskedPort.getMask().getPort()));
} else {
builder.matchSctpDst(TpPort.tpPort(match.get(MatchField.SCTP_DST).getPort()));
}
break;
case ICMPV4_TYPE:
byte icmpType = (byte) match.get(MatchField.ICMPV4_TYPE).getType();
builder.matchIcmpType(icmpType);
break;
case ICMPV4_CODE:
byte icmpCode = (byte) match.get(MatchField.ICMPV4_CODE).getCode();
builder.matchIcmpCode(icmpCode);
break;
case IPV6_SRC:
if (match.isPartiallyMasked(MatchField.IPV6_SRC)) {
Masked<IPv6Address> maskedIp = match.getMasked(MatchField.IPV6_SRC);
ip6Prefix = Ip6Prefix.valueOf(maskedIp.getValue().getBytes(), maskedIp.getMask().asCidrMaskLength());
} else {
ip6Prefix = Ip6Prefix.valueOf(match.get(MatchField.IPV6_SRC).getBytes(), Ip6Prefix.MAX_MASK_LENGTH);
}
builder.matchIPv6Src(ip6Prefix);
break;
case IPV6_DST:
if (match.isPartiallyMasked(MatchField.IPV6_DST)) {
Masked<IPv6Address> maskedIp = match.getMasked(MatchField.IPV6_DST);
ip6Prefix = Ip6Prefix.valueOf(maskedIp.getValue().getBytes(), maskedIp.getMask().asCidrMaskLength());
} else {
ip6Prefix = Ip6Prefix.valueOf(match.get(MatchField.IPV6_DST).getBytes(), Ip6Prefix.MAX_MASK_LENGTH);
}
builder.matchIPv6Dst(ip6Prefix);
break;
case IPV6_FLABEL:
int flowLabel = match.get(MatchField.IPV6_FLABEL).getIPv6FlowLabelValue();
builder.matchIPv6FlowLabel(flowLabel);
break;
case ICMPV6_TYPE:
byte icmpv6type = (byte) match.get(MatchField.ICMPV6_TYPE).getValue();
builder.matchIcmpv6Type(icmpv6type);
break;
case ICMPV6_CODE:
byte icmpv6code = (byte) match.get(MatchField.ICMPV6_CODE).getValue();
builder.matchIcmpv6Code(icmpv6code);
break;
case IPV6_ND_TARGET:
ip6Address = Ip6Address.valueOf(match.get(MatchField.IPV6_ND_TARGET).getBytes());
builder.matchIPv6NDTargetAddress(ip6Address);
break;
case IPV6_ND_SLL:
mac = MacAddress.valueOf(match.get(MatchField.IPV6_ND_SLL).getLong());
builder.matchIPv6NDSourceLinkLayerAddress(mac);
break;
case IPV6_ND_TLL:
mac = MacAddress.valueOf(match.get(MatchField.IPV6_ND_TLL).getLong());
builder.matchIPv6NDTargetLinkLayerAddress(mac);
break;
case IPV6_EXTHDR:
builder.matchIPv6ExthdrFlags((short) match.get(MatchField.IPV6_EXTHDR).getValue());
break;
case OCH_SIGID:
CircuitSignalID sigId = match.get(MatchField.OCH_SIGID);
builder.add(matchLambda(Lambda.ochSignal(lookupGridType(sigId.getGridType()), lookupChannelSpacing(sigId.getChannelSpacing()), sigId.getChannelNumber(), sigId.getSpectralWidth())));
break;
case OCH_SIGTYPE:
U8 sigType = match.get(MatchField.OCH_SIGTYPE);
builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue())));
break;
case EXP_OCH_SIG_ID:
try {
CircuitSignalID expSigId = match.get(MatchField.EXP_OCH_SIG_ID);
builder.add(matchLambda(Lambda.ochSignal(lookupGridType(expSigId.getGridType()), lookupChannelSpacing(expSigId.getChannelSpacing()), expSigId.getChannelNumber(), expSigId.getSpectralWidth())));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
break;
}
break;
case EXP_OCH_SIGTYPE:
try {
U8 expOchSigType = match.get(MatchField.EXP_OCH_SIGTYPE);
builder.add(matchOchSignalType(lookupOchSignalType((byte) expOchSigType.getValue())));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
break;
}
break;
case EXP_ODU_SIG_ID:
OduSignalId oduSignalId = OduSignalId.oduSignalId(match.get(MatchField.EXP_ODU_SIG_ID).getTpn(), match.get(MatchField.EXP_ODU_SIG_ID).getTslen(), match.get(MatchField.EXP_ODU_SIG_ID).getTsmap());
builder.add(matchOduSignalId(oduSignalId));
break;
case EXP_ODU_SIGTYPE:
try {
U8 oduSigType = match.get(MatchField.EXP_ODU_SIGTYPE);
builder.add(matchOduSignalType(lookupOduSignalType((byte) oduSigType.getValue())));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
break;
}
break;
case TUNNEL_ID:
long tunnelId = match.get(MatchField.TUNNEL_ID).getValue();
builder.matchTunnelId(tunnelId);
break;
case ARP_OP:
int arpOp = match.get(MatchField.ARP_OP).getOpcode();
builder.matchArpOp(arpOp);
break;
case ARP_SHA:
mac = MacAddress.valueOf(match.get(MatchField.ARP_SHA).getLong());
builder.matchArpSha(mac);
break;
case ARP_SPA:
ip = Ip4Address.valueOf(match.get(MatchField.ARP_SPA).getInt());
builder.matchArpSpa(ip);
break;
case ARP_THA:
mac = MacAddress.valueOf(match.get(MatchField.ARP_THA).getLong());
builder.matchArpTha(mac);
break;
case ARP_TPA:
ip = Ip4Address.valueOf(match.get(MatchField.ARP_TPA).getInt());
builder.matchArpTpa(ip);
break;
case NSP:
if (selectorInterpreter != null) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.NSP);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case NSI:
if (selectorInterpreter != null) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.NSI);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case ENCAP_ETH_TYPE:
if (selectorInterpreter != null) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.ENCAP_ETH_TYPE);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case CONNTRACK_STATE:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.NICIRA_MATCH_CONNTRACK_STATE.type())) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.CONNTRACK_STATE);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case CONNTRACK_ZONE:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.NICIRA_MATCH_CONNTRACK_ZONE.type())) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.CONNTRACK_ZONE);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case CONNTRACK_MARK:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.NICIRA_MATCH_CONNTRACK_MARK.type())) {
try {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.CONNTRACK_MARK);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case OFDPA_OVID:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_OVID.type())) {
if (isOF13OrLater(match)) {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_OVID);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} else {
break;
}
}
break;
case OFDPA_MPLS_L2_PORT:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_MPLS_L2_PORT.type())) {
if (isOF13OrLater(match)) {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_MPLS_L2_PORT);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} else {
break;
}
}
break;
case OFDPA_ALLOW_VLAN_TRANSLATION:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
if (isOF13OrLater(match)) {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_ALLOW_VLAN_TRANSLATION);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} else {
break;
}
}
break;
case OFDPA_ACTSET_OUTPUT:
if (selectorInterpreter != null && selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
if (isOF13OrLater(match)) {
OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_ACTSET_OUTPUT);
builder.extension(selectorInterpreter.mapOxm(oxm), deviceId);
} else {
break;
}
}
break;
case MPLS_TC:
default:
log.warn("Match type {} not yet implemented.", field.id);
}
}
return builder.build();
}
Aggregations