use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class FlowMeterModifyHubBolt method onRequest.
@Override
protected void onRequest(Tuple input) throws PipelineException {
String key = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
CommandData data = pullValue(input, MessageKafkaTranslator.FIELD_ID_PAYLOAD, CommandData.class);
if (data instanceof MeterModifyRequest) {
service.handleRequest(key, (MeterModifyRequest) data, new FlowHubCarrierImpl(input));
} else {
unhandledInput(input);
}
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class YFlowPingRequestTest method serializeLoop.
@Test
public void serializeLoop() throws Exception {
YFlowPingRequest origin = new YFlowPingRequest("yFlowId", 5000);
CommandMessage wrapper = new CommandMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
serializer.serialize(wrapper);
CommandMessage decodedWrapper = (CommandMessage) serializer.deserialize();
CommandData decoded = decodedWrapper.getData();
assertEquals(origin, decoded);
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class FlowPingRequestTest method serializeLoop.
@Test
public void serializeLoop() throws Exception {
FlowPingRequest origin = new FlowPingRequest("flowId", 5000);
CommandMessage wrapper = new CommandMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
serializer.serialize(wrapper);
CommandMessage decodedWrapper = (CommandMessage) serializer.deserialize();
CommandData decoded = decodedWrapper.getData();
Assert.assertEquals(String.format("%s object have been mangled in serialisation/deserialization loop", origin.getClass().getName()), origin, decoded);
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class SwitchManagerHub method onRequest.
@Override
protected void onRequest(Tuple input) throws PipelineException {
if (!active) {
log.info("Switch Manager Topology is inactive");
return;
}
String key = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
CommandMessage message = pullValue(input, MessageKafkaTranslator.FIELD_ID_PAYLOAD, CommandMessage.class);
CommandData data = message.getData();
if (data instanceof SwitchValidateRequest) {
validateService.handleSwitchValidateRequest(key, (SwitchValidateRequest) data);
} else if (data instanceof SwitchRulesDeleteRequest) {
switchRuleService.deleteRules(key, (SwitchRulesDeleteRequest) data);
} else if (data instanceof SwitchRulesInstallRequest) {
switchRuleService.installRules(key, (SwitchRulesInstallRequest) data);
} else if (data instanceof CreateLagPortRequest) {
createLagPortService.handleCreateLagRequest(key, (CreateLagPortRequest) data);
} else if (data instanceof DeleteLagPortRequest) {
deleteLagPortService.handleDeleteLagRequest(key, (DeleteLagPortRequest) data);
} else {
log.warn("Receive unexpected CommandMessage for key {}: {}", key, data);
}
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class JsonSerializeAbstractTest method commandSerializeLoop.
protected void commandSerializeLoop(CommandData origin) throws Exception {
CommandMessage wrapper = new CommandMessage(origin, 0, "serialize-loop");
serializer.serialize(wrapper);
CommandMessage decodedWrapper = (CommandMessage) serializer.deserialize();
CommandData decoded = decodedWrapper.getData();
validate(origin, decoded);
}
Aggregations