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


Java OFControllerRole.ROLE_EQUAL属性代码示例

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


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

示例1: parseRole

private static OFControllerRole parseRole(String role) {
	if (role == null || role.isEmpty()) {
		return OFControllerRole.ROLE_NOCHANGE;
	} 

	role = role.toUpperCase();		

	if (role.contains(STR_ROLE_MASTER)) {
		return OFControllerRole.ROLE_MASTER;
	} else if (role.contains(STR_ROLE_SLAVE)) {
		return OFControllerRole.ROLE_SLAVE;
	} else if (role.contains(STR_ROLE_EQUAL) || role.contains(STR_ROLE_OTHER)) {
		return OFControllerRole.ROLE_EQUAL;
	} else {
		return OFControllerRole.ROLE_NOCHANGE;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:17,代码来源:SwitchRoleResource.java

示例2: sendOF13RoleRequest

private int sendOF13RoleRequest(RoleState role) throws IOException {
    // Convert the role enum to the appropriate role to send
    OFControllerRole roleToSend = OFControllerRole.ROLE_NOCHANGE;
    switch (role) {
    case EQUAL:
        roleToSend = OFControllerRole.ROLE_EQUAL;
        break;
    case MASTER:
        roleToSend = OFControllerRole.ROLE_MASTER;
        break;
    case SLAVE:
        roleToSend = OFControllerRole.ROLE_SLAVE;
        break;
    default:
        log.warn("Sending default role.noChange to switch {}."
                + " Should only be used for queries.", sw);
    }

    int xid = sw.getNextTransactionId();
    OFRoleRequest rrm = OFFactories.getFactory(OFVersion.OF_13)
            .buildRoleRequest()
            .setRole(roleToSend)
            .setXid(xid)
            //FIXME fix below when we actually use generation ids
            .setGenerationId(U64.ZERO)
            .build();

    sw.sendRoleRequest(rrm);
    return xid;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:RoleManager.java

示例3: processOFNiciraControllerRoleRequest

@Override
void processOFNiciraControllerRoleRequest(OFNiciraControllerRoleRequest m) {
	OFControllerRole role;
	switch (m.getRole()) {
	case ROLE_MASTER:
		role = OFControllerRole.ROLE_MASTER;
		break;
	case ROLE_SLAVE:
		role = OFControllerRole.ROLE_SLAVE;
		break;
	case ROLE_OTHER:
		role = OFControllerRole.ROLE_EQUAL;
		break;
	default:
		log.error("Attempted to change to invalid Nicira role {}.", m.getRole().toString());
		return;
	}
	/* 
	 * This will get converted back to the correct factory of the switch later.
	 * We will use OFRoleRequest though to simplify the API between OF versions.
	 */
	sendRoleRequest(OFFactories.getFactory(OFVersion.OF_13).buildRoleRequest()
			.setGenerationId(U64.ZERO)
			.setXid(m.getXid())
			.setRole(role)
			.build());
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:OFSwitchHandshakeHandler.java

示例4: niciraToOFRole

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

示例5: isActive

@Override
public boolean isActive() {
	// no lock needed since we use volatile
	return isConnected() && (this.role == OFControllerRole.ROLE_MASTER || this.role == OFControllerRole.ROLE_EQUAL);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:5,代码来源:OFSwitch.java


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