use of org.onosproject.openflow.controller.OpenFlowSwitch in project onos by opennetworkinglab.
the class OpenFlowControllerImpl method setRole.
@Override
public void setRole(Dpid dpid, RoleState role) {
final OpenFlowSwitch sw = getSwitch(dpid);
if (sw == null) {
log.debug("Switch not connected. Ignoring setRole({}, {})", dpid, role);
return;
}
sw.setRole(role);
}
use of org.onosproject.openflow.controller.OpenFlowSwitch in project onos by opennetworkinglab.
the class OpenFlowLambdaQuery method getPortDescs.
private List<OFPortDesc> getPortDescs() {
final Dpid dpid = dpid(handler().data().deviceId().uri());
OpenFlowSwitch sw = handler().get(OpenFlowController.class).getSwitch(dpid);
return sw.getPorts();
}
use of org.onosproject.openflow.controller.OpenFlowSwitch in project onos by opennetworkinglab.
the class OplinkPowerConfigUtil method getChannelAttenuationRange.
/**
* Returns the acceptable attenuation range for a connection (represented as
* a flow with attenuation instruction). Port can be either the input or
* output port of the connection. Returns null if the connection does not
* support attenuation.
*
* @param portNum the port number
* @return attenuation range
*/
private Range<Long> getChannelAttenuationRange(PortNumber portNum) {
OpenFlowSwitch ofs = getOpenFlowDevice();
if (ofs == null) {
return null;
}
if (ofs.deviceType() != Type.ROADM) {
return null;
}
PortDescType portType = getPortDescType((OpenFlowOpticalSwitch) ofs, portNum);
// The port type and attenuation range will be obtained from physical device in the future.
if (portType == PortDescType.PA_LINE_OUT || portType == PortDescType.EXP_IN || portType == PortDescType.AUX_IN) {
return Range.closed(ROADM_MIN_ATTENUATION, ROADM_MAX_ATTENUATION);
}
// Unexpected port. Do not need warning here for port polling.
return null;
}
use of org.onosproject.openflow.controller.OpenFlowSwitch in project onos by opennetworkinglab.
the class OplinkPowerConfigUtil method setPortPower.
/**
* Sets specified port power value.
*
* @param portNum the port number
* @param power power value
*/
private void setPortPower(PortNumber portNum, long power) {
OpenFlowSwitch device = getOpenFlowDevice();
// Check if switch is connected
if (device == null) {
return;
}
device.sendMsg(device.factory().buildOplinkPortPowerSet().setXid(xidCounter.getAndIncrement()).setPort((int) portNum.toLong()).setPowerValue((int) power).build());
}
Aggregations