use of org.openkilda.messaging.info.event.IslInfoData in project open-kilda by telstra.
the class FlowIgnoreBandwidthTest method availableISLBandwidthsBetweenSwitches.
@Then("^available ISL's bandwidths between ([0-9a-f]{2}(?::[0-9a-f]{2}){7}) and ([0-9a-f]{2}(?::[0-9a-f]{2}){7}) is (\\d+)$")
public void availableISLBandwidthsBetweenSwitches(String source, String dest, long expected) {
List<IslInfoData> islLinks = LinksUtils.dumpLinks();
Long actual = null;
for (IslInfoData link : islLinks) {
if (link.getPath().size() != 2) {
throw new RuntimeException(String.format("ISL's link path contain %d records, expect 2", link.getPath().size()));
}
PathNode left = link.getPath().get(0);
PathNode right = link.getPath().get(1);
if (!source.equals(left.getSwitchId())) {
continue;
}
if (!dest.equals(right.getSwitchId())) {
continue;
}
actual = link.getAvailableBandwidth();
break;
}
Assert.assertNotNull(actual);
Assert.assertEquals("Actual bandwidth does not match expectations.", expected, (long) actual);
System.out.println(String.format("Available bandwidth between %s and %s is %d", source, dest, actual));
}
use of org.openkilda.messaging.info.event.IslInfoData in project open-kilda by telstra.
the class FlowPathTest method checkAvailableBandwidth.
@When("^all links have available bandwidth (\\d+)$")
public void checkAvailableBandwidth(int expectedAvailableBandwidth) throws InterruptedException {
List<IslInfoData> links = LinksUtils.dumpLinks();
for (IslInfoData link : links) {
int actualBandwidth = getBandwidth(expectedAvailableBandwidth, link.getPath().get(0).getSwitchId(), String.valueOf(link.getPath().get(0).getPortNo()));
assertEquals(expectedAvailableBandwidth, actualBandwidth);
}
}
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())));
}
Aggregations