本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFNiciraControllerRole.ROLE_OTHER属性的典型用法代码示例。如果您正苦于以下问题:Java OFNiciraControllerRole.ROLE_OTHER属性的具体用法?Java OFNiciraControllerRole.ROLE_OTHER怎么用?Java OFNiciraControllerRole.ROLE_OTHER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.projectfloodlight.openflow.protocol.OFNiciraControllerRole
的用法示例。
在下文中一共展示了OFNiciraControllerRole.ROLE_OTHER属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendNxRoleRequest
/**
* Send NX role request message to the switch requesting the specified
* role.
*
* @param role role to request
*/
private int sendNxRoleRequest(RoleState 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_OTHER;
log.debug("Sending Nx Role.SLAVE to switch {}.", sw);
}
int xid = sw.getNextTransactionId();
OFExperimenter roleRequest = OFFactories.getFactory(OFVersion.OF_10)
.buildNiciraControllerRoleRequest()
.setXid(xid)
.setRole(roleToSend)
.build();
sw.sendRoleRequest(roleRequest);
return xid;
}
示例2: sendNxRoleRequest
/**
* Send NX role request message to the switch requesting the specified
* role.
*
* @param role role to request
*/
private int sendNxRoleRequest(RoleState 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_OTHER;
log.warn("Sending Nx Role.SLAVE to switch {}.", sw);
}
int xid = sw.getNextTransactionId();
OFExperimenter roleRequest = OFFactories.getFactory(OFVersion.OF_10)
.buildNiciraControllerRoleRequest()
.setXid(xid)
.setRole(roleToSend)
.build();
sw.write(Collections.<OFMessage>singletonList(roleRequest));
return xid;
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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);
}
}