Exemplo n.º 1
0
  protected boolean isInSwitchBroadcastCache(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
    if (sw == null) return true;

    // If the feature is disabled, always return false;
    if (!broadcastCacheFeature) return false;

    // Get the hash of the Ethernet packet.
    Ethernet eth =
        IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);

    long hash = pi.getInPort() * prime2 + eth.hashCode();

    // some FORWARD_OR_FLOOD packets are unicast with unknown destination mac
    return sw.updateBroadcastCache(hash, pi.getInPort());
  }
Exemplo n.º 2
0
  protected boolean isInBroadcastCache(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
    // Get the cluster id of the switch.
    // Get the hash of the Ethernet packet.
    if (sw == null) return true;

    // If the feature is disabled, always return false;
    if (!broadcastCacheFeature) return false;

    Ethernet eth =
        IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);

    Long broadcastHash;
    broadcastHash =
        topology.getL2DomainId(sw.getId()) * prime1 + pi.getInPort() * prime2 + eth.hashCode();
    if (broadcastCache.update(broadcastHash)) {
      sw.updateBroadcastCache(broadcastHash, pi.getInPort());
      return true;
    } else {
      return false;
    }
  }