Search in sources :

Example 46 with FlowPayload

use of org.openkilda.messaging.payload.flow.FlowPayload 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 47 with FlowPayload

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

the class FlowIgnoreBandwidthTest method flowHaveIgnoreBandwidthFlag.

@Then("^flow between ([0-9a-f]{2}(?::[0-9a-f]{2}){7}) and ([0-9a-f]{2}(?::[0-9a-f]{2}){7}) have ignore_bandwidth flag$")
public void flowHaveIgnoreBandwidthFlag(String source, String dest) {
    String flowId = lookupCreatedFlowId(source, dest);
    FlowPayload flow = FlowUtils.getFlow(flowId);
    Assert.assertNotNull("Can\'t locate flow", flow);
    Assert.assertTrue("Flow's ignore_bandwidth flag is NOT set", flow.isIgnoreBandwidth());
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) Then(cucumber.api.java.en.Then)

Example 48 with FlowPayload

use of org.openkilda.messaging.payload.flow.FlowPayload 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

FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)48 Test (org.junit.Test)14 FlowEndpointPayload (org.openkilda.messaging.payload.flow.FlowEndpointPayload)9 Then (cucumber.api.java.en.Then)7 When (cucumber.api.java.en.When)7 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 DefaultParameters.northboundEndpoint (org.openkilda.DefaultParameters.northboundEndpoint)6 DefaultParameters.topologyEndpoint (org.openkilda.DefaultParameters.topologyEndpoint)6 PathInfoData (org.openkilda.messaging.info.event.PathInfoData)6 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)6 HttpHeaders (org.springframework.http.HttpHeaders)6 ResponseEntity (org.springframework.http.ResponseEntity)6 WithMockUser (org.springframework.security.test.context.support.WithMockUser)6 MvcResult (org.springframework.test.web.servlet.MvcResult)6 And (cucumber.api.java.en.And)5 Client (javax.ws.rs.client.Client)5 Response (javax.ws.rs.core.Response)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3