From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw0704.ocn.ad.jp (mogw0704.ocn.ad.jp [153.149.232.5]) by dpdk.org (Postfix) with ESMTP id 72FE41B1FD for ; Thu, 14 Feb 2019 03:47:29 +0100 (CET) Received: from mf-smf-ucb025c1 (mf-smf-ucb025c1.ocn.ad.jp [153.153.66.163]) by mogw0704.ocn.ad.jp (Postfix) with ESMTP id 15EE9280255; Thu, 14 Feb 2019 11:47:28 +0900 (JST) Received: from ocn-vc-mts-103c1.ocn.ad.jp ([153.138.237.78]) by mf-smf-ucb025c1 with ESMTP id u6qZgNegfu8ANu73ggoY1c; Thu, 14 Feb 2019 11:47:28 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.167]) by ocn-vc-mts-103c1.ocn.ad.jp with ESMTP id u73fgIQh5xmywu73fghAlB; Thu, 14 Feb 2019 11:47:27 +0900 Received: from localhost.localdomain (unknown [192.47.164.146]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Thu, 14 Feb 2019 11:47:27 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Thu, 14 Feb 2019 11:47:23 +0900 Message-Id: <20190214024726.40861-4-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214024726.40861-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20190214024726.40861-1-ogawa.yasufumi@lab.ntt.co.jp> Subject: [spp] [PATCH 3/6] controller: remove local default config 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: Thu, 14 Feb 2019 02:47:30 -0000 From: Yasufumi Ogawa Default config defined in `pri.py` is nouse because all of config is defined in config file. This update is to remove file local default config. Signed-off-by: Yasufumi Ogawa --- src/controller/commands/pri.py | 35 ++++------------------------------ 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py index 0e65883..d76da2e 100644 --- a/src/controller/commands/pri.py +++ b/src/controller/commands/pri.py @@ -25,16 +25,6 @@ class SppPrimary(object): self.spp_ctl_cli = spp_ctl_cli # Default args for `pri; launch`, used if given cli_config is invalid - # TODO(yasufum) remove local default and add checking config - self.launch_default = { - 'mem': '-m 512', - 'base_lcore': '1', - 'vhost_cli': '', - 'nof_lcores_nfv': '1', - 'nof_lcores_vf': '3', - 'nof_lcores_mirror': '2', - 'nof_lcores_pcap': '2', - } # TODO(yasufum) replace placeholders __XXX__ to {keyword}. # Setup template of args for `pri; launch` @@ -165,6 +155,7 @@ class SppPrimary(object): rid=rports['id'], rx=rports['rx'], tx=rports['tx'], rx_drop=rports['rx_drop'], tx_drop=rports['tx_drop'])) + # TODO(yasufum) add checking for cli_config has keys def complete(self, text, line, begidx, endidx, cli_config): """Completion for primary process commands. @@ -230,35 +221,23 @@ class SppPrimary(object): tmpkey = 'sec_nfv_nof_lcores' nof_workers = int( cli_config[tmpkey]['val']) - else: - nof_workers = int( - self.defaults['nof_lcores_nfv']) elif ptype == 'vf': if 'sec_vf_nof_lcores' in cli_config.keys(): nof_workers = int( cli_config['sec_vf_nof_lcores']['val']) - else: - nof_workers = int( - elf.defaults['nof_lcores_vf']) elif ptype == 'mirror': # two worker cores if 'sec_mirror_nof_lcores' in cli_config.keys(): tmpkey = 'sec_mirror_nof_lcores' nof_workers = int( cli_config[tmpkey]['val']) - else: - nof_workers = int( - self.defaults['nof_lcore_mirror']) elif ptype == 'pcap': # at least two worker cores if 'sec_pcap_nof_lcores' in cli_config.keys(): tmpkey = 'sec_pcap_nof_lcores' nof_workers = int( cli_config[tmpkey]['val']) - else: - nof_workers = int( - elf.defaults['nof_lcore_pcap']) last_core = lcore_base + nof_workers - 1 @@ -270,8 +249,7 @@ class SppPrimary(object): rest_core = '{}-{}'.format(lcore_base, last_core) temp = self._setup_launch_template( - cli_config, self.launch_template, - self.launch_default) + cli_config, self.launch_template) candidates = [temp.format( wlcores=rest_core, opt_sid=opt_sid, sid=sid, sec_addr=server_addr)] @@ -290,19 +268,16 @@ class SppPrimary(object): return completions - def _setup_launch_template(self, cli_config, template, defaults): + # TODO(yasufum) add checking for cli_config has keys + def _setup_launch_template(self, cli_config, template): """Check given `cli_config` for params of launch.""" if 'sec_mem' in cli_config.keys(): sec_mem = cli_config['sec_mem']['val'] - else: - sec_mem = defaults['mem'] template = template.replace('__MEM__', sec_mem) if 'sec_base_lcore' in cli_config.keys(): sec_base_lcore = cli_config['sec_base_lcore']['val'] - else: - sec_base_lcore = defaults['base_lcore'] template = template.replace('__BASE_LCORE__', str(sec_base_lcore)) if 'sec_vhost_cli' in cli_config.keys(): @@ -310,8 +285,6 @@ class SppPrimary(object): vhost_client = '--vhost-client' else: vhost_client = '' - else: - vhost_client = defaults['vhost_cli'] template = template.replace('__VHOST_CLI__', vhost_client) return template -- 2.17.1