use of org.openkilda.messaging.command.switches.SwitchValidateRequest in project open-kilda by telstra.
the class FeatureTogglesBolt method requestSwitchSync.
@Override
public void requestSwitchSync(SwitchId switchId) {
SwitchValidateRequest data = SwitchValidateRequest.builder().switchId(switchId).performSync(true).processMeters(true).removeExcess(true).build();
getOutput().emit(StreamType.TO_SWITCH_MANAGER.toString(), getCurrentTuple(), new Values(data, KeyProvider.generateChainedKey(getCorrelationId())));
}
use of org.openkilda.messaging.command.switches.SwitchValidateRequest 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.switches.SwitchValidateRequest in project open-kilda by telstra.
the class SwitchOperationsBolt method requestSwitchSync.
@Override
public void requestSwitchSync(SwitchId switchId) {
SwitchValidateRequest data = SwitchValidateRequest.builder().switchId(switchId).performSync(true).processMeters(true).removeExcess(true).build();
getOutput().emit(StreamType.TO_SWITCH_MANAGER.toString(), getCurrentTuple(), new Values(data, KeyProvider.generateChainedKey(getCorrelationId())));
}
use of org.openkilda.messaging.command.switches.SwitchValidateRequest in project open-kilda by telstra.
the class MessageEncoder method handleInput.
@Override
protected void handleInput(Tuple input) throws Exception {
MessageData payload = pullPayload(input);
try {
CommandContext commandContext = pullContext(input);
Message message = wrap(commandContext, payload);
if (payload instanceof FlowRerouteRequest) {
getOutput().emit(input.getSourceStreamId(), input, new Values(message));
} else if (payload instanceof SwitchValidateRequest) {
getOutput().emit(input.getSourceStreamId(), input, new Values(commandContext.getCorrelationId(), message));
} else if (payload instanceof ErrorData) {
getOutput().emit(StreamType.ERROR.toString(), input, new Values(null, message));
}
} catch (IllegalArgumentException e) {
log.error(e.getMessage());
unhandledInput(input);
}
}
use of org.openkilda.messaging.command.switches.SwitchValidateRequest in project open-kilda by telstra.
the class SwitchSyncFsmTest method getModifyDefaultMetersWithFlowMeters.
@Test
public void getModifyDefaultMetersWithFlowMeters() {
ArrayList<MeterInfoEntry> misconfiguredMeters = newArrayList(MeterInfoEntry.builder().cookie(COOKIE_1).meterId((long) MeterId.MIN_FLOW_METER_ID).build());
ValidateMetersResult validateMetersResult = new ValidateMetersResult(newArrayList(), misconfiguredMeters, newArrayList(), newArrayList());
ValidationResult validationResult = new ValidationResult(new ArrayList<>(), true, EMPTY_VALIDATE_RULES_RESULT, validateMetersResult, EMPTY_VALIDATE_GROUPS_RESULT, EMPTY_LOGICAL_PORTS_RESULT);
SwitchSyncFsm fsm = new SwitchSyncFsm(null, null, null, new SwitchValidateRequest(SWITCH_ID, true, true, true), validationResult);
assertTrue(fsm.getModifyDefaultMeters().isEmpty());
}
Aggregations