Search in sources :

Example 1 with OpticalPathService

use of org.onosproject.newoptical.api.OpticalPathService in project onos by opennetworkinglab.

the class AddOpticalConnectivityCommand method doExecute.

@Override
protected void doExecute() {
    OpticalPathService opticalPathService = get(OpticalPathService.class);
    ConnectPoint ingress = readConnectPoint(ingressStr);
    ConnectPoint egress = readConnectPoint(egressStr);
    if (ingress == null || egress == null) {
        print("Invalid connect points: %s, %s", ingressStr, egressStr);
        return;
    }
    Bandwidth bandwidth = (bandwidthStr == null || bandwidthStr.isEmpty()) ? null : Bandwidth.bps(Long.valueOf(bandwidthStr));
    print("Trying to setup connectivity between %s and %s.", ingress, egress);
    OpticalConnectivityId id = opticalPathService.setupConnectivity(ingress, egress, bandwidth, null);
    if (id == null) {
        print("Failed. See ONOS log for more details.");
        print(" log:set TRACE org.onosproject.newoptical.OpticalPathProvisioner");
        return;
    }
    // FIXME This is the last chance to know the Optical path ID.
    // there's no other way to know existing Optical Path ID
    print("Optical path ID : %s", id.id());
    log.info("Optical path ID {} for connectivity between {} and {}", id.id(), ingress, egress);
}
Also used : OpticalConnectivityId(org.onosproject.newoptical.api.OpticalConnectivityId) OpticalPathService(org.onosproject.newoptical.api.OpticalPathService) Bandwidth(org.onlab.util.Bandwidth) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 2 with OpticalPathService

use of org.onosproject.newoptical.api.OpticalPathService in project onos by opennetworkinglab.

the class RemoveOpticalConnectivityCommand method doExecute.

@Override
protected void doExecute() {
    OpticalPathService opticalPathService = get(OpticalPathService.class);
    OpticalConnectivityId id = OpticalConnectivityId.of(Long.valueOf(idStr));
    print("Trying to remove connectivity with id %s.", idStr);
    if (opticalPathService.removeConnectivity(id)) {
        print(" -- success");
    } else {
        print(" -- failed");
    }
}
Also used : OpticalConnectivityId(org.onosproject.newoptical.api.OpticalConnectivityId) OpticalPathService(org.onosproject.newoptical.api.OpticalPathService)

Example 3 with OpticalPathService

use of org.onosproject.newoptical.api.OpticalPathService in project onos by opennetworkinglab.

the class ListOpticalConnectivityCommand method doExecute.

@Override
protected void doExecute() {
    OpticalPathService opticalPathService = get(OpticalPathService.class);
    Collection<OpticalConnectivity> connectivities = opticalPathService.listConnectivity();
    for (OpticalConnectivity connectivity : connectivities) {
        print("Optical connectivity ID: %s", connectivity.id().id());
        print(" links: %s", connectivity.links().stream().map(LinkKey::linkKey).map(lk -> lk.src() + "-" + lk.dst()).collect(Collectors.joining(", ")));
        print(" Bandwidth: %s, Latency: %s", connectivity.bandwidth(), connectivity.latency());
        print(" Intent Keys: %s", opticalPathService.listIntents(connectivity.id()));
    }
}
Also used : OpticalConnectivity(org.onosproject.newoptical.OpticalConnectivity) OpticalPathService(org.onosproject.newoptical.api.OpticalPathService)

Aggregations

OpticalPathService (org.onosproject.newoptical.api.OpticalPathService)3 OpticalConnectivityId (org.onosproject.newoptical.api.OpticalConnectivityId)2 Bandwidth (org.onlab.util.Bandwidth)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 OpticalConnectivity (org.onosproject.newoptical.OpticalConnectivity)1