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


Java OFNiciraControllerRole.ROLE_SLAVE属性代码示例

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


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

示例1: sendNxRoleRequest

/**
 * Send NX role request message to the switch requesting the specified
 * role.
 *
 * @param sw switch to send the role request message to
 * @param role role to request
 */
private int sendNxRoleRequest(Role role) throws IOException {
    // Convert the role enum to the appropriate role to send
    OFNiciraControllerRole roleToSend = OFNiciraControllerRole.ROLE_OTHER;
    switch (role) {
    case MASTER:
        roleToSend = OFNiciraControllerRole.ROLE_MASTER;
        break;
    case SLAVE:
    case EQUAL:
    default:
        // ensuring that the only two roles sent to 1.0 switches with
        // Nicira role support, are MASTER and SLAVE
        roleToSend = OFNiciraControllerRole.ROLE_SLAVE;
        log.warn("Sending Nx Role.SLAVE to switch {}.", sw);
    }
    int xid = sw.getNextTransactionId();
    OFExperimenter roleRequest = factory10
            .buildNiciraControllerRoleRequest()
            .setXid(xid)
            .setRole(roleToSend)
            .build();
    sw.write(Collections.<OFMessage>singletonList(roleRequest),
            new FloodlightContext());
    return xid;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:32,代码来源:OFChannelHandler.java

示例2: getRoleReply

private OFMessage getRoleReply(long xid, Role role) {

        OFNiciraControllerRole nr = null;

        switch(role) {
        case MASTER:
            nr = OFNiciraControllerRole.ROLE_MASTER;
            break;
        case EQUAL:
            nr = OFNiciraControllerRole.ROLE_SLAVE;
            break;
        case SLAVE:
            nr = OFNiciraControllerRole.ROLE_SLAVE;
            break;
        default: //handled below
        }
        OFMessage m = factory10.buildNiciraControllerRoleReply()
                .setRole(nr)
                .setXid(xid)
                .build();
        return m;
    }
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:22,代码来源:OFChannelHandlerTest.java

示例3: ofRoleToNiciraRole

public static OFNiciraControllerRole ofRoleToNiciraRole(OFControllerRole role) {
    switch(role) {
        case ROLE_EQUAL:
            return OFNiciraControllerRole.ROLE_OTHER;
        case ROLE_MASTER:
            return OFNiciraControllerRole.ROLE_MASTER;
        case ROLE_SLAVE:
            return OFNiciraControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("Unknown role: " + role);
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:12,代码来源:NiciraRoleUtils.java

示例4: ofWireValue

public static OFNiciraControllerRole ofWireValue(int val) {
    switch(val) {
        case ROLE_OTHER_VAL:
            return OFNiciraControllerRole.ROLE_OTHER;
        case ROLE_MASTER_VAL:
            return OFNiciraControllerRole.ROLE_MASTER;
        case ROLE_SLAVE_VAL:
            return OFNiciraControllerRole.ROLE_SLAVE;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFNiciraControllerRole in version 1.0: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:12,代码来源:OFNiciraControllerRoleSerializerVer10.java


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