From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw0808.ocn.ad.jp (mogw0808.ocn.ad.jp [153.149.234.9]) by dpdk.org (Postfix) with ESMTP id 78C8B1D8CD for ; Fri, 15 Jun 2018 10:38:13 +0200 (CEST) Received: from mf-smf-ucb031c2 (mf-smf-ucb031c2.ocn.ad.jp [153.153.66.201]) by mogw0808.ocn.ad.jp (Postfix) with ESMTP id 0E107C00247; Fri, 15 Jun 2018 17:38:12 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb026 ([153.149.142.100]) by mf-smf-ucb031c2 with ESMTP id TkFIf3jn8NKjzTkFIfudDe; Fri, 15 Jun 2018 17:38:12 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.166]) by ntt.pod01.mv-mta-ucb026 with id yweB1x00U3c2f7501weBSC; Fri, 15 Jun 2018 08:38:12 +0000 Received: from localhost.localdomain (p5164-ipngn8501marunouchi.tokyo.ocn.ne.jp [153.214.228.164]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Fri, 15 Jun 2018 17:38:11 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: ferruh.yigit@intel.com, spp@dpdk.org Cc: Yasufumi Ogawa Date: Fri, 15 Jun 2018 17:37:52 +0900 Message-Id: <20180615083754.20220-14-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615083754.20220-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20180615083754.20220-1-ogawa.yasufumi@lab.ntt.co.jp> Subject: [spp] [PATCH 13/15] tools/sppc: add helloworld app continer X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2018 08:38:13 -0000 From: Yasufumi Ogawa Signed-off-by: Yasufumi Ogawa --- tools/sppc/app/helloworld.py | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 tools/sppc/app/helloworld.py diff --git a/tools/sppc/app/helloworld.py b/tools/sppc/app/helloworld.py new file mode 100755 index 0000000..fada61e --- /dev/null +++ b/tools/sppc/app/helloworld.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 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 = 'dpdk' + + +def parse_args(): + parser = argparse.ArgumentParser( + description="Launcher for l2fwd application container") + + parser = app_helper.add_eal_args(parser) + parser = app_helper.add_appc_args(parser) + + # No application specific args for helloworld + + parser = app_helper.add_sppc_args(parser) + return parser.parse_args() + + +def main(): + args = parse_args() + + # Check for other mandatory opitons. + if args.dev_ids is None: + common.error_exit('--dev-ids') + + # 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) + + # Setup helloworld run on container. + cmd_path = '%s/examples/helloworld/%s/helloworld' % ( + env.RTE_SDK, env.RTE_TARGET) + + hello_cmd = [cmd_path, '\\'] + + file_prefix = 'spp-hello-container%d' % dev_ids_list[0] + eal_opts = app_helper.setup_eal_opts(args, file_prefix) + + # No application specific options for helloworld + hello_opts = [] + + cmds = docker_cmd + docker_opts + hello_cmd + eal_opts + hello_opts + 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