diff options
author | Haddox, Anthony <ah0647@att.com> | 2019-01-29 08:50:09 -0800 |
---|---|---|
committer | Haddox, Anthony <ah0647@att.com> | 2019-01-29 08:52:06 -0800 |
commit | ce531cc96ecba4d48852ad36fe9d1ab461240596 (patch) | |
tree | 65ecc304cad722a6dfedfa9e4231d54ad6a87f9c /grToolkit | |
parent | 4fc631ccf42b2eccd506a94c955cfed5aae40e7f (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')
-rwxr-xr-x | grToolkit/model/src/main/yang/gr-toolkit.yang | 12 | ||||
-rwxr-xr-x | grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java | 82 |
2 files changed, 52 insertions, 42 deletions
diff --git a/grToolkit/model/src/main/yang/gr-toolkit.yang b/grToolkit/model/src/main/yang/gr-toolkit.yang index 951201c5e..8b22d666a 100755 --- a/grToolkit/model/src/main/yang/gr-toolkit.yang +++ b/grToolkit/model/src/main/yang/gr-toolkit.yang @@ -142,7 +142,7 @@ module gr-toolkit{ rpc halt-akka-traffic {
description
- "Invokes a utility script to halt traffic to the akka port.";
+ "Executes IP Tables commands to halt traffic to the akka port.";
input {
list node-info {
uses node;
@@ -155,7 +155,7 @@ module gr-toolkit{ rpc resume-akka-traffic {
description
- "Invokes a utility script to resume traffic to the akka port.";
+ "Executes IP Tables commands to resume traffic to the akka port.";
input {
list node-info {
uses node;
@@ -174,6 +174,14 @@ module gr-toolkit{ type string;
default "false";
}
+ leaf isolate {
+ type string;
+ default "false";
+ }
+ leaf downUnreachable {
+ type string;
+ default "false";
+ }
}
output {
leaf status { type string; }
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 249640afa..f0a104de8 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."); |