Search in sources :

Example 1 with LagPortResponse

use of org.openkilda.messaging.swmanager.response.LagPortResponse in project open-kilda by telstra.

the class LagPortMapperTest method mapLagResponseTest.

@Test
public void mapLagResponseTest() {
    LagPortResponse response = new LagPortResponse(LOGICAL_PORT_NUMBER_1, Lists.newArrayList(PHYSICAL_PORT_NUMBER_1, PHYSICAL_PORT_NUMBER_2));
    org.openkilda.northbound.dto.v2.switches.LagPortDto dto = lagMapper.map(response);
    assertEquals(LOGICAL_PORT_NUMBER_1, dto.getLogicalPortNumber());
    assertEquals(PHYSICAL_PORT_NUMBER_1, dto.getPortNumbers().get(0).intValue());
    assertEquals(PHYSICAL_PORT_NUMBER_2, dto.getPortNumbers().get(1).intValue());
}
Also used : LagPortResponse(org.openkilda.messaging.swmanager.response.LagPortResponse) Test(org.junit.Test)

Example 2 with LagPortResponse

use of org.openkilda.messaging.swmanager.response.LagPortResponse in project open-kilda by telstra.

the class CreateLagPortFsm method finishedEnter.

void finishedEnter(CreateLagState from, CreateLagState to, CreateLagEvent event, CreateLagContext context) {
    LagPortResponse response = new LagPortResponse(grpcRequest.getLogicalPortNumber(), new ArrayList<>(grpcRequest.getPortNumbers()));
    InfoMessage message = new InfoMessage(response, System.currentTimeMillis(), key);
    carrier.response(key, message);
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) LagPortResponse(org.openkilda.messaging.swmanager.response.LagPortResponse)

Example 3 with LagPortResponse

use of org.openkilda.messaging.swmanager.response.LagPortResponse in project open-kilda by telstra.

the class DeleteLagPortFsm method finishedEnter.

void finishedEnter(DeleteLagState from, DeleteLagState to, DeleteLagEvent event, DeleteLagContext context) {
    LagPortResponse response;
    if (removedLagPort != null) {
        response = new LagPortResponse(removedLagPort.getLogicalPortNumber(), removedLagPort.getPhysicalPorts().stream().map(PhysicalPort::getPortNumber).collect(Collectors.toList()));
    } else {
        // dummy response entity
        // TODO(surabujin): weird behaviour, can we be more correct?
        response = new LagPortResponse(request.getLogicalPortNumber(), Collections.emptyList());
    }
    InfoMessage message = new InfoMessage(response, System.currentTimeMillis(), key);
    carrier.cancelTimeoutCallback(key);
    carrier.response(key, message);
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) LagPortResponse(org.openkilda.messaging.swmanager.response.LagPortResponse)

Aggregations

LagPortResponse (org.openkilda.messaging.swmanager.response.LagPortResponse)3 InfoMessage (org.openkilda.messaging.info.InfoMessage)2 Test (org.junit.Test)1