Search in sources :

Example 46 with DeviceId

use of org.onosproject.net.DeviceId 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 47 with DeviceId

use of org.onosproject.net.DeviceId 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)

Example 48 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class ShouldProgramCommand method doExecute.

@Override
protected void doExecute() {
    SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
    Map<DeviceId, NodeId> shouldProgram = srService.getShouldProgramLeaders();
    print("shouldProgram");
    shouldProgram.forEach((k, v) -> print("%s -> %s", k, v));
}
Also used : SegmentRoutingService(org.onosproject.segmentrouting.SegmentRoutingService) DeviceId(org.onosproject.net.DeviceId) NodeId(org.onosproject.cluster.NodeId)

Example 49 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class XconnectAddCommand method doExecute.

@Override
protected void doExecute() {
    DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
    VlanId vlanId = VlanId.vlanId(vlanIdStr);
    XconnectEndpoint ep1 = XconnectEndpoint.fromString(ep1Str);
    XconnectEndpoint ep2 = XconnectEndpoint.fromString(ep2Str);
    Set<XconnectEndpoint> endpoints = Sets.newHashSet(ep1, ep2);
    XconnectService xconnectService = get(XconnectService.class);
    xconnectService.addOrUpdateXconnect(deviceId, vlanId, endpoints);
}
Also used : XconnectService(org.onosproject.segmentrouting.xconnect.api.XconnectService) DeviceId(org.onosproject.net.DeviceId) XconnectEndpoint(org.onosproject.segmentrouting.xconnect.api.XconnectEndpoint) VlanId(org.onlab.packet.VlanId)

Example 50 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class XconnectRemoveCommand method doExecute.

@Override
protected void doExecute() {
    DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
    VlanId vlanId = VlanId.vlanId(vlanIdStr);
    XconnectService xconnectService = get(XconnectService.class);
    xconnectService.removeXonnect(deviceId, vlanId);
}
Also used : XconnectService(org.onosproject.segmentrouting.xconnect.api.XconnectService) DeviceId(org.onosproject.net.DeviceId) VlanId(org.onlab.packet.VlanId)

Aggregations

DeviceId (org.onosproject.net.DeviceId)782 List (java.util.List)178 PortNumber (org.onosproject.net.PortNumber)170 Collectors (java.util.stream.Collectors)152 ConnectPoint (org.onosproject.net.ConnectPoint)152 Set (java.util.Set)138 DeviceService (org.onosproject.net.device.DeviceService)122 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)118 ArrayList (java.util.ArrayList)115 VlanId (org.onlab.packet.VlanId)115 Logger (org.slf4j.Logger)114 Collections (java.util.Collections)109 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)109 Device (org.onosproject.net.Device)107 Collection (java.util.Collection)106 Test (org.junit.Test)104 CoreService (org.onosproject.core.CoreService)103 FlowRule (org.onosproject.net.flow.FlowRule)101 ImmutableSet (com.google.common.collect.ImmutableSet)99 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)96