Search in sources :

Example 1 with IslChangeType

use of org.openkilda.messaging.info.event.IslChangeType in project open-kilda by telstra.

the class OFELinkBolt method handleIslEvent.

private void handleIslEvent(Tuple tuple, IslInfoData discoveredIsl) {
    PathNode node = discoveredIsl.getPath().get(0);
    String switchID = node.getSwitchId();
    String portID = "" + node.getPortNo();
    IslChangeType state = discoveredIsl.getState();
    boolean stateChanged = false;
    /*
         * TODO: would be good to merge more of this behavior / business logic within DiscoveryManager
         *  The reason is so that we consolidate behavior related to Network Topology Discovery into
         *  one place.
         */
    if (IslChangeType.DISCOVERED.equals(state)) {
        stateChanged = discovery.handleDiscovered(switchID, portID);
        // sure we can test the other side as well.
        if (stateChanged && discoveredIsl.getPath().size() > 1) {
            String dstSwitch = discoveredIsl.getPath().get(0).getSwitchId();
            String dstPort = "" + discoveredIsl.getPath().get(0).getPortNo();
            if (!discovery.checkForIsl(dstSwitch, dstPort)) {
                // Only call PortUp if we aren't checking for ISL. Otherwise, we could end up in an
                // infinite cycle of always sending a Port UP when one side is discovered.
                discovery.handlePortUp(dstSwitch, dstPort);
            }
        }
    } else if (IslChangeType.FAILED.equals(state)) {
        stateChanged = discovery.handleFailed(switchID, portID);
    } else {
        // TODO: Should this be a warning? Evaluate whether any other state needs to be handled
        logger.warn("ISL Event: ignoring state: {}", state);
    }
    if (stateChanged) {
        // If the state changed, notify the TE.
        logger.info("DISCO: ISL Event: switch={} port={} state={}", switchID, portID, state);
        passToTopologyEngine(tuple);
    }
}
Also used : IslChangeType(org.openkilda.messaging.info.event.IslChangeType) PathNode(org.openkilda.messaging.info.event.PathNode)

Aggregations

IslChangeType (org.openkilda.messaging.info.event.IslChangeType)1 PathNode (org.openkilda.messaging.info.event.PathNode)1