• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HandshakeState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.floodlightcontroller.core.internal.OFChannelState.HandshakeState的典型用法代码示例。如果您正苦于以下问题:Java HandshakeState类的具体用法?Java HandshakeState怎么用?Java HandshakeState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HandshakeState类属于net.floodlightcontroller.core.internal.OFChannelState包,在下文中一共展示了HandshakeState类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: channelDisconnected

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Override
@LogMessageDoc(message="Disconnected switch {switch information}",
               explanation="The specified switch has disconnected.")
public void channelDisconnected(ChannelHandlerContext ctx,
                                ChannelStateEvent e) throws Exception {
    if (sw != null && state.hsState == HandshakeState.READY) {
        if (activeSwitches.containsKey(sw.getId())) {
            // It's safe to call removeSwitch even though the map might
            // not contain this particular switch but another with the 
            // same DPID
            removeSwitch(sw);
        }
        synchronized(roleChanger) {
            connectedSwitches.remove(sw);
        }
        sw.setConnected(false);
    }
    log.info("Disconnected switch {}", sw);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:20,代码来源:Controller.java


示例2: channelDisconnected

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Override
@LogMessageDoc(message="Disconnected switch {switch information}",
               explanation="The specified switch has disconnected.")
public void channelDisconnected(ChannelHandlerContext ctx,
                                ChannelStateEvent e) throws Exception {
    if (sw != null && state.hsState == HandshakeState.READY) {
        if (activeSwitches.containsKey(sw.getId())) {
            // It's safe to call removeSwitch even though the map might
            // not contain this particular switch but another with the
            // same DPID
            removeSwitch(sw);
        }
        synchronized(roleChanger) {
            connectedSwitches.remove(sw);
            roleChanger.removePendingRequests(sw);
        }
        sw.setConnected(false);
    }
    log.info("Disconnected switch {}", sw);
}
 
开发者ID:dana-i2cat,项目名称:floodlight-nfv,代码行数:21,代码来源:Controller.java


示例3: run

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Override
public void run(Timeout timeout) throws Exception {
    if (timeout.isCancelled()) {
        return;
    }

    if (!ctx.getChannel().isOpen()) {
        return;
    }
    if (!state.hsState.equals(HandshakeState.READY))
        Channels.fireExceptionCaught(ctx, EXCEPTION);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:13,代码来源:HandshakeTimeoutHandler.java


示例4: testVendorMessageUnknown

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Test 
public void testVendorMessageUnknown() throws Exception {
    // Check behavior with an unknown vendor id
    OFChannelState state = new OFChannelState();
    state.hsState = HandshakeState.READY;
    Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
    OFVendor msg = new OFVendor();
    msg.setVendor(0);
    chdlr.processOFMessage(msg);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:11,代码来源:ControllerTest.java


示例5: getChannelHandlerForRoleReplyTest

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
protected Controller.OFChannelHandler getChannelHandlerForRoleReplyTest() {
    OFChannelState state = new OFChannelState();
    state.hsState = HandshakeState.READY;
    Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
    chdlr.sw = createMock(OFSwitchImpl.class);
    return chdlr;
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:8,代码来源:ControllerTest.java


示例6: testBindSwitchOrder

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Test
 public void testBindSwitchOrder() {
     List<String> order = new ArrayList<String>(3);
     controller.addOFSwitchDriver("", this);
     controller.addOFSwitchDriver("test switch", this);
     controller.addOFSwitchDriver("test", this);
     order.add("test switch");
     order.add("test");
     order.add("");
     test_bind_order = true;

     OFChannelState state = new OFChannelState();
     Controller.OFChannelHandler chdlr =
             controller.new OFChannelHandler(state);
     chdlr.sw = null;

     // Swith should be bound of OFSwitchImpl (default)
     state.hsState = OFChannelState.HandshakeState.HELLO;
     state.hasDescription = true;
     state.hasGetConfigReply = true;
     state.switchBindingDone = false;
     OFDescriptionStatistics desc = new OFDescriptionStatistics();
     desc.setManufacturerDescription("test switch");
     desc.setHardwareDescription("version 0.9");
     state.description = desc;
     OFFeaturesReply featuresReply = new OFFeaturesReply();
     featuresReply.setPorts(new ArrayList<OFPhysicalPort>());
     state.featuresReply = featuresReply;

     chdlr.bindSwitchToDriver();
     assertTrue(chdlr.sw instanceof OFSwitchImpl);
     assertTrue(!(chdlr.sw instanceof TestSwitchClass));
     // Verify bind_order is called as expected
     assertTrue(order.equals(bind_order));
     test_bind_order = false;
     bind_order = null;
}
 
开发者ID:dana-i2cat,项目名称:floodlight-nfv,代码行数:38,代码来源:ControllerTest.java


示例7: testVendorMessageUnknown

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Test
public void testVendorMessageUnknown() throws Exception {
    // Check behavior with an unknown vendor id
    // Ensure that vendor message listeners get called, even for Vendors
    // unknown to floodlight. It is the responsibility of the listener to
    // discard unknown vendors.
    OFChannelState state = new OFChannelState();
    state.hsState = HandshakeState.READY;
    Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
    OFVendor msg = new OFVendor();
    msg.setVendor(0);
    IOFSwitch sw = createMock(IOFSwitch.class);
    chdlr.sw = sw;
    controller.activeSwitches.put(1L, sw);

    // prepare the Vendor Message Listener expectations
    ListenerDispatcher<OFType, IOFMessageListener> ld =
            new ListenerDispatcher<OFType, IOFMessageListener>();
    IOFMessageListener ml = createMock(IOFMessageListener.class);
    expect(ml.getName()).andReturn("Dummy").anyTimes();
    expect(ml.isCallbackOrderingPrereq((OFType)anyObject(),
            (String)anyObject())).andReturn(false).anyTimes();
    expect(ml.isCallbackOrderingPostreq((OFType)anyObject(),
            (String)anyObject())).andReturn(false).anyTimes();
    expect(ml.receive(eq(sw), eq(msg), isA(FloodlightContext.class))).
            andReturn(Command.CONTINUE).once();
    controller.messageListeners.put(OFType.VENDOR, ld);

    // prepare the switch and lock expectations
    Lock lock = createNiceMock(Lock.class);
    expect(sw.getListenerReadLock()).andReturn(lock).anyTimes();
    expect(sw.isConnected()).andReturn(true).anyTimes();
    expect(sw.getHARole()).andReturn(Role.MASTER).anyTimes();
    expect(sw.getId()).andReturn(1L).anyTimes();

    // test
    replay(chdlr.sw, lock, ml);
    ld.addListener(OFType.VENDOR, ml);
    chdlr.processOFMessage(msg);
}
 
开发者ID:dana-i2cat,项目名称:floodlight-nfv,代码行数:41,代码来源:ControllerTest.java


示例8: getChannelHandlerForRoleReplyTest

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
protected Controller.OFChannelHandler getChannelHandlerForRoleReplyTest() {
    OFChannelState state = new OFChannelState();
    state.hsState = HandshakeState.READY;
    Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
    chdlr.sw = createMock(IOFSwitch.class);
    return chdlr;
}
 
开发者ID:dana-i2cat,项目名称:floodlight-nfv,代码行数:8,代码来源:ControllerTest.java


示例9: testBindSwitchOrder

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Test
 public void testBindSwitchOrder() {
     List<String> order = new ArrayList<String>(3);
     controller.addOFSwitchDriver("", this);
     controller.addOFSwitchDriver("test switch", this);
     controller.addOFSwitchDriver("test", this);
     order.add("test switch");
     order.add("test");
     order.add("");
     test_bind_order = true;
     
     OFChannelState state = new OFChannelState();
     Controller.OFChannelHandler chdlr =
             controller.new OFChannelHandler(state);
     chdlr.sw = null;
     
     // Swith should be bound of OFSwitchImpl (default)
     state.hsState = OFChannelState.HandshakeState.HELLO;
     state.hasDescription = true;
     state.hasGetConfigReply = true;
     state.switchBindingDone = false;
     OFDescriptionStatistics desc = new OFDescriptionStatistics();
     desc.setManufacturerDescription("test switch");
     desc.setHardwareDescription("version 0.9");
     state.description = desc;
     OFFeaturesReply featuresReply = new OFFeaturesReply();
     featuresReply.setPorts(new ArrayList<OFPhysicalPort>());
     state.featuresReply = featuresReply;

     chdlr.bindSwitchToDriver();
     assertTrue(chdlr.sw instanceof OFSwitchImpl);
     assertTrue(!(chdlr.sw instanceof TestSwitchClass));
     // Verify bind_order is called as expected
     assertTrue(order.equals(bind_order));
     test_bind_order = false;
     bind_order = null;
}
 
开发者ID:wallnerryan,项目名称:FL_HAND,代码行数:38,代码来源:ControllerTest.java


示例10: testVendorMessageUnknown

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
@Test 
public void testVendorMessageUnknown() throws Exception {
    // Check behavior with an unknown vendor id
    // Ensure that vendor message listeners get called, even for Vendors 
    // unknown to floodlight. It is the responsibility of the listener to
    // discard unknown vendors.
    OFChannelState state = new OFChannelState();
    state.hsState = HandshakeState.READY;
    Controller.OFChannelHandler chdlr = controller.new OFChannelHandler(state);
    OFVendor msg = new OFVendor();
    msg.setVendor(0);
    IOFSwitch sw = createMock(IOFSwitch.class);
    chdlr.sw = sw;
    controller.activeSwitches.put(1L, sw);
    
    // prepare the Vendor Message Listener expectations
    ListenerDispatcher<OFType, IOFMessageListener> ld = 
            new ListenerDispatcher<OFType, IOFMessageListener>();
    IOFMessageListener ml = createMock(IOFMessageListener.class);
    expect(ml.getName()).andReturn("Dummy").anyTimes();
    expect(ml.isCallbackOrderingPrereq((OFType)anyObject(), 
            (String)anyObject())).andReturn(false).anyTimes();
    expect(ml.isCallbackOrderingPostreq((OFType)anyObject(), 
            (String)anyObject())).andReturn(false).anyTimes();
    expect(ml.receive(eq(sw), eq(msg), isA(FloodlightContext.class))).
            andReturn(Command.CONTINUE).once();
    controller.messageListeners.put(OFType.VENDOR, ld);

    // prepare the switch and lock expectations
    Lock lock = createNiceMock(Lock.class);
    expect(sw.getListenerReadLock()).andReturn(lock).anyTimes();
    expect(sw.isConnected()).andReturn(true).anyTimes();
    expect(sw.getHARole()).andReturn(Role.MASTER).anyTimes();
    expect(sw.getId()).andReturn(1L).anyTimes();
    
    // test
    replay(chdlr.sw, lock, ml);
    ld.addListener(OFType.VENDOR, ml);
    chdlr.processOFMessage(msg);
}
 
开发者ID:wallnerryan,项目名称:FL_HAND,代码行数:41,代码来源:ControllerTest.java


示例11: checkSwitchReady

import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; //导入依赖的package包/类
protected void checkSwitchReady() {
    if (state.hsState == HandshakeState.FEATURES_REPLY &&
            state.hasDescription && state.hasGetConfigReply) {
        
        state.hsState = HandshakeState.READY;
        
        synchronized(roleChanger) {
            // We need to keep track of all of the switches that are connected
            // to the controller, in any role, so that we can later send the 
            // role request messages when the controller role changes.
            // We need to be synchronized while doing this: we must not 
            // send a another role request to the connectedSwitches until
            // we were able to add this new switch to connectedSwitches 
            // *and* send the current role to the new switch.
            connectedSwitches.add(sw);
            
            if (role != null) {
                // Send a role request if role support is enabled for the controller
                // This is a probe that we'll use to determine if the switch
                // actually supports the role request message. If it does we'll
                // get back a role reply message. If it doesn't we'll get back an
                // OFError message. 
                // If role is MASTER we will promote switch to active
                // list when we receive the switch's role reply messages
                log.debug("This controller's role is {}, " + 
                        "sending initial role request msg to {}",
                        role, sw);
                Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
                swList.add(sw);
                roleChanger.submitRequest(swList, role);
            } 
            else {
                // Role supported not enabled on controller (for now)
                // automatically promote switch to active state. 
                log.debug("This controller's role is null, " + 
                        "not sending role request msg to {}",
                        role, sw);
                // Need to clear FlowMods before we add the switch
                // and dispatch updates otherwise we have a race condition.
                sw.clearAllFlowMods();
                addSwitch(sw);
                state.firstRoleReplyReceived = true;
            }
        }
    }
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:47,代码来源:Controller.java



注:本文中的net.floodlightcontroller.core.internal.OFChannelState.HandshakeState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Either类代码示例发布时间:2022-05-22
下一篇:
Java DefaultMirrorSelector类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap