Skip to content

Commit

Permalink
nso-nipap: Code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fredsod committed Sep 20, 2016
1 parent dcbe3ac commit bbd8848
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ protected Prefix getPrefixAttributes(Prefix oldPrefix, String attributePath) thr
if (maapi.exists(th, attributePath + "/" + nipap._customer_id_)) {
ConfValue rCustomer_id = maapi.getElem(th, attributePath + "/" + nipap._customer_id_);
p.customer_id = String.valueOf(rCustomer_id);
}else {
} else {
p.customer_id = null;
}
if (maapi.exists(th, attributePath + "/" + nipap._description_)) {
ConfValue rDescription = maapi.getElem(th, attributePath + "/" + nipap._description_);
p.description = String.valueOf(rDescription);
}else {
} else {
p.description = null;
}
if (maapi.exists(th, attributePath + "/" + nipap._node_)) {
ConfValue rNode = maapi.getElem(th, attributePath + "/" + nipap._node_);
p.node = String.valueOf(rNode);
}else {
} else {
p.node = null;
}
if (maapi.exists(th, attributePath + "/" + nipap._order_id_)) {
ConfValue rOrder_id = maapi.getElem(th, attributePath + "/" + nipap._customer_id_);
p.order_id = String.valueOf(rOrder_id);
}else {
} else {
p.order_id = null;
}

Expand Down Expand Up @@ -207,22 +207,22 @@ protected void writeResponse(Prefix prefix, String responsePath) throws ConfExce
ConfUInt32 prefixIdValue = new ConfUInt32(prefix.id);
wsess.setElem(prefixIdValue, responsePath + "/" + nipap._prefix_id_);

if(prefix.customer_id != null){
if (prefix.customer_id != null){
ConfBuf customerIdValue = new ConfBuf(prefix.customer_id);
wsess.setElem(customerIdValue, responsePath + "/" + nipap._customer_id_);
}

if(prefix.description != null){
if (prefix.description != null){
ConfBuf descriptionValue = new ConfBuf(prefix.description);
wsess.setElem(descriptionValue, responsePath + "/" + nipap._description_);
}

if(prefix.node != null){
if (prefix.node != null){
ConfBuf nodeValue = new ConfBuf(prefix.node);
wsess.setElem(nodeValue, responsePath + "/" + nipap._node_);
}

if(prefix.order_id != null){
if (prefix.order_id != null){
ConfBuf orderIdValue = new ConfBuf(prefix.order_id);
wsess.setElem(orderIdValue, responsePath + "/" + nipap._order_id_);
}
Expand Down Expand Up @@ -388,7 +388,7 @@ public void run() {
poolSpec.put("name", poolName);
List poolRes = Pool.list(nipapCon, poolSpec);

if(poolRes.size() < 1){
if (poolRes.size() != 1){
writeError(req.path.toString(), "Nipap pool not found");
continue;
}
Expand Down Expand Up @@ -416,7 +416,7 @@ public void run() {

// Request prefix from prefix
String fromPrefixPath = req.path + "/" + nipap._from_prefix_request_;
if(maapi.exists(th, fromPrefixPath)){
if (maapi.exists(th, fromPrefixPath)){
MaapiCursor pfx_cur = maapi.newCursor(th, fromPrefixPath);
ConfKey pfx = null;

Expand Down Expand Up @@ -464,7 +464,7 @@ else if (req.op == Operation.DEALLOCATE &&

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

for(NavuContainer prefix_key : request.list(nipap._from_prefix_request).elements()){
for (NavuContainer prefix_key : request.list(nipap._from_prefix_request).elements()){
removePrefix(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
removeResponse(path + prefix_key.leaf(nipap._name_).toKey() + "/" + nipap._response_);
}
Expand Down Expand Up @@ -576,17 +576,17 @@ public DiffIterateResultFlag iterate(

case MOP_CREATED: {
// new request
if(kp[1].toString().equals("nipap:request") &&
kp.length == 6){
r.pool_key = (ConfKey)kp[2];
r.request_key = (ConfKey)kp[0];
r.t = Type.Request;
r.op = Operation.ALLOCATE;
reqs.add(r);
//the request is new, we dont need to look at children
return DiffIterateResultFlag.ITER_CONTINUE;
if (kp[1].toString().equals("nipap:request") &&
kp.length == 6){
r.pool_key = (ConfKey)kp[2];
r.request_key = (ConfKey)kp[0];
r.t = Type.Request;
r.op = Operation.ALLOCATE;
reqs.add(r);
//the request is new, we dont need to look at children
return DiffIterateResultFlag.ITER_CONTINUE;
}
else if(kp[1].toString().equals("nipap:from-prefix-request") &&
else if (kp[1].toString().equals("nipap:from-prefix-request") &&
kp.length == 8){
r.prefix_key = (ConfKey)kp[0];
r.request_key = (ConfKey)kp[2];
Expand All @@ -600,7 +600,7 @@ else if(kp[1].toString().equals("nipap:from-prefix-request") &&
break;
}
case MOP_DELETED: {
if(kp[1].toString().equals("nipap:request") &&
if (kp[1].toString().equals("nipap:request") &&
kp.length == 6){
r.pool_key = (ConfKey)kp[2];
r.request_key = (ConfKey)kp[0];
Expand All @@ -613,7 +613,7 @@ else if(kp[1].toString().equals("nipap:from-prefix-request") &&
break;
}
case MOP_VALUE_SET: {
if(kp[1].toString().equals("nipap:attributes") &&
if (kp[1].toString().equals("nipap:attributes") &&
kp.length == 8) {
r.pool_key = (ConfKey)kp[4];
r.request_key = (ConfKey)kp[2];
Expand All @@ -622,18 +622,18 @@ else if(kp[1].toString().equals("nipap:from-prefix-request") &&

boolean found = false;

for( Request req : reqs){
for (Request req : reqs){

if(req.t.equals(Type.Request) &&
if (req.t.equals(Type.Request) &&
req.request_key.equals(r.request_key)) {
found = true;
}
}
if(found == false){
if (found == false){
reqs.add(r);
}

} else if(kp[3].toString().equals("nipap:from-prefix-request") &&
} else if (kp[3].toString().equals("nipap:from-prefix-request") &&
kp.length == 10){

r.pool_key = (ConfKey)kp[6];
Expand All @@ -644,14 +644,14 @@ else if(kp[1].toString().equals("nipap:from-prefix-request") &&

boolean found = false;

for( Request req : reqs){
if(req.t.equals(Type.FromPrefixRequest) &&
for (Request req : reqs){
if (req.t.equals(Type.FromPrefixRequest) &&
req.request_key.equals(r.request_key) &&
req.prefix_key.equals(r.prefix_key)) {
found = true;
}
}
if(found == false){
if (found == false){
LOGGER.info("add " + r.prefix_key);
reqs.add(r);
}
Expand Down

0 comments on commit bbd8848

Please sign in to comment.