Search in sources :

Example 1 with DumpRulesRequest

use of org.openkilda.messaging.command.switches.DumpRulesRequest in project open-kilda by telstra.

the class RecordHandler method doDumpRulesRequest.

private void doDumpRulesRequest(final CommandMessage message) {
    DumpRulesRequest request = (DumpRulesRequest) message.getData();
    final String switchId = request.getSwitchId();
    logger.debug("Loading installed rules for switch {}", switchId);
    OFFlowStatsReply reply = context.getSwitchManager().dumpFlowTable(DatapathId.of(switchId));
    List<FlowEntry> flows = reply.getEntries().stream().map(OFFlowStatsConverter::toFlowEntry).collect(Collectors.toList());
    SwitchFlowEntries response = SwitchFlowEntries.builder().switchId(switchId).flowEntries(flows).build();
    InfoMessage infoMessage = new InfoMessage(response, message.getTimestamp(), message.getCorrelationId());
    context.getKafkaProducer().postMessage(TOPO_ENG_TOPIC, infoMessage);
}
Also used : DumpRulesRequest(org.openkilda.messaging.command.switches.DumpRulesRequest) SwitchFlowEntries(org.openkilda.messaging.info.rule.SwitchFlowEntries) InfoMessage(org.openkilda.messaging.info.InfoMessage) OFFlowStatsReply(org.projectfloodlight.openflow.protocol.OFFlowStatsReply) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry)

Aggregations

DumpRulesRequest (org.openkilda.messaging.command.switches.DumpRulesRequest)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 FlowEntry (org.openkilda.messaging.info.rule.FlowEntry)1 SwitchFlowEntries (org.openkilda.messaging.info.rule.SwitchFlowEntries)1 OFFlowStatsReply (org.projectfloodlight.openflow.protocol.OFFlowStatsReply)1