Search in sources :

Example 1 with RemoveIslDefaultRulesResult

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()));
}
Also used : SwitchOperationException(org.openkilda.floodlight.error.SwitchOperationException) UnsupportedSwitchOperationException(org.openkilda.floodlight.error.UnsupportedSwitchOperationException) RemoveIslDefaultRulesResult(org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult) InfoMessage(org.openkilda.messaging.info.InfoMessage) DatapathId(org.projectfloodlight.openflow.types.DatapathId) RemoveIslDefaultRulesCommand(org.openkilda.messaging.payload.switches.RemoveIslDefaultRulesCommand)

Example 2 with RemoveIslDefaultRulesResult

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);
    }
}
Also used : Isl(org.openkilda.model.Isl) IslReference(org.openkilda.wfm.share.model.IslReference) RemoveIslDefaultRulesResult(org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult)

Example 3 with RemoveIslDefaultRulesResult

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);
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslReference(org.openkilda.wfm.share.model.IslReference) RemoveIslDefaultRulesResult(org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult)

Aggregations

RemoveIslDefaultRulesResult (org.openkilda.messaging.info.discovery.RemoveIslDefaultRulesResult)3 IslReference (org.openkilda.wfm.share.model.IslReference)2 SwitchOperationException (org.openkilda.floodlight.error.SwitchOperationException)1 UnsupportedSwitchOperationException (org.openkilda.floodlight.error.UnsupportedSwitchOperationException)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 RemoveIslDefaultRulesCommand (org.openkilda.messaging.payload.switches.RemoveIslDefaultRulesCommand)1 Isl (org.openkilda.model.Isl)1 Endpoint (org.openkilda.wfm.share.model.Endpoint)1 DatapathId (org.projectfloodlight.openflow.types.DatapathId)1