Skip to content

Commit

Permalink
Closes-Bug: #1689740
Browse files Browse the repository at this point in the history
Before doing a PUT on prouter config while adding bgp_router_refs,
do a config diff and push the delta config.

Change-Id: I027b98c645f1f9a63ad5890ff8399c4b2f0fdcf8
  • Loading branch information
biswajit-mandal committed Jun 27, 2017
1 parent fac105a commit 27b874c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
17 changes: 13 additions & 4 deletions webroot/config/infra/bgp/api/admin.api.js
Expand Up @@ -368,8 +368,12 @@ function updatePhysicalRouters (error,appData,bgpFqName,prouterParams, callback)
callback(error, prouterJSON);
return;
}
prouterJSON["physical-router"]["bgp_router_refs"] = [];
configApiServer.apiPut(url, prouterJSON, appData, function (error, data) {
var newConfigJSON = commonUtils.cloneObj(prouterJSON);
newConfigJSON["physical-router"]["bgp_router_refs"] = [];
var deltaConfig = jsonDiff.getConfigJSONDiff('physical-router',
prouterJSON,
newConfigJSON);
configApiServer.apiPut(url, deltaConfig, appData, function (error, data) {
if (error) {
callback(error, data);
return;
Expand All @@ -395,9 +399,14 @@ function updateNewProuter(newProuter,bgpFqName,appData, callback)
callback(error,prouterJSON);
return;
} else {
var newConfigJSON = commonUtils.cloneObj(prouterJSON);
var bgpRef = [{"to":bgpFqName}];
prouterJSON["physical-router"]["bgp_router_refs"] = bgpRef;
configApiServer.apiPut(url, prouterJSON, appData, function (error,data) {
newConfigJSON["physical-router"]["bgp_router_refs"] = [];
newConfigJSON["physical-router"]["bgp_router_refs"] = bgpRef;
var deltaConfig = jsonDiff.getConfigJSONDiff('physical-router',
prouterJSON,
newConfigJSON);
configApiServer.apiPut(url, deltaConfig, appData, function (error,data) {
callback(error,data);
}, bgpHeader);
}
Expand Down
8 changes: 7 additions & 1 deletion webroot/config/networking/networks/api/vnconfig.api.js
Expand Up @@ -581,6 +581,7 @@ function updatePhysicalRouters (mode, newPRoutersUUIDS,error,newVnData,
}
//Remove the refs to this VN from the current Physical Routers
//Add the refs to this VN for the new Physical Routers
var oldPRDetails = commonUtils.cloneObj(results);
for(var i=0; i < results.length; i++){
var currVns = results[i]['physical-router']['virtual_network_refs'];
currVns = (currVns == null)? [] : currVns;
Expand All @@ -604,8 +605,13 @@ function updatePhysicalRouters (mode, newPRoutersUUIDS,error,newVnData,
var dataObjArr = [];
for(i = 0; i < results.length; i++) {
reqUrl = '/physical-router/' + results[i]['physical-router']['uuid'];
var deltaConfig = {};
deltaConfig =
jsonDiff.getConfigJSONDiff('physical-router',
oldPRDetails[i],
results[i]);
commonUtils.createReqObj(dataObjArr, reqUrl, global.HTTP_REQUEST_PUT,
results[i], null, null, appData);
deltaConfig, null, null, appData);
}
async.map(dataObjArr,
commonUtils.getAPIServerResponse(configApiServer.apiPut, false),
Expand Down

0 comments on commit 27b874c

Please sign in to comment.