Search in sources :

Example 51 with IslInfoData

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

the class TopologyEventsBasicTest method isSwitchHasLessThanTwoLinks.

private boolean isSwitchHasLessThanTwoLinks(String switchId, List<IslInfoData> links) {
    int inputsAmount = 0;
    int outputsAmount = 0;
    for (IslInfoData isl : links) {
        for (PathNode node : isl.getPath()) {
            if (switchId.equalsIgnoreCase(node.getSwitchId())) {
                if (node.getSeqId() == 0) {
                    outputsAmount++;
                } else if (node.getSeqId() == 1) {
                    inputsAmount++;
                }
            }
        }
    }
    // check whether switch has more than one link in both direction (sequence id 0 and 1)
    return inputsAmount <= NumberUtils.INTEGER_ONE && outputsAmount <= NumberUtils.INTEGER_ONE;
}
Also used : IslInfoData(org.openkilda.messaging.info.event.IslInfoData) PathNode(org.openkilda.messaging.info.event.PathNode)

Aggregations

IslInfoData (org.openkilda.messaging.info.event.IslInfoData)51 PathNode (org.openkilda.messaging.info.event.PathNode)29 Test (org.junit.Test)25 Endpoint (org.openkilda.wfm.share.model.Endpoint)12 SwitchId (org.openkilda.model.SwitchId)10 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)9 Isl (org.openkilda.model.Isl)9 InfoMessage (org.openkilda.messaging.info.InfoMessage)8 ArrayList (java.util.ArrayList)6 When (cucumber.api.java.en.When)5 IOException (java.io.IOException)5 InfoData (org.openkilda.messaging.info.InfoData)5 Switch (org.openkilda.model.Switch)5 Then (cucumber.api.java.en.Then)4 List (java.util.List)4 CommandMessage (org.openkilda.messaging.command.CommandMessage)4 Comparator (java.util.Comparator)3 Collectors (java.util.stream.Collectors)3 Message (org.openkilda.messaging.Message)3 CacheException (org.openkilda.messaging.error.CacheException)3