Search in sources :

Example 26 with PathNode

use of org.openkilda.messaging.info.event.PathNode 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

PathNode (org.openkilda.messaging.info.event.PathNode)26 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)14 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 Isl (org.openkilda.topology.domain.Isl)7 PathInfoData (org.openkilda.messaging.info.event.PathInfoData)6 CommandMessage (org.openkilda.messaging.command.CommandMessage)5 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)4 HashSet (java.util.HashSet)3 InfoMessage (org.openkilda.messaging.info.InfoMessage)3 Then (cucumber.api.java.en.Then)2 Set (java.util.Set)2 Message (org.openkilda.messaging.Message)2 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)2 InfoData (org.openkilda.messaging.info.InfoData)2 ImmutablePair (org.openkilda.messaging.model.ImmutablePair)2 Switch (org.openkilda.topology.domain.Switch)2 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)2 JWTVerificationException (com.auth0.jwt.exceptions.JWTVerificationException)1 DecodedJWT (com.auth0.jwt.interfaces.DecodedJWT)1