Search in sources :

Example 6 with ProtectionConfigBehaviour

use of org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour in project onos by opennetworkinglab.

the class RoadmManager method getProtectionConfig.

private ProtectionConfigBehaviour getProtectionConfig(DeviceId deviceId) {
    Device device = deviceService.getDevice(deviceId);
    if (device != null && device.is(ProtectionConfigBehaviour.class)) {
        return device.as(ProtectionConfigBehaviour.class);
    }
    // Do not need warning here for port polling.
    log.debug("Unable to load ProtectionConfigBehaviour for {}", deviceId);
    return null;
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) Device(org.onosproject.net.Device)

Example 7 with ProtectionConfigBehaviour

use of org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour in project onos by opennetworkinglab.

the class RoadmManager method setProtectionSwitchWorkingPath.

@Deprecated
@Override
public void setProtectionSwitchWorkingPath(DeviceId deviceId, int index) {
    checkNotNull(deviceId);
    ProtectionConfigBehaviour behaviour = getProtectionConfig(deviceId);
    if (behaviour == null) {
        return;
    }
    Map<ConnectPoint, ProtectedTransportEndpointState> map = getProtectionSwitchStates(behaviour);
    if (map == null) {
        log.warn("Failed to get protected transport endpoint state in device {}", deviceId);
        return;
    }
    if (map.isEmpty()) {
        log.warn("No protected transport endpoint state found in device {}", deviceId);
        return;
    }
    behaviour.switchToManual(map.keySet().toArray(new ConnectPoint[0])[0], index);
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 8 with ProtectionConfigBehaviour

use of org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour in project onos by opennetworkinglab.

the class RoadmManager method configProtectionSwitch.

@Override
public void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index) {
    checkNotNull(deviceId);
    ProtectionConfigBehaviour behaviour = getProtectionConfig(deviceId);
    if (behaviour == null) {
        return;
    }
    // automatic operation
    if (OPS_OPT_AUTO.equals(operation)) {
        behaviour.switchToAutomatic(identifier);
        return;
    }
    // force or manual operation
    if (OPS_OPT_MANUAL.equals(operation)) {
        behaviour.switchToManual(identifier, index);
    } else if (OPS_OPT_FORCE.equals(operation)) {
        behaviour.switchToForce(identifier, index);
    }
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour)

Aggregations

ProtectionConfigBehaviour (org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour)8 ConnectPoint (org.onosproject.net.ConnectPoint)5 ProtectedTransportEndpointDescription (org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription)3 ProtectedTransportEndpointState (org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState)2 Device (org.onosproject.net.Device)1 TransportEndpointState (org.onosproject.net.behaviour.protection.TransportEndpointState)1