aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/moon_router/moon_secrouter/api/generic.py
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2017-07-19 10:23:25 +0200
committerWuKong <rebirthmonkey@gmail.com>2017-07-19 10:23:25 +0200
commitffd694ebadb1d3b4e140104f9f0a81837c0e7258 (patch)
treedcd2affe2d8963ab0e0ba4b3cdc85fbd2b30b209 /moonv4/moon_router/moon_secrouter/api/generic.py
parent2513cb55eeea516fec50f2fa781ce778eeae1059 (diff)
add pip package
Change-Id: I8b4d3fa24f6ad7c7f9bb5dc93279c4a48bb0fe86 Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonv4/moon_router/moon_secrouter/api/generic.py')
-rw-r--r--moonv4/moon_router/moon_secrouter/api/generic.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/moonv4/moon_router/moon_secrouter/api/generic.py b/moonv4/moon_router/moon_secrouter/api/generic.py
new file mode 100644
index 00000000..d066f715
--- /dev/null
+++ b/moonv4/moon_router/moon_secrouter/api/generic.py
@@ -0,0 +1,46 @@
+# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
+# This software is distributed under the terms and conditions of the 'Apache-2.0'
+# license which can be found in the file 'LICENSE' in this package distribution
+# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
+from moon_utilities.security_functions import call
+
+
+class Status(object):
+ """
+ Retrieve the current status of all components.
+ """
+
+ __version__ = "0.1.0"
+
+ def __get_status(self, ctx, args={}):
+ return {"status": "Running"}
+
+ def get_status(self, ctx, args={}):
+ status = dict()
+ if "component_id" in ctx and ctx["component_id"] == "security_router":
+ return {"security_router": self.__get_status(ctx, args)}
+ elif "component_id" in ctx and ctx["component_id"]:
+ # TODO (dthom): check if component exist
+ status[ctx["component_id"]] = call(ctx["component_id"], ctx, "get_status", args=args)
+ else:
+ # TODO (dthom): must get the status of all containers
+ status["orchestrator"] = call("orchestrator", ctx, "get_status", args=args)
+ status["security_router"] = self.__get_status(ctx, args)
+ return status
+
+
+class Logs(object):
+ """
+ Retrieve the current status of all components.
+ """
+
+ __version__ = "0.1.0"
+
+ def get_logs(self, ctx, args={}):
+ logs = dict()
+ logs["orchestrator"] = call("orchestrator", ctx, "get_logs", args=args)
+ # TODO (dthom): must get the logs of all containers
+ logs["security_router"] = {"error": "Not implemented", "ctx": ctx, "args": args}
+ return logs
+
+