Search in sources :

Example 1 with ModifiedNodeDoesNotExistException

use of org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException in project netvirt by opendaylight.

the class FibUtil method removeFibEntry.

@SuppressWarnings("checkstyle:IllegalCatch")
public void removeFibEntry(String rd, String prefix, String eventSource, TypedWriteTransaction<Configuration> writeConfigTxn) {
    if (rd == null || rd.isEmpty()) {
        LOG.error("Prefix {} not associated with vpn", prefix);
        return;
    }
    try {
        LOG.debug("removeFibEntry: Removing fib entry with destination prefix {} from vrf table for rd {}", prefix, rd);
        InstanceIdentifier.InstanceIdentifierBuilder<VrfEntry> idBuilder = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(prefix));
        InstanceIdentifier<VrfEntry> vrfEntryId = idBuilder.build();
        if (writeConfigTxn != null) {
            writeConfigTxn.delete(vrfEntryId);
        } else {
            MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfEntryId);
        }
        LOG.error("removeFibEntry: Removed Fib Entry rd {} prefix {} source {} ", rd, prefix, eventSource);
    } catch (RuntimeException e) {
        if (e.getCause() instanceof ModifiedNodeDoesNotExistException) {
            LOG.warn("removeFibEntry: Fib Entry prefix {} rd {} source {} is already deleted from the " + "vrf table.", prefix, rd, eventSource);
        } else {
            LOG.error("removeFibEntry: Unable to remove Fib Entry for rd {} prefix {} source {} ", rd, prefix, eventSource);
        }
    }
}
Also used : ModifiedNodeDoesNotExistException(org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey)

Aggregations

VrfTables (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables)1 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)1 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)1 VrfEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1 ModifiedNodeDoesNotExistException (org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException)1