Search in sources :

Example 1 with DiscoveryNode

use of org.openkilda.messaging.model.DiscoveryNode in project open-kilda by telstra.

the class DiscoveryManager method filterQueue.

private List<DiscoveryNode> filterQueue(Node subject, boolean extract) {
    List<DiscoveryNode> result = new LinkedList<>();
    for (ListIterator<DiscoveryNode> it = pollQueue.listIterator(); it.hasNext(); ) {
        DiscoveryNode node = it.next();
        if (!subject.matchDiscoveryNode(node)) {
            continue;
        }
        if (extract) {
            it.remove();
        }
        result.add(node);
    }
    return result;
}
Also used : DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode) LinkedList(java.util.LinkedList)

Example 2 with DiscoveryNode

use of org.openkilda.messaging.model.DiscoveryNode in project open-kilda by telstra.

the class DiscoveryManager method handleSwitchDown.

public void handleSwitchDown(String switchId) {
    Node node = new Node(switchId, null);
    List<DiscoveryNode> subjectList = filterQueue(node, true);
    logger.info("Deregister switch {} from ISL discovery manager", switchId);
    for (DiscoveryNode subject : subjectList) {
        logger.info("Del {}", subject);
    }
}
Also used : DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode) DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode)

Example 3 with DiscoveryNode

use of org.openkilda.messaging.model.DiscoveryNode in project open-kilda by telstra.

the class DummyIIslFilter method add.

public void add(String switchId, String portId) {
    DiscoveryNode match = new DiscoveryNode(switchId, portId, 1, DiscoveryNode.FORLORN_NEVER);
    matchSet.add(match);
}
Also used : DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode)

Example 4 with DiscoveryNode

use of org.openkilda.messaging.model.DiscoveryNode in project open-kilda by telstra.

the class DiscoveryNodeTest method forlorn.

/**
 * Verify the initial behavior of forlorn and the limit scenarios
 */
@Test
public void forlorn() {
    int threshhold = 2;
    dn = new DiscoveryNode("sw1", "s2", 0, threshhold);
    assertEquals("A DN starts out as not forlorn", false, dn.forlorn());
    dn.incConsecutiveFailure();
    dn.incConsecutiveFailure();
    dn.incConsecutiveFailure();
    assertEquals("The DN should now be forlorn", true, dn.forlorn());
}
Also used : DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode) Test(org.junit.Test)

Example 5 with DiscoveryNode

use of org.openkilda.messaging.model.DiscoveryNode in project open-kilda by telstra.

the class DiscoveryManager method handlePortUp.

public void handlePortUp(String switchId, String portId) {
    DiscoveryNode subject;
    Node node = new Node(switchId, portId);
    List<DiscoveryNode> subjectList = filterQueue(node);
    if (subjectList.size() != 0) {
        // Similar to SwitchUp, if we have a PortUp on an existing port, either we are receiving
        // a duplicate, or we missed the port down, or a new discovery has occurred.
        // NB: this should cause an ISL discovery packet to be sent.
        // TODO: we should probably separate "port up" from "do discovery". ATM, one would call
        // this function just to get the "do discovery" functionality.
        subject = subjectList.get(0);
        logger.info("Port UP on existing node {};  clear failures and ISLFound", subject);
        subject.setFoundIsl(false);
        // ensure we bypass forlorn
        subject.clearConsecutiveFailure();
        return;
    }
    subject = new DiscoveryNode(node.switchId, node.portId, this.islHealthCheckInterval, this.forlornLimit);
    pollQueue.add(subject);
    logger.info("New {}", subject);
}
Also used : DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode) DiscoveryNode(org.openkilda.messaging.model.DiscoveryNode)

Aggregations

DiscoveryNode (org.openkilda.messaging.model.DiscoveryNode)15 Test (org.junit.Test)4 LinkedList (java.util.LinkedList)2 Tuple (org.apache.storm.tuple.Tuple)1 TupleImpl (org.apache.storm.tuple.TupleImpl)1 Values (org.apache.storm.tuple.Values)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 NetworkInfoData (org.openkilda.messaging.info.discovery.NetworkInfoData)1 PortInfoData (org.openkilda.messaging.info.event.PortInfoData)1 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)1 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)1 WatchDog (org.openkilda.wfm.WatchDog)1 DiscoveryManager (org.openkilda.wfm.isl.DiscoveryManager)1