diff options
author | Haddox, Anthony <ah0647@att.com> | 2019-04-30 08:50:45 -0700 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2019-04-30 20:22:05 +0000 |
commit | 555632a124f4996feb0198eae8237b2d86ca3da0 (patch) | |
tree | d56e9c7001873534726ed98e7a1a8da24eeff174 | |
parent | 1cc988317c1d60b45dc064e3924a64e121a73171 (diff) |
[CCSDK-1298] Add served-by field
Add served-by field to RPC responses and
output getRequestContent response.
Issue-ID: CCSDK-1298
Change-Id: Ic8c327dd1acc44aeab2c999851b22fdba5eed232
Signed-off-by: Haddox, Anthony <ah0647@att.com>
-rwxr-xr-x | grToolkit/model/src/main/yang/gr-toolkit.yang | 8 | ||||
-rwxr-xr-x | grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java | 19 |
2 files changed, 23 insertions, 4 deletions
diff --git a/grToolkit/model/src/main/yang/gr-toolkit.yang b/grToolkit/model/src/main/yang/gr-toolkit.yang index 8b22d666..cc21400a 100755 --- a/grToolkit/model/src/main/yang/gr-toolkit.yang +++ b/grToolkit/model/src/main/yang/gr-toolkit.yang @@ -93,6 +93,7 @@ module gr-toolkit{ output {
leaf status { type string; }
leaf message { type string; }
+ leaf served-by { type string; }
leaf site1-health { type string; }
leaf site2-health { type string; }
list members {
@@ -107,6 +108,7 @@ module gr-toolkit{ output {
leaf status { type string; }
leaf health { type string; }
+ leaf served-by { type string; }
}
}
@@ -116,6 +118,7 @@ module gr-toolkit{ output {
leaf status { type string; }
leaf health { type string; }
+ leaf served-by { type string; }
}
}
@@ -125,6 +128,7 @@ module gr-toolkit{ to determine if the entire site is in a healthy state.";
output {
leaf status { type string; }
+ leaf served-by { type string; }
list sites {
uses site;
}
@@ -136,6 +140,7 @@ module gr-toolkit{ "Returns the unique site identifier.";
output {
leaf status { type string; }
+ leaf served-by { type string; }
leaf id { type string; mandatory true; }
}
}
@@ -150,6 +155,7 @@ module gr-toolkit{ }
output {
leaf status { type string; }
+ leaf served-by { type string; }
}
}
@@ -163,6 +169,7 @@ module gr-toolkit{ }
output {
leaf status { type string; }
+ leaf served-by { type string; }
}
}
@@ -186,6 +193,7 @@ module gr-toolkit{ output {
leaf status { type string; }
leaf message { type string; }
+ leaf served-by { type string; }
}
}
}
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java index 4e121e34..39bc1618 100755 --- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java +++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java @@ -244,6 +244,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT DatabaseHealthOutputBuilder outputBuilder = new DatabaseHealthOutputBuilder(); outputBuilder.setStatus("200"); outputBuilder.setHealth(getDatabaseHealth()); + outputBuilder.setServedBy(member); return Futures.immediateFuture(RpcResultBuilder.<DatabaseHealthOutput>status(true).withResult(outputBuilder.build()).build()); } @@ -254,6 +255,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT AdminHealthOutputBuilder outputBuilder = new AdminHealthOutputBuilder(); outputBuilder.setStatus("200"); outputBuilder.setHealth(getAdminHealth()); + outputBuilder.setServedBy(member); return Futures.immediateFuture(RpcResultBuilder.<AdminHealthOutput>status(true).withResult(outputBuilder.build()).build()); } @@ -264,6 +266,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT HaltAkkaTrafficOutputBuilder outputBuilder = new HaltAkkaTrafficOutputBuilder(); outputBuilder.setStatus("200"); modifyIpTables(IpTables.ADD, input.getNodeInfo().toArray()); + outputBuilder.setServedBy(member); return Futures.immediateFuture(RpcResultBuilder.<HaltAkkaTrafficOutput>status(true).withResult(outputBuilder.build()).build()); } @@ -274,6 +277,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT ResumeAkkaTrafficOutputBuilder outputBuilder = new ResumeAkkaTrafficOutputBuilder(); outputBuilder.setStatus("200"); modifyIpTables(IpTables.DELETE, input.getNodeInfo().toArray()); + outputBuilder.setServedBy(member); return Futures.immediateFuture(RpcResultBuilder.<ResumeAkkaTrafficOutput>status(true).withResult(outputBuilder.build()).build()); } @@ -284,6 +288,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT SiteIdentifierOutputBuilder outputBuilder = new SiteIdentifierOutputBuilder(); outputBuilder.setStatus("200"); outputBuilder.setId(siteIdentifier); + outputBuilder.setServedBy(member); return Futures.immediateFuture(RpcResultBuilder.<SiteIdentifierOutput>status(true).withResult(outputBuilder.build()).build()); } @@ -292,6 +297,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT public ListenableFuture<RpcResult<FailoverOutput>> failover(FailoverInput input) { log.info("{}:failover invoked.", APP_NAME); FailoverOutputBuilder outputBuilder = new FailoverOutputBuilder(); + outputBuilder.setServedBy(member); if(siteConfiguration != SiteConfiguration.GEO) { log.info("Cannot failover non-GEO site."); outputBuilder.setMessage("Failover aborted. This is not a GEO configuration."); @@ -476,6 +482,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT outputBuilder.setSite2Health(FAULTY); } + outputBuilder.setServedBy(member); RpcResult<ClusterHealthOutput> rpcResult = RpcResultBuilder.<ClusterHealthOutput>status(true).withResult(outputBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } @@ -589,6 +596,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT } } + outputBuilder.setServedBy(member); RpcResult<SiteHealthOutput> rpcResult = RpcResultBuilder.<SiteHealthOutput>status(true).withResult(outputBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } @@ -836,9 +844,9 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT log.info("Determining database health..."); try { Connection connection = dbLib.getConnection(); - log.info("DBLib isActive(): {}", dbLib.isActive()); - log.info("DBLib isReadOnly(): {}", connection.isReadOnly()); - log.info("DBLib isClosed(): {}", connection.isClosed()); + log.debug("DBLib isActive(): {}", dbLib.isActive()); + log.debug("DBLib isReadOnly(): {}", connection.isReadOnly()); + log.debug("DBLib isClosed(): {}", connection.isClosed()); if(!dbLib.isActive() || connection.isClosed() || connection.isReadOnly()) { log.warn("Database is FAULTY"); connection.close(); @@ -876,7 +884,10 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT } bufferedReader.close(); connection.disconnect(); - return content.toString(); + + String response = content.toString(); + log.debug("getRequestContent(): Response:\n{}", response); + return response; } private int getRequestStatus(String path, HttpMethod method) throws IOException { |