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);
}
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;
});
}
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;
});
}
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;
});
}
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);
}
Aggregations