Search in sources :

Example 6 with FlowEndpointPayload

use of org.openkilda.messaging.payload.flow.FlowEndpointPayload in project open-kilda by telstra.

the class FlowCrudBasicRunTest method successfulFlowCreation.

@When("^flow (.*) creation request with (.*) (\\d+) (\\d+) and (.*) (\\d+) (\\d+) and (\\d+) is successful$")
public void successfulFlowCreation(final String flowId, final String sourceSwitch, final int sourcePort, final int sourceVlan, final String destinationSwitch, final int destinationPort, final int destinationVlan, final int bandwidth) throws Exception {
    flowPayload = new FlowPayload(FlowUtils.getFlowName(flowId), new FlowEndpointPayload(sourceSwitch, sourcePort, sourceVlan), new FlowEndpointPayload(destinationSwitch, destinationPort, destinationVlan), bandwidth, false, flowId, null);
    FlowPayload response = FlowUtils.putFlow(flowPayload);
    assertNotNull(response);
    response.setLastUpdated(null);
    assertEquals(flowPayload, response);
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowEndpointPayload(org.openkilda.messaging.payload.flow.FlowEndpointPayload) When(cucumber.api.java.en.When)

Example 7 with FlowEndpointPayload

use of org.openkilda.messaging.payload.flow.FlowEndpointPayload in project open-kilda by telstra.

the class FlowCrudBasicRunTest method failedFlowCreation.

@When("^flow (.*) creation request with (.*) (\\d+) (\\d+) and (.*) (\\d+) (\\d+) and (\\d+) is failed$")
public void failedFlowCreation(final String flowId, final String sourceSwitch, final int sourcePort, final int sourceVlan, final String destinationSwitch, final int destinationPort, final int destinationVlan, final int bandwidth) throws Exception {
    flowPayload = new FlowPayload(FlowUtils.getFlowName(flowId), new FlowEndpointPayload(sourceSwitch, sourcePort, sourceVlan), new FlowEndpointPayload(destinationSwitch, destinationPort, destinationVlan), bandwidth, false, flowId, null);
    FlowPayload response = FlowUtils.putFlow(flowPayload);
    assertNull(response);
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowEndpointPayload(org.openkilda.messaging.payload.flow.FlowEndpointPayload) When(cucumber.api.java.en.When)

Example 8 with FlowEndpointPayload

use of org.openkilda.messaging.payload.flow.FlowEndpointPayload in project open-kilda by telstra.

the class FlowFFRTest method successfulFlowCreation.

@When("^a flow (.*) is successfully created$")
public void successfulFlowCreation(String flowId) throws Throwable {
    FlowPayload flowPayload = new FlowPayload(FlowUtils.getFlowName(flowId), new FlowEndpointPayload(sourceSwitch, sourcePort, sourceVlan), new FlowEndpointPayload(destinationSwitch, destinationPort, destinationVlan), bandwidth, false, flowId, null);
    FlowPayload response = FlowUtils.putFlow(flowPayload);
    assertNotNull(response);
    response.setLastUpdated(null);
    assertEquals(flowPayload, response);
    System.out.println(response.toString());
    TimeUnit.SECONDS.sleep(5);
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowEndpointPayload(org.openkilda.messaging.payload.flow.FlowEndpointPayload) When(cucumber.api.java.en.When)

Example 9 with FlowEndpointPayload

use of org.openkilda.messaging.payload.flow.FlowEndpointPayload in project open-kilda by telstra.

the class StormTopologyLCM method activeSimpleNetworkTopologyWithTwoSwitchesAndFlow.

/**
 * Test initial function, clear all then load basic network topology and create flow
 */
@Given("^active simple network topology with two switches and flow$")
public void activeSimpleNetworkTopologyWithTwoSwitchesAndFlow() throws Throwable {
    // clearEverything
    TestUtils.clearEverything(StringUtils.EMPTY);
    FlowUtils.cleanupFlows();
    // Load topo from file and send to mininet
    String topology = IOUtils.toString(this.getClass().getResourceAsStream("/topologies/simple-topology.json"), UTF_8);
    assertTrue(TopologyHelp.CreateMininetTopology(topology));
    // Create and check flow
    FlowPayload flowPayload = new FlowPayload(flowId, new FlowEndpointPayload("00:01:00:00:00:00:00:01", 1, 100), new FlowEndpointPayload("00:01:00:00:00:00:00:02", 1, 100), 10000, false, flowId, null);
    FlowPayload response = null;
    for (int i = 0; i < 10; ++i) {
        response = FlowUtils.putFlow(flowPayload);
        if (response != null) {
            break;
        }
        TimeUnit.SECONDS.sleep(1);
    }
    assertNotNull(response);
    response.setLastUpdated(null);
    assertEquals(flowPayload, response);
    // Check traffic on new flow
    assertTrue(trafficIsOk(true));
    // Save bolt state for compare it with new one after restart
    expectedStateDumpsFromBolts = kafkaUtils.getStateDumpsFromBolts();
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowEndpointPayload(org.openkilda.messaging.payload.flow.FlowEndpointPayload) DefaultParameters.trafficEndpoint(org.openkilda.DefaultParameters.trafficEndpoint) Given(cucumber.api.java.en.Given)

Aggregations

FlowEndpointPayload (org.openkilda.messaging.payload.flow.FlowEndpointPayload)9 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)9 When (cucumber.api.java.en.When)5 Test (org.junit.Test)3 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)3 Flow (org.openkilda.topology.domain.Flow)3 Given (cucumber.api.java.en.Given)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ContiguousSet (com.google.common.collect.ContiguousSet)1 DiscreteDomain (com.google.common.collect.DiscreteDomain)1 Range (com.google.common.collect.Range)1 RangeSet (com.google.common.collect.RangeSet)1 TreeRangeSet (com.google.common.collect.TreeRangeSet)1 Matchers.reflectEquals (com.nitorcreations.Matchers.reflectEquals)1 And (cucumber.api.java.en.And)1 Then (cucumber.api.java.en.Then)1 En (cucumber.api.java8.En)1 String.format (java.lang.String.format)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1