use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.PortsKey in project netvirt by opendaylight.
the class NeutronFloatingToFixedIpMappingChangeListener method removeRouterPortsOrPortsNode.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeRouterPortsOrPortsNode(String routerName, InstanceIdentifier.InstanceIdentifierBuilder<RouterPorts> routerPortsIdentifierBuilder, List<Ports> portsList, String fixedNeutronPortName, boolean isLockAcquired) {
String lockName = null;
try {
if (portsList.size() == 1) {
// remove entire routerPorts node
lockName = routerName;
isLockAcquired = routerLock.tryLock(lockName, LOCK_WAIT_TIME, TimeUnit.SECONDS);
LOG.debug("removing routerPorts node: {} ", routerName);
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, routerPortsIdentifierBuilder.build());
} else {
// remove entire ports node under this routerPorts node
lockName = fixedNeutronPortName;
isLockAcquired = routerLock.tryLock(lockName, LOCK_WAIT_TIME, TimeUnit.SECONDS);
LOG.debug("removing ports node {} under routerPorts node {}", fixedNeutronPortName, routerName);
InstanceIdentifier.InstanceIdentifierBuilder<Ports> portsIdentifierBuilder = routerPortsIdentifierBuilder.child(Ports.class, new PortsKey(fixedNeutronPortName));
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, portsIdentifierBuilder.build());
}
} catch (Exception e) {
LOG.error("Failure in deletion of routerPorts node {}", routerName, e);
} finally {
if (isLockAcquired) {
routerLock.unlock(lockName);
}
}
}
Aggregations