Search in sources :

Example 1 with Isl

use of org.openkilda.atdd.staging.model.topology.TopologyDefinition.Isl in project open-kilda by telstra.

the class DiscoveryMechanismSteps method checkDiscoveredLinks.

@Then("^all provided links should be detected")
public void checkDiscoveredLinks() {
    List<IslInfoData> discoveredLinks = topologyEngineService.getActiveLinks();
    List<TopologyDefinition.Isl> expectedLinks = topologyDefinition.getIslsForActiveSwitches();
    if (CollectionUtils.isEmpty(discoveredLinks) && expectedLinks.isEmpty()) {
        scenario.write("There are no links discovered as expected");
        return;
    }
    assertThat("Discovered links don't match expected", discoveredLinks, containsInAnyOrder(expectedLinks.stream().flatMap(link -> {
        // in kilda we have forward and reverse isl, that's why we have to divide into 2
        Isl pairedLink = Isl.factory(link.getDstSwitch(), link.getDstPort(), link.getSrcSwitch(), link.getSrcPort(), link.getMaxBandwidth());
        return Stream.of(link, pairedLink);
    }).map(IslMatcher::new).collect(toList())));
}
Also used : Isl(org.openkilda.atdd.staging.model.topology.TopologyDefinition.Isl) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) Then(cucumber.api.java.en.Then)

Aggregations

Then (cucumber.api.java.en.Then)1 Isl (org.openkilda.atdd.staging.model.topology.TopologyDefinition.Isl)1 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)1