summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasufumi Ogawa <yasufum.o@gmail.com>2019-08-27 18:51:53 +0900
committerYasufumi Ogawa <yasufum.o@gmail.com>2019-08-27 17:02:17 +0700
commite6dd26a1aa6a24268430f2de85b3dbe7a0eb3f6f (patch)
treee9ea7120aa51ded27769a22576f5fce25d0c9a26
parentdc6a477e17b6d23460de30f29445de6656fd95e3 (diff)
downloadspp-e6dd26a1aa6a24268430f2de85b3dbe7a0eb3f6f.zip
spp-e6dd26a1aa6a24268430f2de85b3dbe7a0eb3f6f.tar.gz
spp-e6dd26a1aa6a24268430f2de85b3dbe7a0eb3f6f.tar.xz
tools/sppc: add launcher for suricata
This update is add launcher script for suricata. Here is an example of usage. Suricata is expected from command line, so this launcher is jsut to start bash and you need to suricata itself from bash. You notice that you need to upload your suricata config before run launcher. $ docker cp your.cnf CONTAINER_ID:/path/to/conf/your.conf $ ./suricata.py -d 1,2 -fg -ci sppc/suricata-ubuntu2:latest # suricata --dpdk=/path/to/config Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
-rwxr-xr-xtools/sppc/app/suricata.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/sppc/app/suricata.py b/tools/sppc/app/suricata.py
new file mode 100755
index 0000000..5bbff5f
--- /dev/null
+++ b/tools/sppc/app/suricata.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+
+import argparse
+import os
+import subprocess
+import sys
+
+work_dir = os.path.dirname(__file__)
+sys.path.append(work_dir + '/..')
+from conf import env
+from lib import app_helper
+from lib import common
+
+target_name = 'suricata'
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(
+ description="Launcher for suricata container")
+
+ parser = app_helper.add_eal_args(parser)
+ parser = app_helper.add_appc_args(parser)
+ parser = app_helper.add_sppc_args(parser)
+ return parser.parse_args()
+
+
+def main():
+ args = parse_args()
+
+ # Setup for vhost devices with given device IDs.
+ dev_ids_list = app_helper.dev_ids_to_list(args.dev_ids)
+ sock_files = app_helper.sock_files(dev_ids_list)
+
+ # Setup docker command.
+ docker_cmd = ['sudo', 'docker', 'run', '\\']
+ docker_opts = app_helper.setup_docker_opts(
+ args, target_name, sock_files)
+
+ cmd_path = '/bin/bash'
+
+ cmd = [cmd_path, '\\']
+
+ cmds = docker_cmd + docker_opts + cmd
+ if cmds[-1] == '\\':
+ cmds.pop()
+ common.print_pretty_commands(cmds)
+
+ if args.dry_run is True:
+ exit()
+
+ # Remove delimiters for print_pretty_commands().
+ while '\\' in cmds:
+ cmds.remove('\\')
+ subprocess.call(cmds)
+
+
+if __name__ == '__main__':
+ main()