Search in sources :

Example 16 with CommandPacket

use of org.openkilda.server42.control.messaging.Control.CommandPacket in project open-kilda by telstra.

the class GateTest method removeFlow.

@Test
public void removeFlow() throws Exception {
    RemoveFlow removeFlow = RemoveFlow.builder().flowId("some-flow-id").build();
    gate.listen(removeFlow);
    CommandPacket commandPacket = getCommandPacket();
    assertThat(commandPacket.getType()).isEqualTo(Type.REMOVE_FLOW);
    assertThat(commandPacket.getCommandList()).hasSize(1);
    Any command = commandPacket.getCommand(0);
    assertThat(command.is(FlowRttControl.RemoveFlow.class)).isTrue();
    FlowRttControl.RemoveFlow unpack = command.unpack(FlowRttControl.RemoveFlow.class);
    assertThat(unpack.getFlow().getFlowId()).isEqualTo(removeFlow.getFlowId());
}
Also used : RemoveFlow(org.openkilda.server42.control.messaging.flowrtt.RemoveFlow) FlowRttControl(org.openkilda.server42.control.messaging.flowrtt.FlowRttControl) CommandPacket(org.openkilda.server42.control.messaging.Control.CommandPacket) Any(com.google.protobuf.Any) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

CommandPacket (org.openkilda.server42.control.messaging.Control.CommandPacket)15 Any (com.google.protobuf.Any)12 FlowRttControl (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl)10 Test (org.junit.Test)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)7 SwitchId (org.openkilda.model.SwitchId)7 Flow (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl.Flow)7 RemoveFlow (org.openkilda.server42.control.messaging.flowrtt.RemoveFlow)7 IslRttControl (org.openkilda.server42.control.messaging.islrtt.IslRttControl)7 AddFlow (org.openkilda.server42.control.messaging.flowrtt.AddFlow)6 CommandPacketResponse (org.openkilda.server42.control.messaging.Control.CommandPacketResponse)5 IslEndpoint (org.openkilda.server42.control.messaging.islrtt.IslRttControl.IslEndpoint)5 List (java.util.List)4 Control (org.openkilda.server42.control.messaging.Control)4 Builder (org.openkilda.server42.control.messaging.Control.CommandPacket.Builder)4 KafkaHandler (org.springframework.kafka.annotation.KafkaHandler)4 Builder (org.openkilda.server42.control.messaging.Control.CommandPacketResponse.Builder)3 ClearFlows (org.openkilda.server42.control.messaging.flowrtt.ClearFlows)3 Headers (org.openkilda.server42.control.messaging.flowrtt.Headers)3