Ping/pong charm

This is the Juju charm layer to build the pingpong charm

Change-Id: I732746a53ce6db0faa3e7e528cb60a60e0296afe
Signed-off-by: Adam Israel <adam.israel@canonical.com>
diff --git a/layers/pingpong/actions/get-rate b/layers/pingpong/actions/get-rate
new file mode 100755
index 0000000..959b3e9
--- /dev/null
+++ b/layers/pingpong/actions/get-rate
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.get-rate')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/get-server b/layers/pingpong/actions/get-server
new file mode 100755
index 0000000..52e0089
--- /dev/null
+++ b/layers/pingpong/actions/get-server
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.get-server')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/get-state b/layers/pingpong/actions/get-state
new file mode 100755
index 0000000..446e8d7
--- /dev/null
+++ b/layers/pingpong/actions/get-state
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.get-state')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/get-stats b/layers/pingpong/actions/get-stats
new file mode 100755
index 0000000..086afc2
--- /dev/null
+++ b/layers/pingpong/actions/get-stats
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.get-stats')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/set-rate b/layers/pingpong/actions/set-rate
new file mode 100755
index 0000000..8fb723e
--- /dev/null
+++ b/layers/pingpong/actions/set-rate
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.set-rate')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/set-server b/layers/pingpong/actions/set-server
new file mode 100755
index 0000000..d1e908f
--- /dev/null
+++ b/layers/pingpong/actions/set-server
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.set-server')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/start-ping b/layers/pingpong/actions/start-ping
new file mode 100755
index 0000000..dee1ce1
--- /dev/null
+++ b/layers/pingpong/actions/start-ping
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.start-ping')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))
diff --git a/layers/pingpong/actions/stop-ping b/layers/pingpong/actions/stop-ping
new file mode 100755
index 0000000..0a10695
--- /dev/null
+++ b/layers/pingpong/actions/stop-ping
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.stop-ping')
+
+try:
+    main()
+except Exception as e:
+    action_fail(repr(e))