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

项目:ravikumaran201504    文件:OFChannelHandler.java   
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
        throws SwitchStateException {
    // Read port description
    if (m.getStatsType() != OFStatsType.PORT_DESC) {
        log.warn("Expecting port description stats but received stats "
                + "type {} from {}. Ignoring ...", m.getStatsType(),
                h.channel.getRemoteAddress());
        return;
    }
    if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        log.warn("Stats reply indicates more stats from sw {} for "
                + "port description - not currently handled",
                h.getSwitchInfoString());
    }
    h.portDescReply = (OFPortDescStatsReply) m; // temp store
    log.info("Received port desc reply for switch at {}",
            h.getSwitchInfoString());
    try {
        h.sendHandshakeSetConfig();
    } catch (IOException e) {
        log.error("Unable to send setConfig after PortDescReply. "
                + "Error: {}", e.getMessage());
    }
    h.setState(WAIT_CONFIG_REPLY);
}
项目:Engine    文件:NetIDEDeviceListener.java   
@Override
public void switchAdded(Dpid dpid) {
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    OFVersion version = sw.factory().getVersion();
    Integer ofVersion = version.getWireVersion();
    shimController.setSupportedProtocol(ofVersion.byteValue());
    OFFeaturesReply featuresReply = shimController.getFeatureReply(sw);
    controller.setRole(dpid, RoleState.MASTER);
    shimController.sendOpenFlowMessageToCore(featuresReply,featuresReply.getXid(),sw.getId(),0);

    //Create OFPortDescStatsReply for OF_13
    if (sw.factory().getVersion() == OFVersion.OF_13) {
        OFPortDescStatsReply.Builder statsReplyBuilder = sw.factory().buildPortDescStatsReply();
        statsReplyBuilder.setEntries(sw.getPorts())
                .setXid(0);
        OFPortDescStatsReply ofPortStatsReply = statsReplyBuilder.build();
        shimController.sendOpenFlowMessageToCore(ofPortStatsReply,ofPortStatsReply.getXid(),sw.getId(),0);
    }
    log.info("Switch {} connected", dpid);
}
项目:athena    文件:OfOpticalSwitchImplLinc13.java   
/**
 * Checks if given port is also part of the regular port desc stats, i.e., is the port a tap port.
 *
 * @param port given port number
 * @return true if the port is a tap (OCh), false otherwise (OMS port)
 */
private boolean isOChPort(long port) {
    for (OFPortDescStatsReply reply : this.ports) {
        for (OFPortDesc p : reply.getEntries()) {
            if (p.getPortNo().getPortNumber() == port) {
                return true;
            }
        }
    }

    return false;
}
项目:athena    文件:OFChannelHandler.java   
/**
 * Create a new unconnected OFChannelHandler.
 * @param controller parent controller
 */
OFChannelHandler(Controller controller) {
    this.controller = controller;
    this.state = ChannelState.INIT;
    this.pendingPortStatusMsg = new CopyOnWriteArrayList<OFPortStatus>();
    this.portDescReplies = new ArrayList<OFPortDescStatsReply>();
    factory13 = controller.getOFMessageFactory13();
    factory10 = controller.getOFMessageFactory10();
    duplicateDpidFound = Boolean.FALSE;
}
项目:athena    文件:OFChannelHandler.java   
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
        throws SwitchStateException {
    // Read port description
    if (m.getStatsType() != OFStatsType.PORT_DESC) {
        log.warn("Expecting port description stats but received stats "
                + "type {} from {}. Ignoring ...", m.getStatsType(),
                h.channel.getRemoteAddress());
        return;
    }
    if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        log.debug("Stats reply indicates more stats from sw {} for "
                + "port description",
                h.getSwitchInfoString());
        h.portDescReplies.add((OFPortDescStatsReply)m);
        return;
    }
    else {
        h.portDescReplies.add((OFPortDescStatsReply)m);
    }
    //h.portDescReply = (OFPortDescStatsReply) m; // temp store
    log.info("Received port desc reply for switch at {}",
            h.getSwitchInfoString());
    try {
        h.sendHandshakeSetConfig();
    } catch (IOException e) {
        log.error("Unable to send setConfig after PortDescReply. "
                + "Error: {}", e.getMessage());
    }
    h.setState(WAIT_CONFIG_REPLY);
}
项目:athena    文件:OFChannelHandler.java   
@Override
void processOFStatisticsReply(OFChannelHandler h,
        OFStatsReply m) {
    if (m.getStatsType().equals(OFStatsType.PORT_DESC)) {
        h.sw.setPortDescReply((OFPortDescStatsReply) m);
    }
    h.dispatchMessage(m);
}
项目:fresco_floodlight    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.getOFFactory()).andReturn(factory).once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:iTAP-controller    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch(boolean subHandShakeComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.isDriverHandshakeComplete()).andReturn(subHandShakeComplete).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    verify(sw, switchManager);
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:SDN-Multicast    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.getOFFactory()).andReturn(factory).once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:arscheduler    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:arscheduler    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:arscheduler    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:arscheduler    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}
项目:arscheduler    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.getOFFactory()).andReturn(factory).once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:floodlight1.2-delay    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.getOFFactory()).andReturn(factory).once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:floodlight-hardware    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandlerVer10Test.java   
public void handleDescStatsAndCreateSwitch(boolean switchDriverComplete) throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.startDriverHandshake();
    expectLastCall().once();
    expect(sw.getOFFactory()).andReturn(factory).once();
    sw.isDriverHandshakeComplete();
    expectLastCall().andReturn(switchDriverComplete).once();

    if(factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
        expectLastCall().once();
    }

    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);
}
项目:ACAMPController    文件:OFSwitch.java   
@Override
public void setPortDescStats(OFPortDescStatsReply reply) {
    /* ports are updated via port status message, so we
     * only fill in ports on initial connection.
     */
    List<OFPortDesc> OFPortDescs = reply.getEntries();
    portManager.updatePorts(OFPortDescs);
}
项目:ACAMPController    文件:OFSwitchHandshakeHandler.java   
void processOFStatsReply(OFStatsReply m) {
    switch(m.getStatsType()) {
    case PORT_DESC:
        processPortDescStatsReply((OFPortDescStatsReply) m);
        break;
    default:
        unhandledMessageReceived(m);
    }
}
项目:ACAMPController    文件:OFSwitchHandshakeHandlerVer13Test.java   
OFPortDescStatsReply getPortDescStatsReply() {
    OFPortDesc portDesc = factory.buildPortDesc()
            .setName("Eth1")
            .setPortNo(OFPort.of(1))
            .build();
    return factory.buildPortDescStatsReply()
        .setEntries(ImmutableList.<OFPortDesc>of(portDesc))
        .build();
}
项目:ACAMPController    文件:OFSwitchHandshakeHandlerVer13Test.java   
public void handleDescStatsAndCreateSwitch() throws Exception {
    // build the stats reply
    OFDescStatsReply sr = createDescriptionStatsReply();

    reset(sw);
    SwitchDescription switchDescription = new SwitchDescription(sr);
    setupSwitchForInstantiationWithReset();
    sw.setPortDescStats(anyObject(OFPortDescStatsReply.class));
    expectLastCall().once();

    expect(sw.getOFFactory()).andReturn(factory).once();
    replay(sw);

    reset(switchManager);
    expect(switchManager.getHandshakePlugins()).andReturn(plugins).anyTimes();
    expect(
           switchManager.getOFSwitchInstance(anyObject(OFConnection.class),
                                          eq(switchDescription),
                                          anyObject(OFFactory.class),
                                          anyObject(DatapathId.class))).andReturn(sw).once();
    expect(switchManager.getNumRequiredConnections()).andReturn(1).anyTimes(); 
    switchManager.switchAdded(sw);
    expectLastCall().once();
    replay(switchManager);

    // send the description stats reply
    switchHandler.processOFMessage(sr);

    OFMessage msg = connection.retrieveMessage();
    assertThat(msg, CoreMatchers.instanceOf(OFTableFeaturesStatsRequest.class));
    verifyUniqueXids(msg);

    verify(sw, switchManager);
}