Search in sources :

Example 1 with OpenFlowController

use of org.onosproject.openflow.controller.OpenFlowController in project onos by opennetworkinglab.

the class OplinkPowerConfigUtil method getOpenFlowDevice.

/**
 * Returns current switch known to this OF controller.
 *
 * @return current switch
 */
private OpenFlowSwitch getOpenFlowDevice() {
    final DriverHandler handler = behaviour.handler();
    final OpenFlowController controller = handler.get(OpenFlowController.class);
    final Dpid dpid = Dpid.dpid(handler.data().deviceId().uri());
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    if (sw == null || !sw.isConnected()) {
        log.warn("OpenFlow handshaker driver not found or device is not connected, dpid = {}", dpid);
        return null;
    }
    return sw;
}
Also used : Dpid(org.onosproject.openflow.controller.Dpid) OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch) DriverHandler(org.onosproject.net.driver.DriverHandler) OpenFlowController(org.onosproject.openflow.controller.OpenFlowController)

Aggregations

DriverHandler (org.onosproject.net.driver.DriverHandler)1 Dpid (org.onosproject.openflow.controller.Dpid)1 OpenFlowController (org.onosproject.openflow.controller.OpenFlowController)1 OpenFlowSwitch (org.onosproject.openflow.controller.OpenFlowSwitch)1