本文整理汇总了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;
}
}
示例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;
}
示例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());
}
示例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());
}
}
示例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);
}