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


Java OFRoleReplyVendorData类代码示例

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


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

示例1: extractNiciraRoleReply

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/**
 * Extract the role from an OFVendor message.
 *
 * Extract the role from an OFVendor message if the message is a
 * Nicira role reply. Otherwise return null.
 *
 * @param h The channel handler receiving the message
 * @param vendorMessage The vendor message to parse.
 * @return The role in the message if the message is a Nicira role
 * reply, null otherwise.
 * @throws SwitchStateException If the message is a Nicira role reply
 * but the numeric role value is unknown.
 * FIXME: The message parser should make sure that the Nicira role is
 * actually valid. Why do we need to take care of it ?!?
 */
protected Role extractNiciraRoleReply(OFChannelHandler h,
                                      OFVendor vendorMessage) {
    int vendor = vendorMessage.getVendor();
    if (vendor != OFNiciraVendorData.NX_VENDOR_ID)
        return null;
    if (! (vendorMessage.getVendorData() instanceof OFRoleReplyVendorData))
        return null;
    OFRoleReplyVendorData roleReplyVendorData =
            (OFRoleReplyVendorData) vendorMessage.getVendorData();
    Role role = Role.fromNxRole(roleReplyVendorData.getRole());
    if (role == null) {
        String msg = String.format("Switch: [%s], State: [%s], "
                + "received NX_ROLE_REPLY with invalid role "
                + "value %d",
                h.getSwitchInfoString(),
                this.toString(),
                roleReplyVendorData.getRole());
        throw new SwitchStateException(msg);
    }
    return role;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:37,代码来源:OFChannelHandler.java

示例2: initVendorMessages

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
private void initVendorMessages() {
    // Configure openflowj to be able to parse the role request/reply
    // vendor messages.
    OFBasicVendorId niciraVendorId = new OFBasicVendorId(
            OFNiciraVendorData.NX_VENDOR_ID, 4);
    OFVendorId.registerVendorId(niciraVendorId);
    OFBasicVendorDataType roleRequestVendorData =
            new OFBasicVendorDataType(
                    OFRoleRequestVendorData.NXT_ROLE_REQUEST,
                    OFRoleRequestVendorData.getInstantiable());
    niciraVendorId.registerVendorDataType(roleRequestVendorData);
    OFBasicVendorDataType roleReplyVendorData =
            new OFBasicVendorDataType(
                    OFRoleReplyVendorData.NXT_ROLE_REPLY,
                    OFRoleReplyVendorData.getInstantiable());
     niciraVendorId.registerVendorDataType(roleReplyVendorData);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:18,代码来源:Controller.java

示例3: testNiciraRoleReplySlave2MasterFristTime

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** First role reply message received: transition from slave to master */
@Test 
public void testNiciraRoleReplySlave2MasterFristTime() 
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);
    
    chdlr.sw.deliverRoleReply(xid, Role.MASTER);
    expect(chdlr.sw.isActive()).andReturn(true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    chdlr.sw.clearAllFlowMods();
    chdlr.state.firstRoleReplyReceived = false;
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:23,代码来源:ControllerTest.java

示例4: testNiciraRoleReplySlave2MasterNotFristTime

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** Not first role reply message received: transition from slave to master */
@Test 
public void testNiciraRoleReplySlave2MasterNotFristTime() 
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);
    
    chdlr.sw.deliverRoleReply(xid, Role.MASTER);
    expect(chdlr.sw.isActive()).andReturn(true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    chdlr.state.firstRoleReplyReceived = true;
    // Flow table shouldn't be wipe
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:23,代码来源:ControllerTest.java

示例5: testNiciraRoleReplySlave2Equal

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** transition from slave to equal */
@Test 
public void testNiciraRoleReplySlave2Equal() 
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_OTHER);
    
    chdlr.sw.deliverRoleReply(xid, Role.EQUAL);
    expect(chdlr.sw.isActive()).andReturn(true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    chdlr.sw.clearAllFlowMods();
    chdlr.state.firstRoleReplyReceived = false;
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:23,代码来源:ControllerTest.java

示例6: testNiciraRoleReplySlave2Slave

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test
/** Slave2Slave transition ==> no change */
public void testNiciraRoleReplySlave2Slave() throws Exception{
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
                                   OFRoleReplyVendorData.NX_ROLE_SLAVE);
    
    chdlr.sw.deliverRoleReply(xid, Role.SLAVE);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    expect(chdlr.sw.isActive()).andReturn(false);
    // don't add switch to activeSwitches ==> slave2slave
    chdlr.state.firstRoleReplyReceived = false;
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertTrue("activeSwitches must be empty", 
               controller.activeSwitches.isEmpty());
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:24,代码来源:ControllerTest.java

示例7: testNiciraRoleReplyEqual2Master

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test
/** Equal2Master transition ==> no change */
public void testNiciraRoleReplyEqual2Master() throws Exception{
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);
    
    chdlr.sw.deliverRoleReply(xid, Role.MASTER);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    expect(chdlr.sw.isActive()).andReturn(true);
    controller.activeSwitches.put(1L, chdlr.sw);
    chdlr.state.firstRoleReplyReceived = false;
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:24,代码来源:ControllerTest.java

示例8: testNiciraRoleReplyMaster2Slave

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test 
public void testNiciraRoleReplyMaster2Slave() 
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid, 
                                   OFRoleReplyVendorData.NX_ROLE_SLAVE);
    
    chdlr.sw.deliverRoleReply(xid, Role.SLAVE);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    controller.activeSwitches.put(1L, chdlr.sw);
    expect(chdlr.sw.isActive()).andReturn(false);
    expect(chdlr.sw.isConnected()).andReturn(true);
    chdlr.sw.cancelAllStatisticsReplies();
    chdlr.state.firstRoleReplyReceived = false;
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("state.firstRoleReplyReceived must be true", 
               chdlr.state.firstRoleReplyReceived);
    assertTrue("activeSwitches must be empty", 
               controller.activeSwitches.isEmpty());
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:26,代码来源:ControllerTest.java

示例9: testNiciraRoleReplySlave2MasterFristTime

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** First role reply message received: transition from slave to master */
@Test
public void testNiciraRoleReplySlave2MasterFristTime()
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);

    setupPendingRoleRequest(chdlr.sw, xid, Role.MASTER, 123456);
    expect(chdlr.sw.getHARole()).andReturn(null);
    chdlr.sw.setHARole(Role.MASTER, true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    chdlr.sw.clearAllFlowMods();
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:21,代码来源:ControllerTest.java

示例10: testNiciraRoleReplySlave2MasterNotFristTime

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** Not first role reply message received: transition from slave to master */
@Test
public void testNiciraRoleReplySlave2MasterNotFristTime()
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);

    setupPendingRoleRequest(chdlr.sw, xid, Role.MASTER, 123456);
    expect(chdlr.sw.getHARole()).andReturn(Role.SLAVE);
    chdlr.sw.setHARole(Role.MASTER, true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    // Flow table shouldn't be wipe
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:21,代码来源:ControllerTest.java

示例11: testNiciraRoleReplySlave2Equal

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
/** transition from slave to equal */
@Test
public void testNiciraRoleReplySlave2Equal()
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_OTHER);

    setupPendingRoleRequest(chdlr.sw, xid, Role.EQUAL, 123456);
    expect(chdlr.sw.getHARole()).andReturn(null);
    chdlr.sw.setHARole(Role.EQUAL, true);
    setupSwitchForAddSwitch(chdlr.sw, 1L);
    chdlr.sw.clearAllFlowMods();
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:21,代码来源:ControllerTest.java

示例12: testNiciraRoleReplySlave2Slave

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test
/** Slave2Slave transition ==> no change */
public void testNiciraRoleReplySlave2Slave() throws Exception{
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_SLAVE);

    setupPendingRoleRequest(chdlr.sw, xid, Role.SLAVE, 123456);
    expect(chdlr.sw.getHARole()).andReturn(null);
    chdlr.sw.setHARole(Role.SLAVE, true);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    // don't add switch to activeSwitches ==> slave2slave
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("activeSwitches must be empty",
               controller.activeSwitches.isEmpty());
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:22,代码来源:ControllerTest.java

示例13: testNiciraRoleReplyEqual2Master

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test
/** Equal2Master transition ==> no change */
public void testNiciraRoleReplyEqual2Master() throws Exception{
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_MASTER);

    setupPendingRoleRequest(chdlr.sw, xid, Role.MASTER, 123456);
    expect(chdlr.sw.getHARole()).andReturn(null);
    chdlr.sw.setHARole(Role.MASTER, true);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    controller.activeSwitches.put(1L, chdlr.sw);
    // Must not clear flow mods
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertSame("activeSwitches must contain this switch",
               chdlr.sw, controller.activeSwitches.get(1L));
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:23,代码来源:ControllerTest.java

示例14: testNiciraRoleReplyMaster2Slave

import org.openflow.vendor.nicira.OFRoleReplyVendorData; //导入依赖的package包/类
@Test
public void testNiciraRoleReplyMaster2Slave()
                throws Exception {
    int xid = 424242;
    Controller.OFChannelHandler chdlr = getChannelHandlerForRoleReplyTest();
    OFVendor msg = getRoleReplyMsgForRoleReplyTest(xid,
                                   OFRoleReplyVendorData.NX_ROLE_SLAVE);

    setupPendingRoleRequest(chdlr.sw, xid, Role.SLAVE, 123456);
    expect(chdlr.sw.getHARole()).andReturn(null);
    chdlr.sw.setHARole(Role.SLAVE, true);
    expect(chdlr.sw.getId()).andReturn(1L).anyTimes();
    expect(chdlr.sw.getStringId()).andReturn("00:00:00:00:00:00:00:01")
                .anyTimes();
    controller.activeSwitches.put(1L, chdlr.sw);
    expect(chdlr.sw.getHARole()).andReturn(Role.SLAVE).anyTimes();
    expect(chdlr.sw.isConnected()).andReturn(true);
    chdlr.sw.cancelAllStatisticsReplies();
    replay(chdlr.sw);
    chdlr.processOFMessage(msg);
    verify(chdlr.sw);
    assertTrue("activeSwitches must be empty",
               controller.activeSwitches.isEmpty());
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:25,代码来源:ControllerTest.java


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