Skip to content

Commit 531073a

Browse files
committed
nso-nipap: Use recrusive delete when removing a prefix
1 parent a55701c commit 531073a

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

nso-nipap/nso-nipap/src/java/src/net/spritelink/nsonipap/ConfigCdbSub.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected void removePrefixFromNIPAP(String prefixPath) throws ConfException, IO
313313

314314
try {
315315
Prefix p = Prefix.get(nipapCon, p_id);
316-
p.remove(nipapCon);
316+
p.remove(nipapCon, true);
317317
} catch (JnipapException e) {
318318
LOGGER.error("Unable to remove prefix from NIPAP: " + e.getMessage(),e);
319319
throw e;
@@ -469,27 +469,15 @@ else if (req.op == Operation.ALLOCATE && req.t == Type.FromPrefixRequest){
469469
* Deallocate Prefix
470470
*
471471
*/
472-
else if (req.op == Operation.DEALLOCATE &&
473-
(req.t == Type.Request)) {
472+
else if (req.op == Operation.DEALLOCATE && (req.t == Type.Request)) {
474473

475-
String path = req.path + "/" + nipap._from_prefix_request_ ;
474+
String path = req.path + "/" + nipap._response_;
476475

477-
NavuContext context = new NavuContext(maapi);
478-
int to = context.startPreCommitRunningTrans();
476+
LOGGER.info("Deallocate Prefix (" + path + ")");
479477

480-
NavuNode request = KeyPath2NavuNode.getNode(req.path, context);
478+
removePrefixFromNIPAP(path);
481479

482-
for (NavuContainer prefix_key : request.list(nipap._from_prefix_request).elements()){
483-
removePrefixFromNIPAP(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
484-
removeResponseFromCDB(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
485-
}
486-
try {
487-
removePrefixFromNIPAP(req.path + "/" + nipap._response_);
488-
} catch (Exception e ){
489-
continue;
490-
}
491-
removeResponseFromCDB(req.path + "/" + nipap._response_);
492-
context.finishClearTrans();
480+
removeResponseFromCDB(path);
493481
}
494482
/*
495483
* Deallocate from-prefix prefix

0 commit comments

Comments
 (0)