public OFMatchWithSwDpid(final OFMatch ofm, final long swDpid) { this.ofMatch = ofm.clone(); this.switchDataPathId = swDpid; }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof OFMatchWithSwDpid)) { return false; } final OFMatchWithSwDpid other = (OFMatchWithSwDpid) obj; if (this.ofMatch == null) { if (other.ofMatch != null) { return false; } } else if (!this.ofMatch.equals(other.ofMatch)) { return false; } if (this.switchDataPathId != other.switchDataPathId) { return false; } return true; } }
/** * Instantiates a new OVXmatch from an OFMatch instance. * * @param match * the match */ public OVXMatch(final OFMatch match) { this.wildcards = match.getWildcards(); this.inputPort = match.getInputPort(); this.dataLayerSource = match.getDataLayerSource(); this.dataLayerDestination = match.getDataLayerDestination(); this.dataLayerVirtualLan = match.getDataLayerVirtualLan(); this.dataLayerVirtualLanPriorityCodePoint = match .getDataLayerVirtualLanPriorityCodePoint(); this.dataLayerType = match.getDataLayerType(); this.networkTypeOfService = match.getNetworkTypeOfService(); this.networkProtocol = match.getNetworkProtocol(); this.networkSource = match.getNetworkSource(); this.networkDestination = match.getNetworkDestination(); this.transportSource = match.getTransportSource(); this.transportDestination = match.getTransportDestination(); this.cookie = 0; this.pktData = null; }
/** * Checks for "ANY" values that should be wildcards but aren't, such as * NW_SRC/DST 0.0.0.0, and TCP/UDP port 0. * * @param omatch * The OFMatch of the FlowMod we are comparing entries against * @param owcard * The wildcard field of the FlowMod. * @return the modified wildcard value (a copy). */ private int convertToWcards(OFMatch omatch) { int owcard = omatch.getWildcards(); if (omatch.getNetworkDestination() == 0) { owcard |= OFMatch.OFPFW_NW_DST_ALL | OFMatch.OFPFW_NW_DST_MASK; } if (omatch.getNetworkSource() == 0) { owcard |= OFMatch.OFPFW_NW_SRC_ALL | OFMatch.OFPFW_NW_SRC_MASK; } if (omatch.getNetworkProtocol() == 0) { owcard |= OFMatch.OFPFW_NW_PROTO; } if (omatch.getTransportDestination() == 0) { owcard |= OFMatch.OFPFW_TP_DST; } if (omatch.getTransportSource() == 0) { owcard |= OFMatch.OFPFW_TP_SRC; } return owcard; }
public static void rewriteMatch(final Integer tenantId, final OFMatch match) { match.setNetworkSource(getPhysicalIp(tenantId, match.getNetworkSource())); match.setNetworkDestination(getPhysicalIp(tenantId, match.getNetworkDestination())); }
if (ofMatch == null) { Match match = flow.getMatch(); ofMatch = (isIPv6) ? new V6Match() : new OFMatch(); MatchType.IN_PORT).getValue()).getID(); if (!isIPv6) { ofMatch.setInputPort(port); wildcards &= ~OFMatch.OFPFW_IN_PORT; } else { .getValue(); if (!isIPv6) { ofMatch.setDataLayerSource(srcMac.clone()); wildcards &= ~OFMatch.OFPFW_DL_SRC; } else { .getValue(); if (!isIPv6) { ofMatch.setDataLayerDestination(dstMac.clone()); wildcards &= ~OFMatch.OFPFW_DL_DST; } else { ofMatch.setDataLayerVirtualLan(vlan); wildcards &= ~OFMatch.OFPFW_DL_VLAN; } else { .getValue(); if (!isIPv6) { ofMatch.setDataLayerVirtualLanPriorityCodePoint(vlanPr);
if (this.getDataLayerType() != (short) 0x8100) { // need cast to avoid this.setDataLayerVirtualLan((short) 0xffff); this.setDataLayerVirtualLanPriorityCodePoint((byte) 0); } else { this.setDataLayerVirtualLan((short) (0xfff & scratch)); this.setDataLayerVirtualLanPriorityCodePoint((byte) ((0xe000 & scratch) >> 13)); this.dataLayerType = packetDataBB.getShort(); switch (this.getDataLayerType()) { case 0x0800: this.setNetworkTypeOfService((byte) ((0xfc & scratch) >> 2)); this.setNetworkProtocol((byte) (0xff & scratch)); this.setNetworkSource(0); this.setNetworkDestination(0); | OFMatch.OFPFW_NW_SRC_ALL | OFMatch.OFPFW_NW_PROTO | OFMatch.OFPFW_NW_TOS; this.setNetworkTypeOfService((byte) 0); this.setNetworkProtocol((byte) 0); this.setNetworkSource(0); this.setNetworkDestination(0); break; switch (this.getNetworkProtocol()) {
final OFMatch match = new OFMatch(); match.loadFromPacket(this.getPacketData(), inport); if (match.getDataLayerType() == Ethernet.TYPE_IPV4 || match.getDataLayerType() == Ethernet.TYPE_ARP) { PhysicalIPAddress srcIP = new PhysicalIPAddress( match.getNetworkSource()); PhysicalIPAddress dstIP = new PhysicalIPAddress( match.getNetworkDestination()); this.log.error( "Virtual Src Port Unknown: {}, port {} with this match {}; dropping packet", sw.getName(), match.getInputPort(), match); return; .setDestinationMACAddress( macList.get(1).toBytes()); match.setDataLayerSource(eth.getSourceMACAddress()) .setDataLayerDestination( eth.getDestinationMACAddress()); } catch (NetworkMappingException e) { if (match.getDataLayerType() == Ethernet.TYPE_ARP) { } else if (match.getDataLayerType() == Ethernet.TYPE_IPV4) { try { final IPv4 ip = (IPv4) eth.getPayload(); match.getDataLayerType());
public static List<OFAction> prependUnRewriteActions(final OFMatch match) { final List<OFAction> actions = new LinkedList<OFAction>(); if (!match.getWildcardObj().isWildcarded(Flag.NW_SRC)) { final OVXActionNetworkLayerSource srcAct = new OVXActionNetworkLayerSource(); srcAct.setNetworkAddress(match.getNetworkSource()); actions.add(srcAct); } if (!match.getWildcardObj().isWildcarded(Flag.NW_DST)) { final OVXActionNetworkLayerDestination dstAct = new OVXActionNetworkLayerDestination(); dstAct.setNetworkAddress(match.getNetworkDestination()); actions.add(dstAct); } return actions; } }
@Override public void devirtualize(final OVXSwitch sw) { if (this.match.getDataLayerType() == Ethernet.TYPE_LLDP) { return; bufferId = sw.getFromBufferMap(this.bufferId).getBufferId(); final short inport = this.getMatch().getInputPort(); if (this.match.getWildcardObj().isWildcarded(Flag.IN_PORT)) { int wcard = this.match.getWildcards() & (~OFMatch.OFPFW_IN_PORT); this.match.setWildcards(wcard); prepAndSendSouth(iport, pflag);
private void learnAddresses(final OFMatch match, final Mappable map) { if (match.getDataLayerType() == Ethernet.TYPE_IPV4 || match.getDataLayerType() == Ethernet.TYPE_ARP) { if (!match.getWildcardObj().isWildcarded(Flag.NW_SRC)) { IPMapper.getPhysicalIp(this.tenantId, match.getNetworkSource()); } if (!match.getWildcardObj().isWildcarded(Flag.NW_DST)) { IPMapper.getPhysicalIp(this.tenantId, match.getNetworkDestination()); } } }
.getVirtualNetwork(this.getTenantId()) .getFlowManager() .storeFlowValues(fm.getMatch().getDataLayerSource(), fm.getMatch().getDataLayerDestination()); link.generateLinkFMs(fm.clone(), flowId); outActions.addAll(new OVXLinkUtils(this.getTenantId(), linkId, if (fm.getMatch().getDataLayerType() == Ethernet.TYPE_IPV4) { IPMapper.rewriteMatch(this.getSrcPort().getTenantId(), fm.getMatch()); if (outPort != null) { inPort = phyLink.getSrcPort(); fm.getMatch().setInputPort(inPort.getPortNumber()); fm.setLengthU(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH); .setInputPort(phyLink.getSrcPort().getPortNumber()); int actLenght = 0; outActions.add(new OFActionOutput(this.getDstPort()
return; this.getMatch().setInputPort(inPort.getPhysicalPortNumber()); OVXMessageUtil.translateXid(this, inPort); try { && (!this.match.getWildcardObj().isWildcarded( Flag.DL_DST) || !this.match.getWildcardObj() .isWildcarded(Flag.DL_SRC))) { .getVirtualNetwork(sw.getTenantId()) .getFlowManager() .getFlowId(this.match.getDataLayerSource(), this.match.getDataLayerDestination()); OVXLinkUtils lUtils = new OVXLinkUtils( sw.getTenantId(), link.getLinkId(), flowId);
@Override public void deleteAllFlows() { logger.trace("deleteAllFlows on switch {}", HexString.toHexString(this.sid)); OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL); OFFlowMod flowMod = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD); flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE).setOutPort(OFPort.OFPP_NONE) .setLength((short) OFFlowMod.MINIMUM_LENGTH); asyncFastSend(flowMod); } }
.getVirtualNetwork(this.getTenantId()) .getFlowManager() .getFlowId(fm.getMatch().getDataLayerSource(), fm.getMatch().getDataLayerDestination()); } catch (NetworkMappingException e) { SwitchRoute.log.warn( fm.getMatch().setInputPort(this.getSrcPort().getPhysicalPortNumber());
fm.setCookie(cookie << 32); if (fm.getMatch().getDataLayerType() == Ethernet.TYPE_IPV4) { IPMapper.rewriteMatch(this.tenantId, fm.getMatch()); if (outPort != null) { inPort = phyLink.getSrcPort(); fm.getMatch().setInputPort(inPort.getPortNumber()); fm.setLengthU(OVXFlowMod.MINIMUM_LENGTH + OVXActionOutput.MINIMUM_LENGTH);
.getFlowManager() .storeFlowValues( fe.getMatch().getDataLayerSource(), fe.getMatch() .getDataLayerDestination());
private void postprocessWildCardInfo() { // Sync with 0F 1.0 Match if (super.getDataLayerType() == 0x800) { if (((this.wildcards >> 8) & 0x3f) == 0x3f) { // ipv4 src processing this.wildcards ^= (((1 << 5) - 1) << 8); } if (((this.wildcards >> 14) & 0x3f) == 0x3f) { // ipv4 dest processing this.wildcards ^= (((1 << 5) - 1) << 14); } } }
public OFMatchWithSwDpid() { this.ofMatch = new OFMatch(); this.switchDataPathId = 0; }