use of org.openkilda.server42.control.messaging.islrtt.ClearIsls in project open-kilda by telstra.
the class GateTest method testClearIsls.
@Test
public void testClearIsls() throws Exception {
ClearIsls clearIsls = ClearIsls.builder().switchId(new SwitchId("00:00:1b:45:18:d6:71:5a")).build();
gate.listen(clearIsls);
CommandPacket commandPacket = getCommandPacket();
assertThat(commandPacket.getType()).isEqualTo(Type.CLEAR_ISLS);
assertThat(commandPacket.getCommandList()).hasSize(1);
Any command = commandPacket.getCommand(0);
assertThat(command.is(IslRttControl.ClearIslsFilter.class)).isTrue();
IslRttControl.ClearIslsFilter unpack = command.unpack(IslRttControl.ClearIslsFilter.class);
String switchId = clearIsls.getSwitchId().toString();
assertThat(unpack.getSwitchId()).isEqualTo(switchId);
}
use of org.openkilda.server42.control.messaging.islrtt.ClearIsls in project open-kilda by telstra.
the class StubApplicationTests method clearIsls.
@BeforeEach
public void clearIsls() throws Exception {
mockMvc.perform(delete("/kafka/isl/{switchId}", switchId)).andExpect(status().isOk());
MvcResult result = mockMvc.perform(get("/kafka/isl/{switchId}", switchId)).andReturn();
ListIslsPayload emptyPayload = new ListIslsPayload();
mockMvc.perform(asyncDispatch(result)).andExpect(status().isOk()).andExpect(content().json(objectWriter.writeValueAsString(emptyPayload)));
}
use of org.openkilda.server42.control.messaging.islrtt.ClearIsls in project open-kilda by telstra.
the class Gate method listen.
@KafkaHandler
void listen(@Payload ClearIsls data) {
Builder builder = CommandPacket.newBuilder();
builder.setType(Type.CLEAR_ISLS);
IslRttControl.ClearIslsFilter clearIslsFilter = IslRttControl.ClearIslsFilter.newBuilder().setSwitchId(data.getSwitchId().toString()).build();
builder.addCommand(Any.pack(clearIslsFilter));
try {
zeroMqClient.send(builder.build());
} catch (InvalidProtocolBufferException e) {
log.error("Marshalling error on {}", data, e);
}
}
use of org.openkilda.server42.control.messaging.islrtt.ClearIsls in project open-kilda by telstra.
the class IslHandler method processDeactivateIslMonitoringOnSwitch.
/**
* Deactivate monitoring for ISLs on provided switch.
*
* @param switchId specify the ISL endpoint.
*/
public void processDeactivateIslMonitoringOnSwitch(SwitchId switchId) {
ClearIsls clearIsls = ClearIsls.builder().headers(buildHeader()).switchId(switchId).build();
emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), clearIsls));
}
Aggregations