Search in sources :

Example 1 with ProtectedTransportEndpointDescription

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

the class OplinkOpticalProtectionSwitchConfig method getProtectionEndpointConfigs.

@Override
public CompletableFuture<Map<ConnectPoint, ProtectedTransportEndpointDescription>> getProtectionEndpointConfigs() {
    // There are two underlying transport entity endpoints in the device.
    Map<ConnectPoint, ProtectedTransportEndpointDescription> map = new HashMap<>();
    map.put(new ConnectPoint(data().deviceId(), PORT_VIRTUAL), buildProtectedTransportEndpointDescription());
    return CompletableFuture.completedFuture(map);
}
Also used : ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) HashMap(java.util.HashMap) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 2 with ProtectedTransportEndpointDescription

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

the class ProtectionConfigMonitor method updateProtection.

private void updateProtection(DeviceId did, ProtectionConfig before, ProtectionConfig after) {
    ProtectedTransportEndpointDescription description = after.asDescription();
    log.info("updating protection {}-{}", did, description);
    ProtectionConfigBehaviour behaviour = getBehaviour(did);
    Optional<ConnectPoint> existing = findFirstVirtualPort(behaviour, after.fingerprint());
    if (!existing.isPresent()) {
        log.warn("Update requested, but not found, falling back as add");
        addProtection(did, after);
        return;
    }
    ConnectPoint vPort = existing.get();
    log.info("updating protection virtual Port {} : {}", vPort, description);
    behaviour.updateProtectionEndpoint(vPort, description).handle((vPortNew, e) -> {
        if (vPort != null) {
            log.info("Virtual Port {} updated for {}", vPort, description);
            log.debug("{}", deviceService.getPort(vPort));
        } else {
            log.error("Protection {} -> {} exceptionally failed.", before, after, e);
        }
        return vPort;
    });
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 3 with ProtectedTransportEndpointDescription

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

the class ProtectionConfigMonitor method addProtection.

private void addProtection(DeviceId did, ProtectionConfig added) {
    ProtectedTransportEndpointDescription description = added.asDescription();
    log.info("adding protection {}-{}", did, description);
    ProtectionConfigBehaviour behaviour = getBehaviour(did);
    CompletableFuture<ConnectPoint> result;
    result = behaviour.createProtectionEndpoint(description);
    result.handle((vPort, e) -> {
        if (vPort != null) {
            log.info("Virtual Port {} created for {}", vPort, description);
            log.debug("{}", deviceService.getPort(vPort));
        } else {
            log.error("Protection {} exceptionally failed.", added, e);
        }
        return vPort;
    });
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 4 with ProtectedTransportEndpointDescription

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

the class ProtectionConfigMonitor method removeProtection.

private void removeProtection(DeviceId did, ProtectionConfig removed) {
    ProtectedTransportEndpointDescription description = removed.asDescription();
    log.info("removing protection {}-{}", did, description);
    ProtectionConfigBehaviour behaviour = getBehaviour(did);
    Optional<ConnectPoint> existing = findFirstVirtualPort(behaviour, removed.fingerprint());
    if (!existing.isPresent()) {
        log.warn("Remove requested, but not found, ignoring");
        return;
    }
    ConnectPoint vPort = existing.get();
    log.info("removing protection virtual port {} : {}", vPort, description);
    behaviour.deleteProtectionEndpoint(vPort).handle((result, ex) -> {
        if (ex != null) {
            log.info("removed protection {} : {}", vPort, result);
        } else {
            log.warn("removed protection {} failed.", vPort, ex);
        }
        return result;
    });
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 5 with ProtectedTransportEndpointDescription

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

the class OplinkSwitchProtection method getProtectedTransportEndpointDescription.

/*
     * return the protected endpoint description of this devices
     */
private ProtectedTransportEndpointDescription getProtectedTransportEndpointDescription() {
    List<TransportEndpointDescription> teds = new ArrayList<>();
    FilteredConnectPoint fcpPrimary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), PortNumber.portNumber(PRIMARY_PORT)));
    FilteredConnectPoint fcpSecondary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), PortNumber.portNumber(SECONDARY_PORT)));
    TransportEndpointDescription tedPrimary = TransportEndpointDescription.builder().withOutput(fcpPrimary).build();
    TransportEndpointDescription tedSecondary = TransportEndpointDescription.builder().withOutput(fcpSecondary).build();
    teds.add(tedPrimary);
    teds.add(tedSecondary);
    return ProtectedTransportEndpointDescription.of(teds, getPeerId(), OPLINK_FINGERPRINT);
}
Also used : ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) TransportEndpointDescription(org.onosproject.net.behaviour.protection.TransportEndpointDescription) ArrayList(java.util.ArrayList) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Aggregations

ProtectedTransportEndpointDescription (org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription)8 ConnectPoint (org.onosproject.net.ConnectPoint)6 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)4 ProtectionConfigBehaviour (org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour)3 TransportEndpointDescription (org.onosproject.net.behaviour.protection.TransportEndpointDescription)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ProtectionEndpointIntent (org.onosproject.net.intent.ProtectionEndpointIntent)2 CompletableFuture (java.util.concurrent.CompletableFuture)1 DeviceId (org.onosproject.net.DeviceId)1 DeviceService (org.onosproject.net.device.DeviceService)1 IntentService (org.onosproject.net.intent.IntentService)1