Search in sources :

Example 1 with PhasedRecoveryService

use of org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService in project trellis-control by opennetworkinglab.

the class PhasedRecoveryListCommand method doExecute.

@Override
protected void doExecute() {
    PhasedRecoveryService prService = get(PhasedRecoveryService.class);
    print(prService.getPhases().toString());
}
Also used : PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService)

Example 2 with PhasedRecoveryService

use of org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService in project trellis-control by opennetworkinglab.

the class PhasedRecoverySetCommand method doExecute.

@Override
protected void doExecute() {
    DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
    Phase newPhase = Phase.valueOf(phaseStr);
    PhasedRecoveryService prService = get(PhasedRecoveryService.class);
    prService.setPhase(deviceId, newPhase);
}
Also used : PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) Phase(org.onosproject.segmentrouting.phasedrecovery.api.Phase) DeviceId(org.onosproject.net.DeviceId)

Example 3 with PhasedRecoveryService

use of org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService in project trellis-control by opennetworkinglab.

the class PortsCommand method doExecute.

@Override
protected void doExecute() {
    PhasedRecoveryService prService = get(PhasedRecoveryService.class);
    DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
    boolean enabled;
    switch(actionStr.toUpperCase()) {
        case "ENABLE":
            enabled = true;
            break;
        case "DISABLE":
            enabled = false;
            break;
        default:
            print("Action should be either ENABLE or DISABLE");
            return;
    }
    Set<PortNumber> portsChanged;
    switch(portsStr.toUpperCase()) {
        case "ALL":
            portsChanged = prService.changeAllPorts(deviceId, enabled);
            break;
        case "PAIR":
            portsChanged = prService.changePairPort(deviceId, enabled);
            break;
        case "INFRA":
            portsChanged = prService.changeInfraPorts(deviceId, enabled);
            break;
        case "EDGE":
            portsChanged = prService.changeEdgePorts(deviceId, enabled);
            break;
        default:
            print("Ports should be ALL, PAIR, INFRA, EDGE");
            return;
    }
    print("Ports set to %s: %s", enabled ? "enabled" : "disabled", portsChanged.stream().map(PortNumber::toLong).collect(Collectors.toSet()));
}
Also used : PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) DeviceId(org.onosproject.net.DeviceId) PortNumber(org.onosproject.net.PortNumber)

Aggregations

PhasedRecoveryService (org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService)3 DeviceId (org.onosproject.net.DeviceId)2 PortNumber (org.onosproject.net.PortNumber)1 Phase (org.onosproject.segmentrouting.phasedrecovery.api.Phase)1