Lines Matching refs:self
11 def __init__(self): argument
12 self.sub_class = 'ns/SubPlugin'
15 def pre_suite(self, testcount, testidlist): argument
19 if self.args.namespace:
20 self._ns_create()
22 self._ports_create()
24 def post_suite(self, index): argument
27 if self.args.verbose:
28 print('{}.post_suite'.format(self.sub_class))
30 if self.args.namespace:
31 self._ns_destroy()
33 self._ports_destroy()
35 def add_args(self, parser): argument
37 self.argparser_group = self.argparser.add_argument_group(
40 self.argparser_group.add_argument(
43 return self.argparser
45 def adjust_command(self, stage, command): argument
50 if not self.args.namespace:
53 if self.args.verbose:
54 print('{}.adjust_command'.format(self.sub_class))
62 if self.args.verbose:
64 cmdlist.insert(0, self.args.NAMES['NS'])
67 cmdlist.insert(0, self.args.NAMES['IP'])
76 if self.args.verbose:
80 def _ports_create(self): argument
82 self._exec_cmd('pre', cmd)
84 self._exec_cmd('pre', cmd)
85 if not self.args.namespace:
87 self._exec_cmd('pre', cmd)
89 def _ports_destroy(self): argument
91 self._exec_cmd('post', cmd)
93 def _ns_create(self): argument
98 self._ports_create()
99 if self.args.namespace:
100 cmd = '$IP netns add {}'.format(self.args.NAMES['NS'])
101 self._exec_cmd('pre', cmd)
102 cmd = '$IP link set $DEV1 netns {}'.format(self.args.NAMES['NS'])
103 self._exec_cmd('pre', cmd)
104 cmd = '$IP -n {} link set $DEV1 up'.format(self.args.NAMES['NS'])
105 self._exec_cmd('pre', cmd)
106 if self.args.device:
107 cmd = '$IP link set $DEV2 netns {}'.format(self.args.NAMES['NS'])
108 self._exec_cmd('pre', cmd)
109 cmd = '$IP -n {} link set $DEV2 up'.format(self.args.NAMES['NS'])
110 self._exec_cmd('pre', cmd)
112 def _ns_destroy(self): argument
117 if self.args.namespace:
118 cmd = '$IP netns delete {}'.format(self.args.NAMES['NS'])
119 self._exec_cmd('post', cmd)
121 def _exec_cmd(self, stage, command): argument
127 command = self._replace_keywords(command)
129 self.adjust_command(stage, command)
130 if self.args.verbose:
148 def _replace_keywords(self, cmd): argument
154 subcmd = tcmd.safe_substitute(self.args.NAMES)