1 package org.openkilda.atdd;
3 import static org.awaitility.Awaitility.await;
4 import static org.junit.Assert.assertEquals;
5 import static org.junit.Assert.assertNotNull;
6 import static org.junit.Assert.assertTrue;
15 import cucumber.api.java.en.Then;
16 import cucumber.api.java.en.When;
17 import org.apache.commons.lang.StringUtils;
18 import org.awaitility.Duration;
20 import java.util.List;
21 import java.util.concurrent.TimeUnit;
25 @When(
"^switch (.*) is turned off$")
26 public
void turnOffSwitch(String switchName) throws InterruptedException {
27 TimeUnit.SECONDS.sleep(1);
31 @When(
"^switch (.*) is turned on")
32 public
void turnOnSwitch(String switchName) throws InterruptedException {
33 TimeUnit.SECONDS.sleep(1);
37 @Then(
"^flow (.*) is(.*) built through (.*) switch")
39 throws InterruptedException {
40 await().atMost(20, TimeUnit.SECONDS)
41 .pollInterval(Duration.ONE_SECOND)
44 assertTrue(
"Flow path should exist", payload != null && payload.getForwardPath() != null);
45 List<PathNodePayload>
path = payload.getForwardPath();
47 boolean contains =
path.stream()
50 if (StringUtils.isBlank(shouldNotContain)) {
58 @When(
"flow reroute feature is (on|off)$")
60 boolean status = statusString.equals(
"on");
66 assertEquals(
status,
result.getReflowOnSwitchActivationEnabled());
67 assertEquals(desired.getReflowOnSwitchActivationEnabled(),
result.getReflowOnSwitchActivationEnabled());
void flowPathContainsSwitch(final String flow, final String shouldNotContain, final String switchIdString)
static boolean reviveSwitch(String switchName)
static FlowPathPayload getFlowPath(final String flowId)
void turnOffSwitch(String switchName)
static FeatureTogglePayload updateFeaturesStatus(FeatureTogglePayload desired)
void turnOnSwitch(String switchName)
void flowRerouteFeatureStatus(final String statusString)
static String getFlowName(final String flowId)
static boolean knockoutSwitch(String switchName)