Search in sources :

Example 1 with ProtectedTransportEndpointState

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

the class OplinkOpticalProtectionSwitchConfig method buildProtectedTransportEndpointState.

private ProtectedTransportEndpointState buildProtectedTransportEndpointState() {
    // First, get active port from device.
    PortNumber activePort = acquireActivePort();
    // Build all endpoint state with port working attribute.
    List<TransportEndpointState> states = new ArrayList<>();
    states.add(buildTransportEndpointState(data().deviceId(), PORT_PRIMARY, activePort));
    states.add(buildTransportEndpointState(data().deviceId(), PORT_SECONDARY, activePort));
    return ProtectedTransportEndpointState.builder().withPathStates(states).withDescription(buildProtectedTransportEndpointDescription()).withActivePathIndex(getActiveIndex(states, activePort)).build();
}
Also used : ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) TransportEndpointState(org.onosproject.net.behaviour.protection.TransportEndpointState) ArrayList(java.util.ArrayList) PortNumber(org.onosproject.net.PortNumber)

Example 2 with ProtectedTransportEndpointState

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

the class RoadmManager method getProtectionSwitchPortState.

@Deprecated
@Override
public String getProtectionSwitchPortState(DeviceId deviceId, PortNumber portNumber) {
    checkNotNull(deviceId);
    ProtectionConfigBehaviour behaviour = getProtectionConfig(deviceId);
    if (behaviour == null) {
        return null;
    }
    Map<ConnectPoint, ProtectedTransportEndpointState> map = getProtectionSwitchStates(behaviour);
    if (map == null) {
        log.warn("Failed to get protected transport endpoint state in device {}", deviceId);
        return null;
    }
    for (ProtectedTransportEndpointState state : map.values()) {
        for (TransportEndpointState element : state.pathStates()) {
            if (element.description().output().connectPoint().port().equals(portNumber)) {
                return element.attributes().get(INPUT_PORT_STATUS);
            }
        }
    }
    // Do not need warning here for port polling.
    log.debug("Unable to get port status, device: {}, port: {}", deviceId, portNumber);
    return null;
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) TransportEndpointState(org.onosproject.net.behaviour.protection.TransportEndpointState) ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 3 with ProtectedTransportEndpointState

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

the class RoadmManager method setProtectionSwitchWorkingPath.

@Deprecated
@Override
public void setProtectionSwitchWorkingPath(DeviceId deviceId, int index) {
    checkNotNull(deviceId);
    ProtectionConfigBehaviour behaviour = getProtectionConfig(deviceId);
    if (behaviour == null) {
        return;
    }
    Map<ConnectPoint, ProtectedTransportEndpointState> map = getProtectionSwitchStates(behaviour);
    if (map == null) {
        log.warn("Failed to get protected transport endpoint state in device {}", deviceId);
        return;
    }
    if (map.isEmpty()) {
        log.warn("No protected transport endpoint state found in device {}", deviceId);
        return;
    }
    behaviour.switchToManual(map.keySet().toArray(new ConnectPoint[0])[0], index);
}
Also used : ProtectionConfigBehaviour(org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour) ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 4 with ProtectedTransportEndpointState

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

the class OplinkSwitchProtection method getProtectedTransportEndpointState.

/*
     * get protected endpoint state
     */
private ProtectedTransportEndpointState getProtectedTransportEndpointState() {
    List<TransportEndpointState> tess = new ArrayList<>();
    PortNumber portPrimary = PortNumber.portNumber(PRIMARY_PORT);
    PortNumber portSecondary = PortNumber.portNumber(SECONDARY_PORT);
    FilteredConnectPoint fcpPrimary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), portPrimary));
    FilteredConnectPoint fcpSecondary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), portSecondary));
    TransportEndpointDescription tedPrimary = TransportEndpointDescription.builder().withOutput(fcpPrimary).build();
    TransportEndpointDescription tedSecondary = TransportEndpointDescription.builder().withOutput(fcpSecondary).build();
    TransportEndpointState tesPrimary = TransportEndpointState.builder().withDescription(tedPrimary).withId(TransportEndpointId.of(PRIMARY_ID)).addAttributes(getProtectionStateAttributes(portPrimary)).build();
    TransportEndpointState tesSecondary = TransportEndpointState.builder().withDescription(tedSecondary).withId(TransportEndpointId.of(SECONDARY_ID)).addAttributes(getProtectionStateAttributes((portSecondary))).build();
    tess.add(tesPrimary);
    tess.add(tesSecondary);
    return ProtectedTransportEndpointState.builder().withDescription(getProtectedTransportEndpointDescription()).withPathStates(tess).withActivePathIndex(getActiveIndex(tess)).build();
}
Also used : ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) TransportEndpointState(org.onosproject.net.behaviour.protection.TransportEndpointState) ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) TransportEndpointDescription(org.onosproject.net.behaviour.protection.TransportEndpointDescription) ArrayList(java.util.ArrayList) PortNumber(org.onosproject.net.PortNumber) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 5 with ProtectedTransportEndpointState

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

the class OplinkOpticalProtectionSwitchConfig method getProtectionEndpointStates.

@Override
public CompletableFuture<Map<ConnectPoint, ProtectedTransportEndpointState>> getProtectionEndpointStates() {
    Map<ConnectPoint, ProtectedTransportEndpointState> map = new HashMap<>();
    map.put(new ConnectPoint(data().deviceId(), PORT_VIRTUAL), buildProtectedTransportEndpointState());
    return CompletableFuture.completedFuture(map);
}
Also used : ProtectedTransportEndpointState(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState) HashMap(java.util.HashMap) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Aggregations

ProtectedTransportEndpointState (org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState)6 ConnectPoint (org.onosproject.net.ConnectPoint)5 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)3 TransportEndpointState (org.onosproject.net.behaviour.protection.TransportEndpointState)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 PortNumber (org.onosproject.net.PortNumber)2 ProtectionConfigBehaviour (org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour)2 CompletableFuture (java.util.concurrent.CompletableFuture)1 ProtectedTransportEndpointDescription (org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription)1 TransportEndpointDescription (org.onosproject.net.behaviour.protection.TransportEndpointDescription)1