aboutsummaryrefslogtreecommitdiffstats
path: root/grToolkit/provider/src/main/java
diff options
context:
space:
mode:
authorHaddox, Anthony <ah0647@att.com>2019-01-29 08:50:09 -0800
committerHaddox, Anthony <ah0647@att.com>2019-01-29 08:52:06 -0800
commitce531cc96ecba4d48852ad36fe9d1ab461240596 (patch)
tree65ecc304cad722a6dfedfa9e4231d54ad6a87f9c /grToolkit/provider/src/main/java
parent4fc631ccf42b2eccd506a94c955cfed5aae40e7f (diff)
Add Isolation Toggle
Add extra input option that allows user to toggle the ODL isolation step in the failover process. Change-Id: I1fdfd4bf5cf2484af8ce67f9c91d0111134b762c Issue-ID: CCSDK-1012 Signed-off-by: Haddox, Anthony <ah0647@att.com>
Diffstat (limited to 'grToolkit/provider/src/main/java')
-rwxr-xr-xgrToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java82
1 files changed, 42 insertions, 40 deletions
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java
index 249640af..f0a104de 100755
--- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java
+++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java
@@ -384,49 +384,51 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
return Futures.immediateFuture(RpcResultBuilder.<FailoverOutput>status(true).withResult(outputBuilder.build()).build());
}
- // Halt akka traffic
- log.info("Halting Akka traffic...");
- for(ClusterActor actor : standbySite) {
- try {
- log.info("Halting Akka traffic for: " + actor.getNode());
- // Build JSON with activeSite actor.getNode() and actor.getAkkaPort();
- JSONObject akkaInput = new JSONObject();
- JSONObject inputBlock = new JSONObject();
- JSONArray votingStateArray = new JSONArray();
- JSONObject nodeInfo;
- for(ClusterActor node : activeSite) {
- nodeInfo = new JSONObject();
- nodeInfo.put("node", node.getNode());
- nodeInfo.put("port", node.getAkkaPort());
- votingStateArray.put(nodeInfo);
+ if(Boolean.parseBoolean(input.getIsolate())) {
+ log.info("Halting Akka traffic...");
+ for(ClusterActor actor : standbySite) {
+ try {
+ log.info("Halting Akka traffic for: " + actor.getNode());
+ // Build JSON with activeSite actor.getNode() and actor.getAkkaPort();
+ JSONObject akkaInput = new JSONObject();
+ JSONObject inputBlock = new JSONObject();
+ JSONArray votingStateArray = new JSONArray();
+ JSONObject nodeInfo;
+ for(ClusterActor node : activeSite) {
+ nodeInfo = new JSONObject();
+ nodeInfo.put("node", node.getNode());
+ nodeInfo.put("port", node.getAkkaPort());
+ votingStateArray.put(nodeInfo);
+ }
+ inputBlock.put("node-info", votingStateArray);
+ akkaInput.put("input", inputBlock);
+ getRequestContent(HTTP_PROTOCOL + actor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:halt-akka-traffic", HttpMethod.Post, akkaInput.toString());
+ } catch(IOException e) {
+ log.error("Could not halt Akka traffic for: " + actor.getNode(), e);
}
- inputBlock.put("node-info", votingStateArray);
- akkaInput.put("input", inputBlock);
- getRequestContent(HTTP_PROTOCOL + actor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:halt-akka-traffic", HttpMethod.Post, akkaInput.toString());
- } catch(IOException e) {
- log.error("Could not halt Akka traffic for: " + actor.getNode(), e);
}
- }
- // Set unreachable
- log.info("Setting site unreachable...");
- JSONObject jolokiaInput = new JSONObject();
- jolokiaInput.put("type", "EXEC");
- jolokiaInput.put("mbean", "akka:type=Cluster");
- jolokiaInput.put("operation", "down");
- JSONArray arguments = new JSONArray();
- for(ClusterActor actor : activeSite) {
- // Build Jolokia input
- //TODO: May need to change from akka port to actor.getAkkaPort()
- arguments.put("akka.tcp://opendaylight-cluster-data@" + actor.getNode() + ":" + properties.getProperty("controller.port.akka"));
- }
- jolokiaInput.put("arguments", arguments);
- log.debug(jolokiaInput.toString(2));
- try {
- log.info("Setting nodes unreachable");
- getRequestContent(HTTP_PROTOCOL + standbySite.get(0).getNode() + ":" + port + "/jolokia", HttpMethod.Post, jolokiaInput.toString());
- } catch(IOException e) {
- log.error("Error setting nodes unreachable", e);
+ if(Boolean.parseBoolean(input.getDownUnreachable())) {
+ log.info("Setting site unreachable...");
+ JSONObject jolokiaInput = new JSONObject();
+ jolokiaInput.put("type", "EXEC");
+ jolokiaInput.put("mbean", "akka:type=Cluster");
+ jolokiaInput.put("operation", "down");
+ JSONArray arguments = new JSONArray();
+ for(ClusterActor actor : activeSite) {
+ // Build Jolokia input
+ //TODO: May need to change from akka port to actor.getAkkaPort()
+ arguments.put("akka.tcp://opendaylight-cluster-data@" + actor.getNode() + ":" + properties.getProperty("controller.port.akka"));
+ }
+ jolokiaInput.put("arguments", arguments);
+ log.debug(jolokiaInput.toString(2));
+ try {
+ log.info("Setting nodes unreachable");
+ getRequestContent(HTTP_PROTOCOL + standbySite.get(0).getNode() + ":" + port + "/jolokia", HttpMethod.Post, jolokiaInput.toString());
+ } catch(IOException e) {
+ log.error("Error setting nodes unreachable", e);
+ }
+ }
}
log.info(appName + ":failover complete.");