use of org.openkilda.server42.control.messaging.islrtt.ListIslsRequest in project open-kilda by telstra.
the class Gate method listen.
@KafkaHandler
void listen(@Payload ListIslsRequest 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;
}
HashSet<Integer> portList = new HashSet<>();
for (Any any : serverResponse.getResponseList()) {
portList.add(any.unpack(IslEndpoint.class).getPort());
}
ListIslsResponse response = ListIslsResponse.builder().headers(data.getHeaders()).switchId(data.getSwitchId()).ports(portList).build();
template.send(toStorm, response);
} catch (InvalidProtocolBufferException e) {
log.error("Marshalling error on {}", data, e);
}
}
Aggregations