use of org.openkilda.server42.control.messaging.islrtt.ListIslPortsOnSwitch in project open-kilda by telstra.
the class Gate method listen.
@KafkaHandler
void listen(@Payload ListIslPortsOnSwitch data) {
Builder builder = CommandPacket.newBuilder();
builder.setType(Type.LIST_ISLS);
IslRttControl.ListIslsFilter listIslsFilter = IslRttControl.ListIslsFilter.newBuilder().setSwitchId(data.getSwitchId().toString()).build();
builder.addCommand(Any.pack(listIslsFilter));
try {
CommandPacketResponse serverResponse = zeroMqClient.send(builder.build());
if (serverResponse == null) {
log.error("No response from server on {}", data.getHeaders().getCorrelationId());
return;
}
for (Any any : serverResponse.getResponseList()) {
IslRttControl.IslEndpoint endpoint = any.unpack(IslRttControl.IslEndpoint.class);
if (!data.getIslPorts().contains(endpoint.getPort())) {
removeIsl(data.getSwitchId(), endpoint.getPort());
}
}
} catch (InvalidProtocolBufferException e) {
log.error("Marshalling error on {}", data, e);
}
}
use of org.openkilda.server42.control.messaging.islrtt.ListIslPortsOnSwitch in project open-kilda by telstra.
the class IslHandler method sendListOfIslPortsBySwitchId.
@Override
public void sendListOfIslPortsBySwitchId(SwitchId switchId, Set<Integer> islPorts) {
ListIslPortsOnSwitch listIslPortsOnSwitch = ListIslPortsOnSwitch.builder().headers(buildHeader()).switchId(switchId).islPorts(islPorts).build();
emit(STREAM_CONTROL_COMMANDS_ID, getCurrentTuple(), new Values(switchId.toString(), listIslPortsOnSwitch));
}
Aggregations