Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] tools/sppc: add launcher for suricata
Date: Tue, 27 Aug 2019 18:51:53 +0900	[thread overview]
Message-ID: <20190827095153.27470-1-yasufum.o@gmail.com> (raw)

From: Yasufumi Ogawa <yasufum.o@gmail.com>

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>
---
 tools/sppc/app/suricata.py | 60 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100755 tools/sppc/app/suricata.py

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()
-- 
2.17.1


                 reply	other threads:[~2019-08-27  9:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190827095153.27470-1-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).