Java 类org.projectfloodlight.openflow.protocol.OFFlowModCommand 实例源码

项目:openflowj-otn    文件:OFFlowModCommandSerializerVer12.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.2: " + val);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer12.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.2: " + e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer13.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.3: " + val);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer13.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.3: " + e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer10.java   
public static OFFlowModCommand ofWireValue(short val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.0: " + val);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer10.java   
public static short toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.0: " + e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer11.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.1: " + val);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer11.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.1: " + e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer14.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.4: " + val);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer14.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.4: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer12.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.2: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer12.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.2: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer13.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.3: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer13.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.3: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer10.java   
public static OFFlowModCommand ofWireValue(short val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.0: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer10.java   
public static short toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.0: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer15.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.5: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer15.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.5: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer11.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.1: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer11.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.1: " + e);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer14.java   
public static OFFlowModCommand ofWireValue(byte val) {
    switch(val) {
        case ADD_VAL:
            return OFFlowModCommand.ADD;
        case MODIFY_VAL:
            return OFFlowModCommand.MODIFY;
        case MODIFY_STRICT_VAL:
            return OFFlowModCommand.MODIFY_STRICT;
        case DELETE_VAL:
            return OFFlowModCommand.DELETE;
        case DELETE_STRICT_VAL:
            return OFFlowModCommand.DELETE_STRICT;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFFlowModCommand in version 1.4: " + val);
    }
}
项目:loxigen-artifacts    文件:OFFlowModCommandSerializerVer14.java   
public static byte toWireValue(OFFlowModCommand e) {
    switch(e) {
        case ADD:
            return ADD_VAL;
        case MODIFY:
            return MODIFY_VAL;
        case MODIFY_STRICT:
            return MODIFY_STRICT_VAL;
        case DELETE:
            return DELETE_VAL;
        case DELETE_STRICT:
            return DELETE_STRICT_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFFlowModCommand in version 1.4: " + e);
    }
}
项目:open-kilda    文件:SwitchManagerTest.java   
@Test
public void deleteFlow() throws Exception {
    Capture<OFFlowMod> capture = prepareForInstallTest();
    switchManager.deleteFlow(dpid, cookieHex, cookie);
    final OFFlowMod actual = capture.getValue();
    assertEquals(OFFlowModCommand.DELETE, actual.getCommand());
    assertEquals(Long.valueOf(cookieHex, 16).longValue(), actual.getCookie().getValue());
    assertEquals(SwitchManager.NON_SYSTEM_MASK, actual.getCookieMask());
}
项目:fresco_floodlight    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:iTAP-controller    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:SDN-Multicast    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:arscheduler    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:floodlight1.2-delay    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:floodlight-hardware    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC),
            match.get(MatchField.VLAN_VID) == null
            ? VlanVid.ZERO
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:ACAMPController    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:fast-failover-demo    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:floodlightLB    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:DSC    文件:LearningSwitch.java   
/**
 * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
 * the switch's table.
 * @param sw The switch that sent the flow removed message.
 * @param flowRemovedMessage The flow removed message.
 * @return Whether to continue processing this message or stop.
 */
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
    if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
        return Command.CONTINUE;
    }
    if (log.isTraceEnabled()) {
        log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
    }
    Match match = flowRemovedMessage.getMatch();
    // When a flow entry expires, it means the device with the matching source
    // MAC address and VLAN either stopped sending packets or moved to a different
    // port.  If the device moved, we can't know where it went until it sends
    // another packet, allowing us to re-learn its port.  Meanwhile we remove
    // it from the macVlanToPortMap to revert to flooding packets to this device.
    this.removeFromPortMap(sw, match.get(MatchField.ETH_SRC), 
            match.get(MatchField.VLAN_VID) == null 
            ? VlanVid.ZERO 
            : match.get(MatchField.VLAN_VID).getVlanVid());

    // Also, if packets keep coming from another device (e.g. from ping), the
    // corresponding reverse flow entry will never expire on its own and will
    // send the packets to the wrong port (the matching input port of the
    // expired flow entry), so we must delete the reverse entry explicitly.
    Match.Builder mb = sw.getOFFactory().buildMatch();
    mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
    .setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
    if (match.get(MatchField.VLAN_VID) != null) {
        mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
    }
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer12.java   
public static OFFlowModCommand readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readByte());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer13.java   
public static OFFlowModCommand readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readByte());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer10.java   
public static OFFlowModCommand readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer11.java   
public static OFFlowModCommand readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readByte());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
项目:openflowj-otn    文件:OFFlowModCommandSerializerVer14.java   
public static OFFlowModCommand readFrom(ChannelBuffer bb) throws OFParseError {
    try {
        return ofWireValue(bb.readByte());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}
项目:Engine    文件:ResolutionUtils.java   
/**
 * Gets a value indicating whether the given FlowMod messages create a conflict in their action sets.
 *
 * @param offm1 The first OFFlowMod.
 * @param offm2 The second OFFlowMod.
 * @return True, if a conflict was found. False otherwise.
 */
public static boolean getActionConflicts(OFFlowMod offm1, OFFlowMod offm2) {
    // only possible on following command constellations: ADD-ADD, ADD-MODIFY, MODIFY-MODIFY, MODIFY-DELETE (or NOT DELETE-DELETE)
    OFFlowModCommand c1 = offm1.getCommand();
    OFFlowModCommand c2 = offm2.getCommand();
    if (c1 != DELETE && c1 != DELETE_STRICT && c2 != DELETE && c2 != DELETE_STRICT) {
        return offm1.getActions().stream().anyMatch(a -> offm2.getActions().stream().anyMatch(a::equals));
    }
    return false;
}
项目:spring-open    文件:FlowSynchronizerTest.java   
@Before
public void setUp() throws Exception {
    factory10 = OFFactories.getFactory(OFVersion.OF_10);
    idAdded = new ArrayList<Long>();
    idRemoved = new ArrayList<Long>();

    pusher = createMock(FlowPusher.class);
    expect(pusher.suspend(anyObject(Dpid.class))).andReturn(true).anyTimes();
    expect(pusher.resume(anyObject(Dpid.class))).andReturn(true).anyTimes();
    pusher.add(anyObject(Dpid.class), anyObject(OFMessage.class),
            eq(MsgPriority.HIGH));
    expectLastCall().andAnswer(new IAnswer<Object>() {
        @Override
        public Object answer() throws Throwable {
            OFMessage msg = (OFMessage) getCurrentArguments()[1];
            if (msg.getType().equals(OFType.FLOW_MOD)) {
                OFFlowMod fm = (OFFlowMod) msg;
                if (fm.getCommand() == OFFlowModCommand.DELETE_STRICT) {
                    idRemoved.add(fm.getCookie().getValue());
                }
            }
            return null;
        }
    }).anyTimes();
    pusher.pushFlowEntry(anyObject(Dpid.class), anyObject(FlowEntry.class),
            eq(MsgPriority.HIGH));
    expectLastCall().andAnswer(new IAnswer<Object>() {
        @Override
        public Object answer() throws Throwable {
            FlowEntry flow = (FlowEntry) getCurrentArguments()[1];
            idAdded.add(flow.getFlowEntryId());
            return null;
        }
    }).anyTimes();
    replay(pusher);
}