use of org.projectfloodlight.openflow.types.OduSignalID in project onos by opennetworkinglab.
the class FlowEntryBuilder method handleSetField.
// CHECKSTYLE IGNORE MethodLength FOR NEXT 1 LINES
private static void handleSetField(TrafficTreatment.Builder builder, OFActionSetField action, DriverHandler driverHandler, DeviceId deviceId) {
ExtensionTreatmentInterpreter treatmentInterpreter;
if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) {
treatmentInterpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class);
} else {
treatmentInterpreter = null;
}
OFOxm<?> oxm = action.getField();
switch(oxm.getMatchField().id) {
case VLAN_PCP:
@SuppressWarnings("unchecked") OFOxm<VlanPcp> vlanpcp = (OFOxm<VlanPcp>) oxm;
builder.setVlanPcp(vlanpcp.getValue().getValue());
break;
case VLAN_VID:
if (treatmentInterpreter != null) {
try {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
break;
} catch (UnsupportedOperationException e) {
log.debug("Unsupported action extension; defaulting to native OF");
}
}
@SuppressWarnings("unchecked") OFOxm<OFVlanVidMatch> vlanvid = (OFOxm<OFVlanVidMatch>) oxm;
builder.setVlanId(VlanId.vlanId(vlanvid.getValue().getVlan()));
break;
case ETH_DST:
@SuppressWarnings("unchecked") OFOxm<org.projectfloodlight.openflow.types.MacAddress> ethdst = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm;
builder.setEthDst(MacAddress.valueOf(ethdst.getValue().getLong()));
break;
case ETH_SRC:
@SuppressWarnings("unchecked") OFOxm<org.projectfloodlight.openflow.types.MacAddress> ethsrc = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm;
builder.setEthSrc(MacAddress.valueOf(ethsrc.getValue().getLong()));
break;
case IPV4_DST:
@SuppressWarnings("unchecked") OFOxm<IPv4Address> ip4dst = (OFOxm<IPv4Address>) oxm;
builder.setIpDst(Ip4Address.valueOf(ip4dst.getValue().getInt()));
break;
case IPV4_SRC:
@SuppressWarnings("unchecked") OFOxm<IPv4Address> ip4src = (OFOxm<IPv4Address>) oxm;
builder.setIpSrc(Ip4Address.valueOf(ip4src.getValue().getInt()));
break;
case MPLS_LABEL:
@SuppressWarnings("unchecked") OFOxm<U32> labelId = (OFOxm<U32>) oxm;
builder.setMpls(MplsLabel.mplsLabel((int) labelId.getValue().getValue()));
break;
case MPLS_BOS:
@SuppressWarnings("unchecked") OFOxm<OFBooleanValue> mplsBos = (OFOxm<OFBooleanValue>) oxm;
builder.setMplsBos(mplsBos.getValue().getValue());
break;
case TUNNEL_ID:
@SuppressWarnings("unchecked") OFOxm<U64> tunnelId = (OFOxm<U64>) oxm;
builder.setTunnelId(tunnelId.getValue().getValue());
break;
case TCP_DST:
@SuppressWarnings("unchecked") OFOxm<TransportPort> tcpdst = (OFOxm<TransportPort>) oxm;
builder.setTcpDst(TpPort.tpPort(tcpdst.getValue().getPort()));
break;
case TCP_SRC:
@SuppressWarnings("unchecked") OFOxm<TransportPort> tcpsrc = (OFOxm<TransportPort>) oxm;
builder.setTcpSrc(TpPort.tpPort(tcpsrc.getValue().getPort()));
break;
case UDP_DST:
@SuppressWarnings("unchecked") OFOxm<TransportPort> udpdst = (OFOxm<TransportPort>) oxm;
builder.setUdpDst(TpPort.tpPort(udpdst.getValue().getPort()));
break;
case UDP_SRC:
@SuppressWarnings("unchecked") OFOxm<TransportPort> udpsrc = (OFOxm<TransportPort>) oxm;
builder.setUdpSrc(TpPort.tpPort(udpsrc.getValue().getPort()));
break;
case TUNNEL_IPV4_DST:
case NSP:
case NSI:
case NSH_C1:
case NSH_C2:
case NSH_C3:
case NSH_C4:
case NSH_MDTYPE:
case NSH_NP:
case ENCAP_ETH_SRC:
case ENCAP_ETH_DST:
case ENCAP_ETH_TYPE:
case TUN_GPE_NP:
if (treatmentInterpreter != null) {
try {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
} catch (UnsupportedOperationException e) {
log.debug(e.getMessage());
}
}
break;
case EXP_ODU_SIG_ID:
@SuppressWarnings("unchecked") OFOxm<OduSignalID> oduID = (OFOxm<OduSignalID>) oxm;
OduSignalID oduSignalID = oduID.getValue();
OduSignalId oduSignalId = OduSignalId.oduSignalId(oduSignalID.getTpn(), oduSignalID.getTslen(), oduSignalID.getTsmap());
builder.add(modL1OduSignalId(oduSignalId));
break;
case EXP_OCH_SIG_ID:
try {
@SuppressWarnings("unchecked") OFOxm<CircuitSignalID> ochId = (OFOxm<CircuitSignalID>) oxm;
CircuitSignalID circuitSignalID = ochId.getValue();
builder.add(modL0Lambda(Lambda.ochSignal(lookupGridType(circuitSignalID.getGridType()), lookupChannelSpacing(circuitSignalID.getChannelSpacing()), circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth())));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
break;
}
break;
case ARP_OP:
@SuppressWarnings("unchecked") OFOxm<org.projectfloodlight.openflow.types.ArpOpcode> arpop = (OFOxm<org.projectfloodlight.openflow.types.ArpOpcode>) oxm;
builder.setArpOp((short) arpop.getValue().getOpcode());
break;
case ARP_SHA:
@SuppressWarnings("unchecked") OFOxm<org.projectfloodlight.openflow.types.MacAddress> arpsha = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm;
builder.setArpSha(MacAddress.valueOf(arpsha.getValue().getLong()));
break;
case ARP_SPA:
@SuppressWarnings("unchecked") OFOxm<IPv4Address> arpspa = (OFOxm<IPv4Address>) oxm;
builder.setArpSpa(Ip4Address.valueOf(arpspa.getValue().getInt()));
break;
case OFDPA_MPLS_TYPE:
case OFDPA_OVID:
case OFDPA_MPLS_L2_PORT:
case OFDPA_ALLOW_VLAN_TRANSLATION:
case OFDPA_QOS_INDEX:
if (treatmentInterpreter != null) {
try {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
break;
} catch (UnsupportedOperationException e) {
log.warn("Unsupported action extension");
}
}
break;
case IP_DSCP:
@SuppressWarnings("unchecked") OFOxm<IpDscp> ipDscp = (OFOxm<IpDscp>) oxm;
builder.setIpDscp(ipDscp.getValue().getDscpValue());
break;
case ARP_THA:
@SuppressWarnings("unchecked") OFOxm<org.projectfloodlight.openflow.types.MacAddress> arptha = (OFOxm<org.projectfloodlight.openflow.types.MacAddress>) oxm;
builder.setArpTha(MacAddress.valueOf(arptha.getValue().getLong()));
break;
case ARP_TPA:
@SuppressWarnings("unchecked") OFOxm<IPv4Address> arptpa = (OFOxm<IPv4Address>) oxm;
builder.setArpTpa(Ip4Address.valueOf(arptpa.getValue().getInt()));
break;
case BSN_EGR_PORT_GROUP_ID:
case BSN_GLOBAL_VRF_ALLOWED:
case BSN_IN_PORTS_128:
case BSN_L3_DST_CLASS_ID:
case BSN_L3_INTERFACE_CLASS_ID:
case BSN_L3_SRC_CLASS_ID:
case BSN_LAG_ID:
case BSN_TCP_FLAGS:
case BSN_UDF0:
case BSN_UDF1:
case BSN_UDF2:
case BSN_UDF3:
case BSN_UDF4:
case BSN_UDF5:
case BSN_UDF6:
case BSN_UDF7:
case BSN_VLAN_XLATE_PORT_GROUP_ID:
case BSN_VRF:
case ETH_TYPE:
case ICMPV4_CODE:
case ICMPV4_TYPE:
case ICMPV6_CODE:
case ICMPV6_TYPE:
case IN_PHY_PORT:
case IN_PORT:
case IPV6_DST:
case IPV6_FLABEL:
case IPV6_ND_SLL:
case IPV6_ND_TARGET:
case IPV6_ND_TLL:
case IPV6_SRC:
case IP_ECN:
case IP_PROTO:
case METADATA:
case MPLS_TC:
case OCH_SIGID:
case OCH_SIGID_BASIC:
case OCH_SIGTYPE:
case OCH_SIGTYPE_BASIC:
case SCTP_DST:
case SCTP_SRC:
case EXP_ODU_SIGTYPE:
case EXP_OCH_SIGTYPE:
default:
log.warn("Set field type {} not yet implemented.", oxm.getMatchField().id);
break;
}
}
use of org.projectfloodlight.openflow.types.OduSignalID in project onos by opennetworkinglab.
the class FlowModBuilder method buildMatch.
/**
* Builds the match for the flow mod.
*
* @return the match
*/
// CHECKSTYLE IGNORE MethodLength FOR NEXT 300 LINES
protected Match buildMatch() {
Match.Builder mBuilder = factory.buildMatch();
Ip6Address ip6Address;
Ip4Prefix ip4Prefix;
Ip6Prefix ip6Prefix;
EthCriterion ethCriterion;
IPCriterion ipCriterion;
TcpPortCriterion tcpPortCriterion;
UdpPortCriterion udpPortCriterion;
SctpPortCriterion sctpPortCriterion;
IPv6NDLinkLayerAddressCriterion llAddressCriterion;
ArpHaCriterion arpHaCriterion;
ArpPaCriterion arpPaCriterion;
for (Criterion c : selector.criteria()) {
switch(c.type()) {
case IN_PORT:
PortCriterion inPort = (PortCriterion) c;
mBuilder.setExact(MatchField.IN_PORT, OFPort.of((int) inPort.port().toLong()));
break;
case IN_PHY_PORT:
PortCriterion inPhyPort = (PortCriterion) c;
mBuilder.setExact(MatchField.IN_PORT, OFPort.of((int) inPhyPort.port().toLong()));
break;
case METADATA:
MetadataCriterion metadata = (MetadataCriterion) c;
mBuilder.setExact(MatchField.METADATA, OFMetadata.ofRaw(metadata.metadata()));
break;
case ETH_DST:
ethCriterion = (EthCriterion) c;
mBuilder.setExact(MatchField.ETH_DST, MacAddress.of(ethCriterion.mac().toLong()));
break;
case ETH_DST_MASKED:
ethCriterion = (EthCriterion) c;
mBuilder.setMasked(MatchField.ETH_DST, MacAddress.of(ethCriterion.mac().toLong()), MacAddress.of(ethCriterion.mask().toLong()));
break;
case ETH_SRC:
ethCriterion = (EthCriterion) c;
mBuilder.setExact(MatchField.ETH_SRC, MacAddress.of(ethCriterion.mac().toLong()));
break;
case ETH_SRC_MASKED:
ethCriterion = (EthCriterion) c;
mBuilder.setMasked(MatchField.ETH_SRC, MacAddress.of(ethCriterion.mac().toLong()), MacAddress.of(ethCriterion.mask().toLong()));
break;
case ETH_TYPE:
EthTypeCriterion ethType = (EthTypeCriterion) c;
mBuilder.setExact(MatchField.ETH_TYPE, EthType.of(ethType.ethType().toShort()));
break;
case VLAN_VID:
VlanIdCriterion vid = (VlanIdCriterion) c;
if (vid.vlanId().equals(VlanId.ANY)) {
mBuilder.setMasked(MatchField.VLAN_VID, OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
} else if (vid.vlanId().equals(VlanId.NONE)) {
mBuilder.setExact(MatchField.VLAN_VID, OFVlanVidMatch.NONE);
} else {
mBuilder.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort())));
}
break;
case VLAN_PCP:
VlanPcpCriterion vpcp = (VlanPcpCriterion) c;
mBuilder.setExact(MatchField.VLAN_PCP, VlanPcp.of(vpcp.priority()));
break;
case IP_DSCP:
IPDscpCriterion ipDscpCriterion = (IPDscpCriterion) c;
mBuilder.setExact(MatchField.IP_DSCP, IpDscp.of(ipDscpCriterion.ipDscp()));
break;
case IP_ECN:
IPEcnCriterion ipEcnCriterion = (IPEcnCriterion) c;
mBuilder.setExact(MatchField.IP_ECN, IpEcn.of(ipEcnCriterion.ipEcn()));
break;
case IP_PROTO:
IPProtocolCriterion p = (IPProtocolCriterion) c;
mBuilder.setExact(MatchField.IP_PROTO, IpProtocol.of(p.protocol()));
break;
case IPV4_SRC:
ipCriterion = (IPCriterion) c;
ip4Prefix = ipCriterion.ip().getIp4Prefix();
if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) {
Ip4Address maskAddr = Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength());
Masked<IPv4Address> maskedIp = Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), IPv4Address.of(maskAddr.toInt()));
mBuilder.setMasked(MatchField.IPV4_SRC, maskedIp);
} else {
mBuilder.setExact(MatchField.IPV4_SRC, IPv4Address.of(ip4Prefix.address().toInt()));
}
break;
case IPV4_DST:
ipCriterion = (IPCriterion) c;
ip4Prefix = ipCriterion.ip().getIp4Prefix();
if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) {
Ip4Address maskAddr = Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength());
Masked<IPv4Address> maskedIp = Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), IPv4Address.of(maskAddr.toInt()));
mBuilder.setMasked(MatchField.IPV4_DST, maskedIp);
} else {
mBuilder.setExact(MatchField.IPV4_DST, IPv4Address.of(ip4Prefix.address().toInt()));
}
break;
case TCP_SRC:
tcpPortCriterion = (TcpPortCriterion) c;
mBuilder.setExact(MatchField.TCP_SRC, TransportPort.of(tcpPortCriterion.tcpPort().toInt()));
break;
case TCP_SRC_MASKED:
tcpPortCriterion = (TcpPortCriterion) c;
mBuilder.setMasked(MatchField.TCP_SRC, TransportPort.of(tcpPortCriterion.tcpPort().toInt()), TransportPort.of(tcpPortCriterion.mask().toInt()));
break;
case TCP_DST:
tcpPortCriterion = (TcpPortCriterion) c;
mBuilder.setExact(MatchField.TCP_DST, TransportPort.of(tcpPortCriterion.tcpPort().toInt()));
break;
case TCP_DST_MASKED:
tcpPortCriterion = (TcpPortCriterion) c;
mBuilder.setMasked(MatchField.TCP_DST, TransportPort.of(tcpPortCriterion.tcpPort().toInt()), TransportPort.of(tcpPortCriterion.mask().toInt()));
break;
case UDP_SRC:
udpPortCriterion = (UdpPortCriterion) c;
mBuilder.setExact(MatchField.UDP_SRC, TransportPort.of(udpPortCriterion.udpPort().toInt()));
break;
case UDP_SRC_MASKED:
udpPortCriterion = (UdpPortCriterion) c;
mBuilder.setMasked(MatchField.UDP_SRC, TransportPort.of(udpPortCriterion.udpPort().toInt()), TransportPort.of(udpPortCriterion.mask().toInt()));
break;
case UDP_DST:
udpPortCriterion = (UdpPortCriterion) c;
mBuilder.setExact(MatchField.UDP_DST, TransportPort.of(udpPortCriterion.udpPort().toInt()));
break;
case UDP_DST_MASKED:
udpPortCriterion = (UdpPortCriterion) c;
mBuilder.setMasked(MatchField.UDP_DST, TransportPort.of(udpPortCriterion.udpPort().toInt()), TransportPort.of(udpPortCriterion.mask().toInt()));
break;
case SCTP_SRC:
sctpPortCriterion = (SctpPortCriterion) c;
mBuilder.setExact(MatchField.SCTP_SRC, TransportPort.of(sctpPortCriterion.sctpPort().toInt()));
break;
case SCTP_SRC_MASKED:
sctpPortCriterion = (SctpPortCriterion) c;
mBuilder.setMasked(MatchField.SCTP_SRC, TransportPort.of(sctpPortCriterion.sctpPort().toInt()), TransportPort.of(sctpPortCriterion.mask().toInt()));
break;
case SCTP_DST:
sctpPortCriterion = (SctpPortCriterion) c;
mBuilder.setExact(MatchField.SCTP_DST, TransportPort.of(sctpPortCriterion.sctpPort().toInt()));
break;
case SCTP_DST_MASKED:
sctpPortCriterion = (SctpPortCriterion) c;
mBuilder.setMasked(MatchField.SCTP_DST, TransportPort.of(sctpPortCriterion.sctpPort().toInt()), TransportPort.of(sctpPortCriterion.mask().toInt()));
break;
case ICMPV4_TYPE:
IcmpTypeCriterion icmpType = (IcmpTypeCriterion) c;
mBuilder.setExact(MatchField.ICMPV4_TYPE, ICMPv4Type.of(icmpType.icmpType()));
break;
case ICMPV4_CODE:
IcmpCodeCriterion icmpCode = (IcmpCodeCriterion) c;
mBuilder.setExact(MatchField.ICMPV4_CODE, ICMPv4Code.of(icmpCode.icmpCode()));
break;
case IPV6_SRC:
ipCriterion = (IPCriterion) c;
ip6Prefix = ipCriterion.ip().getIp6Prefix();
if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) {
Ip6Address maskAddr = Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength());
Masked<IPv6Address> maskedIp = Masked.of(IPv6Address.of(ip6Prefix.address().toString()), IPv6Address.of(maskAddr.toString()));
mBuilder.setMasked(MatchField.IPV6_SRC, maskedIp);
} else {
mBuilder.setExact(MatchField.IPV6_SRC, IPv6Address.of(ip6Prefix.address().toString()));
}
break;
case IPV6_DST:
ipCriterion = (IPCriterion) c;
ip6Prefix = ipCriterion.ip().getIp6Prefix();
if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) {
Ip6Address maskAddr = Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength());
Masked<IPv6Address> maskedIp = Masked.of(IPv6Address.of(ip6Prefix.address().toString()), IPv6Address.of(maskAddr.toString()));
mBuilder.setMasked(MatchField.IPV6_DST, maskedIp);
} else {
mBuilder.setExact(MatchField.IPV6_DST, IPv6Address.of(ip6Prefix.address().toString()));
}
break;
case IPV6_FLABEL:
IPv6FlowLabelCriterion flowLabelCriterion = (IPv6FlowLabelCriterion) c;
mBuilder.setExact(MatchField.IPV6_FLABEL, IPv6FlowLabel.of(flowLabelCriterion.flowLabel()));
break;
case ICMPV6_TYPE:
Icmpv6TypeCriterion icmpv6Type = (Icmpv6TypeCriterion) c;
mBuilder.setExact(MatchField.ICMPV6_TYPE, U8.of(icmpv6Type.icmpv6Type()));
break;
case ICMPV6_CODE:
Icmpv6CodeCriterion icmpv6Code = (Icmpv6CodeCriterion) c;
mBuilder.setExact(MatchField.ICMPV6_CODE, U8.of(icmpv6Code.icmpv6Code()));
break;
case IPV6_ND_TARGET:
IPv6NDTargetAddressCriterion targetAddressCriterion = (IPv6NDTargetAddressCriterion) c;
ip6Address = targetAddressCriterion.targetAddress();
mBuilder.setExact(MatchField.IPV6_ND_TARGET, IPv6Address.of(ip6Address.toOctets()));
break;
case IPV6_ND_SLL:
llAddressCriterion = (IPv6NDLinkLayerAddressCriterion) c;
mBuilder.setExact(MatchField.IPV6_ND_SLL, MacAddress.of(llAddressCriterion.mac().toLong()));
break;
case IPV6_ND_TLL:
llAddressCriterion = (IPv6NDLinkLayerAddressCriterion) c;
mBuilder.setExact(MatchField.IPV6_ND_TLL, MacAddress.of(llAddressCriterion.mac().toLong()));
break;
case MPLS_LABEL:
MplsCriterion mp = (MplsCriterion) c;
mBuilder.setExact(MatchField.MPLS_LABEL, U32.of(mp.label().toInt()));
break;
case IPV6_EXTHDR:
IPv6ExthdrFlagsCriterion exthdrFlagsCriterion = (IPv6ExthdrFlagsCriterion) c;
mBuilder.setExact(MatchField.IPV6_EXTHDR, U16.of(exthdrFlagsCriterion.exthdrFlags()));
break;
case OCH_SIGID:
try {
OchSignalCriterion ochSignalCriterion = (OchSignalCriterion) c;
OchSignal signal = ochSignalCriterion.lambda();
byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType());
byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing());
mBuilder.setExact(MatchField.EXP_OCH_SIG_ID, new CircuitSignalID(gridType, channelSpacing, (short) signal.spacingMultiplier(), (short) signal.slotGranularity()));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
}
break;
case OCH_SIGTYPE:
try {
OchSignalTypeCriterion sc = (OchSignalTypeCriterion) c;
byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType());
mBuilder.setExact(MatchField.EXP_OCH_SIGTYPE, U8.of(signalType));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
}
break;
case ODU_SIGID:
OduSignalIdCriterion oduSignalIdCriterion = (OduSignalIdCriterion) c;
OduSignalId oduSignalId = oduSignalIdCriterion.oduSignalId();
mBuilder.setExact(MatchField.EXP_ODU_SIG_ID, new OduSignalID((short) oduSignalId.tributaryPortNumber(), (short) oduSignalId.tributarySlotLength(), oduSignalId.tributarySlotBitmap()));
break;
case ODU_SIGTYPE:
try {
OduSignalTypeCriterion oduSignalTypeCriterion = (OduSignalTypeCriterion) c;
byte oduSigType = OpenFlowValueMapper.lookupOduSignalType(oduSignalTypeCriterion.signalType());
mBuilder.setExact(MatchField.EXP_ODU_SIGTYPE, U8.of(oduSigType));
} catch (NoMappingFoundException e) {
log.warn(e.getMessage());
}
break;
case TUNNEL_ID:
TunnelIdCriterion tunnelId = (TunnelIdCriterion) c;
mBuilder.setExact(MatchField.TUNNEL_ID, U64.of(tunnelId.tunnelId()));
break;
case MPLS_BOS:
MplsBosCriterion mplsBos = (MplsBosCriterion) c;
mBuilder.setExact(MatchField.MPLS_BOS, mplsBos.mplsBos() ? OFBooleanValue.TRUE : OFBooleanValue.FALSE);
break;
case ARP_OP:
ArpOpCriterion arpOp = (ArpOpCriterion) c;
mBuilder.setExact(MatchField.ARP_OP, ArpOpcode.of(arpOp.arpOp()));
break;
case ARP_SHA:
arpHaCriterion = (ArpHaCriterion) c;
mBuilder.setExact(MatchField.ARP_SHA, MacAddress.of(arpHaCriterion.mac().toLong()));
break;
case ARP_SPA:
arpPaCriterion = (ArpPaCriterion) c;
mBuilder.setExact(MatchField.ARP_SPA, IPv4Address.of(arpPaCriterion.ip().toInt()));
break;
case ARP_THA:
arpHaCriterion = (ArpHaCriterion) c;
mBuilder.setExact(MatchField.ARP_THA, MacAddress.of(arpHaCriterion.mac().toLong()));
break;
case ARP_TPA:
arpPaCriterion = (ArpPaCriterion) c;
mBuilder.setExact(MatchField.ARP_TPA, IPv4Address.of(arpPaCriterion.ip().toInt()));
break;
case EXTENSION:
ExtensionCriterion extensionCriterion = (ExtensionCriterion) c;
OFOxm oxm = buildExtensionOxm(extensionCriterion.extensionSelector());
if (oxm == null) {
log.warn("Unable to build extension selector");
break;
}
if (oxm.isMasked()) {
mBuilder.setMasked(oxm.getMatchField(), oxm.getValue(), oxm.getMask());
} else {
mBuilder.setExact(oxm.getMatchField(), oxm.getValue());
}
break;
case MPLS_TC:
case PBB_ISID:
// TODO: need to implement PBB-ISID case when OpenFlowJ is ready
default:
log.warn("Match type {} not yet implemented.", c.type());
}
}
return mBuilder.build();
}
use of org.projectfloodlight.openflow.types.OduSignalID in project onos by opennetworkinglab.
the class FlowModBuilderVer13 method buildL1Modification.
protected OFAction buildL1Modification(Instruction i) {
L1ModificationInstruction l1m = (L1ModificationInstruction) i;
OFOxm<?> oxm = null;
switch(l1m.subtype()) {
case ODU_SIGID:
ModOduSignalIdInstruction modOduSignalIdInstruction = (ModOduSignalIdInstruction) l1m;
OduSignalId oduSignalId = modOduSignalIdInstruction.oduSignalId();
OduSignalID oduSignalID = new OduSignalID((short) oduSignalId.tributaryPortNumber(), (short) oduSignalId.tributarySlotLength(), oduSignalId.tributarySlotBitmap());
oxm = factory().oxms().expOduSigId(oduSignalID);
break;
default:
log.warn("Unimplemented action type {}.", l1m.subtype());
break;
}
if (oxm != null) {
return factory().actions().buildSetField().setField(oxm).build();
}
return null;
}
Aggregations