use of org.openkilda.server42.control.messaging.flowrtt.ClearFlows in project open-kilda by telstra.
the class Gate method listen.
@KafkaHandler
void listen(ClearFlows data, @Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) String switchIdKey) {
Builder builder = CommandPacket.newBuilder();
builder.setType(Type.CLEAR_FLOWS);
SwitchId switchId = new SwitchId(switchIdKey);
FlowRttControl.ClearFlowsFilter clearFlowsFilter = FlowRttControl.ClearFlowsFilter.newBuilder().setDstMac(switchId.toMacAddress()).build();
builder.addCommand(Any.pack(clearFlowsFilter));
try {
zeroMqClient.send(builder.build());
} catch (InvalidProtocolBufferException e) {
log.error("Marshalling error on {}", data);
}
}
use of org.openkilda.server42.control.messaging.flowrtt.ClearFlows in project open-kilda by telstra.
the class StubApplicationTests method clearFlows.
@BeforeEach
public void clearFlows() throws Exception {
mockMvc.perform(delete("/kafka/flow/").param("switchId", switchId)).andExpect(status().isOk());
MvcResult result = mockMvc.perform(get("/kafka/flow/").param("switchId", switchId)).andReturn();
ListFlowsPayload emptyPayload = new ListFlowsPayload();
mockMvc.perform(asyncDispatch(result)).andExpect(status().isOk()).andExpect(content().json(objectWriter.writeValueAsString(emptyPayload)));
}
use of org.openkilda.server42.control.messaging.flowrtt.ClearFlows in project open-kilda by telstra.
the class FlowHandler method notifyDeactivateFlowMonitoring.
private void notifyDeactivateFlowMonitoring(SwitchId switchId) {
ClearFlows clearFlows = ClearFlows.builder().headers(buildHeader()).build();
emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), clearFlows));
}
use of org.openkilda.server42.control.messaging.flowrtt.ClearFlows in project open-kilda by telstra.
the class GateTest method clearFlowsTest.
@Test
public void clearFlowsTest() throws Exception {
Headers headers = Headers.builder().correlationId("some-correlation-id").build();
ClearFlows clearFlows = ClearFlows.builder().headers(headers).build();
String dpId = "00:00:1b:45:18:d6:71:5a";
gate.listen(clearFlows, dpId);
CommandPacket commandPacket = getCommandPacket();
assertThat(commandPacket.getType()).isEqualTo(Type.CLEAR_FLOWS);
assertThat(commandPacket.getCommandList()).hasSize(1);
Any command = commandPacket.getCommand(0);
assertThat(command.is(FlowRttControl.ClearFlowsFilter.class)).isTrue();
FlowRttControl.ClearFlowsFilter unpack = command.unpack(FlowRttControl.ClearFlowsFilter.class);
String dstMac = "1b:45:18:d6:71:5a";
assertThat(unpack.getDstMac()).isEqualTo(dstMac);
}
Aggregations