Search in sources :

Example 1 with Isl

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

the class TopologyVerificationSteps method checkDiscoveredLinks.

@And("^all defined links are detected")
public void checkDiscoveredLinks() {
    if (actualLinks.isEmpty() && referenceLinks.isEmpty()) {
        scenario.write("There are no links discovered as expected");
        return;
    }
    assertFalse("No links were discovered", actualLinks.isEmpty());
    assertThat("Discovered links don't match expected", actualLinks, containsInAnyOrder(referenceLinks.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(), link.getAswitch());
        return Stream.of(link, pairedLink);
    }).map(IslMatcher::new).collect(toList())));
}
Also used : Isl(org.openkilda.testing.model.topology.TopologyDefinition.Isl) And(cucumber.api.java.en.And)

Example 2 with Isl

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

the class LinkPropertiesSteps method createLinkPropertiesRequest.

@When("^create link properties request for ISL '(.*)'$")
public void createLinkPropertiesRequest(String islAlias) {
    linkPropsRequest = new LinkPropsDto();
    Isl theIsl = topologyUnderTest.getAliasedObject(islAlias);
    linkPropsRequest.setSrcSwitch(theIsl.getSrcSwitch().getDpId().toString());
    linkPropsRequest.setSrcPort(theIsl.getSrcPort());
    linkPropsRequest.setDstSwitch(theIsl.getDstSwitch().getDpId().toString());
    linkPropsRequest.setDstPort(theIsl.getDstPort());
}
Also used : Isl(org.openkilda.testing.model.topology.TopologyDefinition.Isl) LinkPropsDto(org.openkilda.northbound.dto.v1.links.LinkPropsDto) When(cucumber.api.java.en.When)

Example 3 with Isl

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

the class LinkSteps method selectARandomIslAndAliasItAsIsl.

@Given("^select a random ISL and alias it as '(.*)'$")
public void selectARandomIslAndAliasItAsIsl(String islAlias) {
    List<Isl> isls = getUnaliasedIsls();
    Random r = new Random();
    Isl theIsl = isls.get(r.nextInt(isls.size()));
    log.info("Selected random isl: {}", theIsl.toString());
    topologyUnderTest.addAlias(islAlias, theIsl);
}
Also used : Isl(org.openkilda.testing.model.topology.TopologyDefinition.Isl) Random(java.util.Random) Given(cucumber.api.java.en.Given)

Aggregations

Isl (org.openkilda.testing.model.topology.TopologyDefinition.Isl)3 And (cucumber.api.java.en.And)1 Given (cucumber.api.java.en.Given)1 When (cucumber.api.java.en.When)1 Random (java.util.Random)1 LinkPropsDto (org.openkilda.northbound.dto.v1.links.LinkPropsDto)1