use of org.openkilda.messaging.info.event.IslInfoData in project open-kilda by telstra.
the class TopologyEventsBasicTest method a_link_is_added_in_the_middle.
@When("^a link is added in the middle$")
public void a_link_is_added_in_the_middle() throws Exception {
List<IslInfoData> links = LinksUtils.dumpLinks();
IslInfoData middleLink = getMiddleLink(links);
String srcSwitch = getSwitchName(middleLink.getPath().get(0).getSwitchId());
String dstSwitch = getSwitchName(middleLink.getPath().get(1).getSwitchId());
assertTrue("Link is not added", LinksUtils.addLink(srcSwitch, dstSwitch));
TimeUnit.SECONDS.sleep(2);
}
use of org.openkilda.messaging.info.event.IslInfoData in project open-kilda by telstra.
the class TopologyEventsBasicTest method the_links_disappear_from_the_topology_engine.
@Then("^the links disappear from the topology engine\\.$")
public void the_links_disappear_from_the_topology_engine() throws Exception {
// todo check whether we need to wait until links will disappear or we might delete them instantly when switch goes down
TimeUnit.SECONDS.sleep(15);
final SwitchInfoData middleSwitch = getMiddleSwitch(SwitchesUtils.dumpSwitches());
final List<IslInfoData> links = LinksUtils.dumpLinks();
List<IslInfoData> switchLinks = links.stream().filter(isl -> isLinkBelongToSwitch(middleSwitch.getSwitchId(), isl)).filter(isl -> isl.getState() == IslChangeType.DISCOVERED).collect(Collectors.toList());
assertTrue("Switch shouldn't have any active links", switchLinks.isEmpty());
}
use of org.openkilda.messaging.info.event.IslInfoData in project open-kilda by telstra.
the class TopologyEventsBasicTest method a_link_is_dropped_in_the_middle.
@When("^a link is dropped in the middle$")
public void a_link_is_dropped_in_the_middle() throws Exception {
List<IslInfoData> links = LinksUtils.dumpLinks();
IslInfoData middleLink = getMiddleLink(links);
PathNode node = middleLink.getPath().get(0);
assertTrue(LinksUtils.islFail(getSwitchName(node.getSwitchId()), String.valueOf(node.getPortNo())));
}
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;
}
Aggregations