当前位置: 首页>>代码示例>>Java>>正文


Java OFPortStatus.setReason方法代码示例

本文整理汇总了Java中org.openflow.protocol.OFPortStatus.setReason方法的典型用法代码示例。如果您正苦于以下问题:Java OFPortStatus.setReason方法的具体用法?Java OFPortStatus.setReason怎么用?Java OFPortStatus.setReason使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openflow.protocol.OFPortStatus的用法示例。


在下文中一共展示了OFPortStatus.setReason方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHandlePortStatus

import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test 
public void testHandlePortStatus() throws Exception {
    IOFSwitch sw = createMock(IOFSwitch.class);
    OFPhysicalPort port = new OFPhysicalPort();
    port.setName("myPortName1");
    port.setPortNumber((short)42);
    
    OFPortStatus ofps = new OFPortStatus();
    ofps.setDesc(port);
    
    ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
    sw.deletePort(port.getPortNumber());
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:38,代码来源:ControllerTest.java

示例2: testHandlePortStatus

import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test
public void testHandlePortStatus() throws Exception {
    IOFSwitch sw = createMock(IOFSwitch.class);
    OFPhysicalPort port = new OFPhysicalPort();
    port.setName("myPortName1");
    port.setPortNumber((short)42);

    OFPortStatus ofps = new OFPortStatus();
    ofps.setDesc(port);

    ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);

    ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);

    ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
    sw.deletePort(port.getPortNumber());
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:38,代码来源:ControllerTest.java

示例3: testHandlePortStatus

import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
@Test 
public void testHandlePortStatus() throws Exception {
    IOFSwitch sw = createMock(IOFSwitch.class);
    OFPhysicalPort port = new OFPhysicalPort();
    port.setName("myPortName1");
    port.setPortNumber((short)42);
    
    OFPortStatus ofps = new OFPortStatus();
    ofps.setDesc(port);
    
    ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
    sw.deletePort(port.getPortNumber());
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
}
 
开发者ID:wallnerryan,项目名称:FL_HAND,代码行数:38,代码来源:ControllerTest.java

示例4: testPortStatusMessageMaster

import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
/**
 * Test port status message handling while MASTER
 *
 */
@Test
public void testPortStatusMessageMaster() throws Exception {
    long dpid = featuresReply.getDatapathId();
    testInitialMoveToMasterWithRole();

    OFPhysicalPort p = new OFPhysicalPort();
    p.setName("Port1");
    p.setPortNumber((short)1);
    OFPortStatus ps = (OFPortStatus)
            BasicFactory.getInstance().getMessage(OFType.PORT_STATUS);
    ps.setDesc(p);

    // The events we expect sw.handlePortStatus to return
    // We'll just use the same list for all valid OFPortReasons and add
    // arbitrary events for arbitrary ports that are not necessarily
    // related to the port status message. Our goal
    // here is not to return the correct set of events but the make sure
    // that a) sw.handlePortStatus is called
    //      b) the list of events sw.handlePortStatus returns is sent
    //         as IOFSwitchListener notifications.
    OrderedCollection<PortChangeEvent> events =
            new LinkedHashSetWrapper<PortChangeEvent>();
    ImmutablePort p1 = ImmutablePort.create("eth1", (short)1);
    ImmutablePort p2 = ImmutablePort.create("eth2", (short)2);
    ImmutablePort p3 = ImmutablePort.create("eth3", (short)3);
    ImmutablePort p4 = ImmutablePort.create("eth4", (short)4);
    ImmutablePort p5 = ImmutablePort.create("eth5", (short)5);
    events.add(new PortChangeEvent(p1, PortChangeType.ADD));
    events.add(new PortChangeEvent(p2, PortChangeType.DELETE));
    events.add(new PortChangeEvent(p3, PortChangeType.UP));
    events.add(new PortChangeEvent(p4, PortChangeType.DOWN));
    events.add(new PortChangeEvent(p5, PortChangeType.OTHER_UPDATE));


    for (OFPortReason reason: OFPortReason.values()) {
        ps.setReason(reason.getReasonCode());

        reset(sw);
        expect(sw.inputThrottled(anyObject(OFMessage.class)))
                .andReturn(false).anyTimes();
        expect(sw.getId()).andReturn(dpid).anyTimes();

        expect(sw.processOFPortStatus(ps)).andReturn(events).once();
        replay(sw);

        reset(controller);
        controller.notifyPortChanged(sw, p1, PortChangeType.ADD);
        controller.notifyPortChanged(sw, p2, PortChangeType.DELETE);
        controller.notifyPortChanged(sw, p3, PortChangeType.UP);
        controller.notifyPortChanged(sw, p4, PortChangeType.DOWN);
        controller.notifyPortChanged(sw, p5, PortChangeType.OTHER_UPDATE);
        sendMessageToHandlerNoControllerReset(
               Collections.<OFMessage>singletonList(ps));
        verify(sw);
        verify(controller);
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:62,代码来源:OFChannelHandlerTest.java

示例5: sendStatusMsg

import org.openflow.protocol.OFPortStatus; //导入方法依赖的package包/类
public void sendStatusMsg(OFPortReason reason) {
    OFPortStatus status = new OFPortStatus();
    status.setDesc(this);
    status.setReason(reason.getReasonCode());
    this.parentSwitch.sendMsg(status, this.parentSwitch);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:7,代码来源:OVXPort.java


注:本文中的org.openflow.protocol.OFPortStatus.setReason方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。