Commit 9ffa01ca authored by Pedro Tammela's avatar Pedro Tammela Committed by David S. Miller

selftests: tc-testing: drop '-N' argument from nsPlugin

This argument would bypass the net namespace creation and run the test in
the root namespace, even if nsPlugin was specified.
Drop it as it's the same as commenting out the nsPlugin from a test and adds
additional complexity to the plugin code.
Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0fbe92b9
...@@ -28,10 +28,7 @@ def prepare_suite(obj, test): ...@@ -28,10 +28,7 @@ def prepare_suite(obj, test):
shadow['DEV2'] = original['DEV2'] shadow['DEV2'] = original['DEV2']
obj.args.NAMES = shadow obj.args.NAMES = shadow
if obj.args.namespace:
obj._ns_create() obj._ns_create()
else:
obj._ports_create()
# Make sure the netns is visible in the fs # Make sure the netns is visible in the fs
while True: while True:
...@@ -75,10 +72,7 @@ class SubPlugin(TdcPlugin): ...@@ -75,10 +72,7 @@ class SubPlugin(TdcPlugin):
if self.args.verbose: if self.args.verbose:
print('{}.post_case'.format(self.sub_class)) print('{}.post_case'.format(self.sub_class))
if self.args.namespace:
self._ns_destroy() self._ns_destroy()
else:
self._ports_destroy()
def post_suite(self, index): def post_suite(self, index):
if self.args.verbose: if self.args.verbose:
...@@ -93,24 +87,11 @@ class SubPlugin(TdcPlugin): ...@@ -93,24 +87,11 @@ class SubPlugin(TdcPlugin):
subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def add_args(self, parser):
super().add_args(parser)
self.argparser_group = self.argparser.add_argument_group(
'netns',
'options for nsPlugin(run commands in net namespace)')
self.argparser_group.add_argument(
'-N', '--no-namespace', action='store_false', default=True,
dest='namespace', help='Don\'t run commands in namespace')
return self.argparser
def adjust_command(self, stage, command): def adjust_command(self, stage, command):
super().adjust_command(stage, command) super().adjust_command(stage, command)
cmdform = 'list' cmdform = 'list'
cmdlist = list() cmdlist = list()
if not self.args.namespace:
return command
if self.args.verbose: if self.args.verbose:
print('{}.adjust_command'.format(self.sub_class)) print('{}.adjust_command'.format(self.sub_class))
...@@ -144,8 +125,6 @@ class SubPlugin(TdcPlugin): ...@@ -144,8 +125,6 @@ class SubPlugin(TdcPlugin):
cmds.append(self._replace_keywords('link add $DEV0 type veth peer name $DEV1')) cmds.append(self._replace_keywords('link add $DEV0 type veth peer name $DEV1'))
cmds.append(self._replace_keywords('link set $DEV0 up')) cmds.append(self._replace_keywords('link set $DEV0 up'))
cmds.append(self._replace_keywords('link add $DUMMY type dummy')) cmds.append(self._replace_keywords('link add $DUMMY type dummy'))
if not self.args.namespace:
cmds.append(self._replace_keywords('link set $DEV1 up'))
return cmds return cmds
...@@ -161,7 +140,6 @@ class SubPlugin(TdcPlugin): ...@@ -161,7 +140,6 @@ class SubPlugin(TdcPlugin):
def _ns_create_cmds(self): def _ns_create_cmds(self):
cmds = [] cmds = []
if self.args.namespace:
ns = self.args.NAMES['NS'] ns = self.args.NAMES['NS']
cmds.append(self._replace_keywords('netns add {}'.format(ns))) cmds.append(self._replace_keywords('netns add {}'.format(ns)))
...@@ -192,7 +170,6 @@ class SubPlugin(TdcPlugin): ...@@ -192,7 +170,6 @@ class SubPlugin(TdcPlugin):
Destroy the network namespace for testing (and any associated network Destroy the network namespace for testing (and any associated network
devices as well) devices as well)
''' '''
if self.args.namespace:
self._exec_cmd('post', self._ns_destroy_cmd()) self._exec_cmd('post', self._ns_destroy_cmd())
self._ports_destroy() self._ports_destroy()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment