Search in sources :

Example 26 with OpenFlowSwitch

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);
}
Also used : OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch)

Example 27 with OpenFlowSwitch

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();
}
Also used : Dpid(org.onosproject.openflow.controller.Dpid) OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch) OpenFlowController(org.onosproject.openflow.controller.OpenFlowController)

Example 28 with OpenFlowSwitch

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;
}
Also used : OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch)

Example 29 with OpenFlowSwitch

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());
}
Also used : OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch)

Aggregations

OpenFlowSwitch (org.onosproject.openflow.controller.OpenFlowSwitch)29 Dpid (org.onosproject.openflow.controller.Dpid)17 OpenFlowController (org.onosproject.openflow.controller.OpenFlowController)5 DeviceId (org.onosproject.net.DeviceId)4 OFPortDesc (org.projectfloodlight.openflow.protocol.OFPortDesc)4 Test (org.junit.Test)3 OpenFlowSwitchListener (org.onosproject.openflow.controller.OpenFlowSwitchListener)3 ArrayList (java.util.ArrayList)2 Type (org.onosproject.net.Device.Type)2 ExtensionTreatmentType (org.onosproject.net.flow.instructions.ExtensionTreatmentType)2 PortDescPropertyType (org.onosproject.openflow.controller.PortDescPropertyType)2 OFFlowLightweightStatsReply (org.projectfloodlight.openflow.protocol.OFFlowLightweightStatsReply)2 OFFlowStatsReply (org.projectfloodlight.openflow.protocol.OFFlowStatsReply)2 OFTableStatsEntry (org.projectfloodlight.openflow.protocol.OFTableStatsEntry)2 OFTableStatsReply (org.projectfloodlight.openflow.protocol.OFTableStatsReply)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)1 Cache (com.google.common.cache.Cache)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 RemovalCause (com.google.common.cache.RemovalCause)1