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

项目:spring-open    文件:OFSwitchImplSpringOpenTTP.java   
public OFSwitchImplSpringOpenTTP(OFDescStatsReply desc, boolean usePipeline13) {
    super();
    haltStateMachine = new AtomicBoolean(false);
    driverState = DriverState.INIT;
    driverHandshakeComplete = new AtomicBoolean(false);
    setSwitchDescription(desc);
    neighbors = new ConcurrentHashMap<Dpid, Set<PortNumber>>();
    portToNeighbors = new ConcurrentHashMap<PortNumber, Dpid>();
    nsToGroups = new ConcurrentHashMap<NeighborSet, EcmpInfo>();
    ecmpGroups = new ConcurrentHashMap<Integer, EcmpInfo>();
    userDefinedGroups = new ConcurrentHashMap<Integer, EcmpInfo>();
    portNeighborSetMap =
            new ConcurrentHashMap<PortNumber, HashSet<NeighborSet>>();
    segmentIds = new ArrayList<Integer>();
    isEdgeRouter = false;
    groupid = new AtomicInteger(0);
    this.usePipeline13 = usePipeline13;
}
项目:open-kilda    文件:FloodlightTestCase.java   
public IOFSwitch buildMockIOFSwitch(Long id, OFPortDesc portDesc, OFFactory factory,
        OFDescStatsReply swDesc, InetSocketAddress inetAddr) {
    IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
    expect(sw.getId()).andReturn(DatapathId.of(id)).anyTimes();
    expect(sw.getPort(OFPort.of(1))).andReturn(portDesc).anyTimes();
    expect(sw.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(new SwitchDescription(swDesc)).anyTimes();
    expect(sw.isActive()).andReturn(true).anyTimes();
    expect(sw.getLatency()).andReturn(U64.of(10L)).anyTimes();
    expect(sw.getInetAddress()).andReturn(inetAddr).anyTimes();
    return sw;
}
项目:athena    文件:OFSwitchImplSpringOpenTTPDellOSR.java   
public OFSwitchImplSpringOpenTTPDellOSR(Dpid dpid, OFDescStatsReply desc) {
    super(dpid, desc);
    vlanTableId = DELL_TABLE_VLAN;
    tmacTableId = DELL_TABLE_TMAC;
    ipv4UnicastTableId = DELL_TABLE_IPV4_UNICAST;
    mplsTableId = DELL_TABLE_MPLS;
    aclTableId = DELL_TABLE_ACL;
}
项目:athena    文件:Controller.java   
/**
 * Forward to the driver-manager to get an IOFSwitch instance.
 *
 * @param dpid data path id
 * @param desc switch description
 * @param ofv  OpenFlow version
 * @return switch instance
 */
protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
                                                   OFDescStatsReply desc,
                                                   OFVersion ofv) {
    Dpid dpidObj = new Dpid(dpid);

    Driver driver;
    try {
        driver = driverService.getDriver(DeviceId.deviceId(Dpid.uri(dpidObj)));
    } catch (ItemNotFoundException e) {
        driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc());
    }

    if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) {
        Dpid did = new Dpid(dpid);
        DefaultDriverHandler handler =
                new DefaultDriverHandler(new DefaultDriverData(driver, deviceId(uri(did))));
        OpenFlowSwitchDriver ofSwitchDriver =
                driver.createBehaviour(handler, OpenFlowSwitchDriver.class);
        ofSwitchDriver.init(did, desc, ofv);
        ofSwitchDriver.setAgent(agent);
        ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver));
        log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver);
        return ofSwitchDriver;
    }
    log.error("No OpenFlow driver for {} : {}", dpid, desc);
    return null;

}
项目:athena    文件:ControllerTest.java   
/**
 * Tests fetching a driver that throws an ItemNotFoundException.
 */
@Test
public void switchItemNotFoundTest() {
    controller.start(null, new MockDriverService());
    OFDescStatsReply stats =
            new OFDescStatsReplyAdapter();
    OpenFlowSwitchDriver driver =
            controller.getOFSwitchInstance(MockDriverService.ITEM_NOT_FOUND_DRIVER_ID,
                                           stats,
                                           null);
    assertThat(driver, nullValue());
    controller.stop();
}
项目:athena    文件:ControllerTest.java   
/**
 * Tests fetching a driver that throws an ItemNotFoundException.
 */
@Test
public void driverExistsTest() {
    controller.start(null, new MockDriverService());
    OFDescStatsReply stats =
            new OFDescStatsReplyAdapter();
    OpenFlowSwitchDriver driver =
            controller.getOFSwitchInstance(MockDriverService.DRIVER_EXISTS_ID,
                                           stats,
                                           null);
    assertThat(driver, notNullValue());
    controller.stop();
}
项目:fresco_floodlight    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:fresco_floodlight    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
@LogMessageDoc(message="Switch {switch info} bound to class " +
        "{switch driver}, description {switch description}",
        explanation="The specified switch has been bound to " +
                "a switch driver based on the switch description" +
        "received from the switch")
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());
    switchManager.switchAdded(sw);
    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    sw.startDriverHandshake();
    if (sw.isDriverHandshakeComplete()) {
        setState(new WaitAppHandshakeState());
    } else {
        setState(new WaitSwitchDriverSubHandshakeState());
    }
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:SDN-Multicast    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:arscheduler    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:floodlight1.2-delay    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc");
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc());
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc());
    jGen.writeStringField("softwareDescription", descReply.getSwDesc());
    jGen.writeStringField("serialNumber", descReply.getSerialNum());
    jGen.writeStringField("datapathDescription", descReply.getDpDesc());
    jGen.writeEndObject(); // end match
}
项目:floodlight-hardware    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}
项目: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    文件:StatsReplySerializer.java   
public static void serializeDescReply(List<OFDescStatsReply> descReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFDescStatsReply descReply = descReplies.get(0); // There is only one descReply from the switch
    jGen.writeObjectFieldStart("desc"); 
    jGen.writeStringField("version", descReply.getVersion().toString()); //return the enum name
    jGen.writeStringField("manufacturerDescription", descReply.getMfrDesc()); 
    jGen.writeStringField("hardwareDescription", descReply.getHwDesc()); 
    jGen.writeStringField("softwareDescription", descReply.getSwDesc()); 
    jGen.writeStringField("serialNumber", descReply.getSerialNum()); 
    jGen.writeStringField("datapathDescription", descReply.getDpDesc()); 
    jGen.writeEndObject(); // end match
}
项目:ACAMPController    文件:OFSwitchHandshakeHandler.java   
@Override
void processOFStatsReply(OFStatsReply m) {
    // Read description, if it has been updated
    if (m.getStatsType() != OFStatsType.DESC) {
        illegalMessageReceived(m);
        return;
    }

    OFDescStatsReply descStatsReply = (OFDescStatsReply) m;
    SwitchDescription description = new SwitchDescription(descStatsReply);
    sw = switchManager.getOFSwitchInstance(mainConnection, description, factory, featuresReply.getDatapathId());

    // set switch information
    // set features reply and channel first so we a DPID and
    // channel info.
    sw.setFeaturesReply(featuresReply);
    if (portDescStats != null) {
        sw.setPortDescStats(portDescStats);
    }

    /*
     * Need to add after setting the features.
     */
    switchManager.switchAdded(sw);

    // Handle pending messages now that we have a sw object
    handlePendingPortStatusMessages(description);

    setState(new WaitTableFeaturesReplyState());
}
项目: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);
}
项目:ACAMPController    文件:OFSwitchHandlerTestBase.java   
protected OFDescStatsReply createDescriptionStatsReply() {
    OFDescStatsReply statsReply = factory.buildDescStatsReply()
            .setDpDesc("Datapath Description")
            .setHwDesc("Hardware Description")
            .setMfrDesc("Manufacturer Description")
            .setSwDesc("Software Description")
            .setSerialNum("Serial Number")
            .build();
    return statsReply;
}