Skip to content

Commit

Permalink
nso-nipap: Use recrusive delete when removing a prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
fredsod committed Jan 2, 2017
1 parent a55701c commit 531073a
Showing 1 changed file with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ protected void removePrefixFromNIPAP(String prefixPath) throws ConfException, IO

try {
Prefix p = Prefix.get(nipapCon, p_id);
p.remove(nipapCon);
p.remove(nipapCon, true);
} catch (JnipapException e) {
LOGGER.error("Unable to remove prefix from NIPAP: " + e.getMessage(),e);
throw e;
Expand Down Expand Up @@ -469,27 +469,15 @@ else if (req.op == Operation.ALLOCATE && req.t == Type.FromPrefixRequest){
* Deallocate Prefix
*
*/
else if (req.op == Operation.DEALLOCATE &&
(req.t == Type.Request)) {
else if (req.op == Operation.DEALLOCATE && (req.t == Type.Request)) {

String path = req.path + "/" + nipap._from_prefix_request_ ;
String path = req.path + "/" + nipap._response_;

NavuContext context = new NavuContext(maapi);
int to = context.startPreCommitRunningTrans();
LOGGER.info("Deallocate Prefix (" + path + ")");

NavuNode request = KeyPath2NavuNode.getNode(req.path, context);
removePrefixFromNIPAP(path);

for (NavuContainer prefix_key : request.list(nipap._from_prefix_request).elements()){
removePrefixFromNIPAP(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
removeResponseFromCDB(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
}
try {
removePrefixFromNIPAP(req.path + "/" + nipap._response_);
} catch (Exception e ){
continue;
}
removeResponseFromCDB(req.path + "/" + nipap._response_);
context.finishClearTrans();
removeResponseFromCDB(path);
}
/*
* Deallocate from-prefix prefix
Expand Down

0 comments on commit 531073a

Please sign in to comment.