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;
}
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);
}
}
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);
}
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());
}
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);
}
Aggregations