use of org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult in project open-kilda by telstra.
the class RecordHandler method doRemoveIslDefaultRule.
private void doRemoveIslDefaultRule(CommandMessage message) {
RemoveIslDefaultRulesCommand toRemove = (RemoveIslDefaultRulesCommand) message.getData();
RemoveIslDefaultRulesResult result = new RemoveIslDefaultRulesResult(toRemove.getSrcSwitch(), toRemove.getSrcPort(), toRemove.getDstSwitch(), toRemove.getDstPort(), true);
DatapathId dpid = DatapathId.of(toRemove.getSrcSwitch().toLong());
try {
context.getSwitchManager().removeMultitableEndpointIslRules(dpid, toRemove.getSrcPort());
context.getSwitchManager().removeServer42IslRttInputFlow(dpid, toRemove.getSrcPort());
} catch (SwitchOperationException e) {
logger.error("Failed to remove isl rules for switch: '{}'", toRemove.getSrcSwitch(), e);
result.setSuccess(false);
}
getKafkaProducer().sendMessageAndTrack(context.getKafkaSwitchManagerTopic(), record.key(), new InfoMessage(result, System.currentTimeMillis(), message.getCorrelationId(), context.getRegion()));
}
use of org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult in project open-kilda by telstra.
the class NetworkIslServiceTest method prepareAndPerformDelete.
private void prepareAndPerformDelete(IslStatus initialStatus, boolean multiTable) {
Isl islAlphaBeta = makeIsl(endpointAlpha1, endpointBeta2, multiTable).actualStatus(initialStatus).status(initialStatus).build();
Isl islBetaAlpha = makeIsl(endpointBeta2, endpointAlpha1, multiTable).actualStatus(initialStatus).status(initialStatus).build();
// prepare
islStorage.save(islAlphaBeta);
islStorage.save(islBetaAlpha);
mockPersistenceLinkProps(endpointAlpha1, endpointBeta2, null);
mockPersistenceLinkProps(endpointBeta2, endpointAlpha1, null);
mockPersistenceBandwidthAllocation(endpointAlpha1, endpointBeta2, 0);
mockPersistenceBandwidthAllocation(endpointBeta2, endpointAlpha1, 0);
IslReference reference = new IslReference(endpointAlpha1, endpointBeta2);
service.islSetupFromHistory(endpointAlpha1, reference, islAlphaBeta);
reset(carrier);
// remove
service.remove(reference);
if (multiTable && (initialStatus == IslStatus.INACTIVE || initialStatus == IslStatus.MOVED)) {
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), true));
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(endpointBeta2.getDatapath(), endpointBeta2.getPortNumber(), endpointAlpha1.getDatapath(), endpointAlpha1.getPortNumber(), true));
verify(carrier).islDefaultRulesDelete(endpointAlpha1, endpointBeta2);
verify(carrier).islDefaultRulesDelete(endpointBeta2, endpointAlpha1);
}
}
use of org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult in project open-kilda by telstra.
the class NetworkIslServiceTest method testResurrection.
private void testResurrection(IslReference reference, boolean shouldResurrect) {
final Endpoint alphaEnd = reference.getSource();
final Endpoint zetaEnd = reference.getDest();
reset(carrier);
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(alphaEnd.getDatapath(), alphaEnd.getPortNumber(), zetaEnd.getDatapath(), zetaEnd.getPortNumber(), true));
service.islDefaultRuleDeleted(reference, new RemoveIslDefaultRulesResult(zetaEnd.getDatapath(), zetaEnd.getPortNumber(), alphaEnd.getDatapath(), alphaEnd.getPortNumber(), true));
if (!shouldResurrect) {
verify(carrier).islRemovedNotification(eq(alphaEnd), eq(reference));
verify(carrier).islRemovedNotification(eq(zetaEnd), eq(reference));
verify(carrier).islChangedNotifyFlowMonitor(any(IslReference.class), eq(true));
}
verifyNoMoreInteractions(carrier);
}
Aggregations