Lines Matching +full:self +full:- +full:test

21     def __init__(self):  argument
22 self.sub_class = 'ns/SubPlugin'
25 def pre_suite(self, testcount, testlist): argument
28 def prepare_test(self, test): argument
29 if 'skip' in test and test['skip'] == 'yes':
32 if 'nsPlugin' not in test['plugins']:
36 self._nl_ns_create()
38 self._ipr2_ns_create()
45 self._proc_check()
47 ns = self.args.NAMES['NS']
53 ticks -= 1
56 def pre_case(self, test, test_skip): argument
57 if self.args.verbose:
58 print('{}.pre_case'.format(self.sub_class))
63 self.prepare_test(test)
65 def post_case(self): argument
66 if self.args.verbose:
67 print('{}.post_case'.format(self.sub_class))
70 self._nl_ns_destroy()
72 self._ipr2_ns_destroy()
74 def post_suite(self, index): argument
75 if self.args.verbose:
76 print('{}.post_suite'.format(self.sub_class))
79 cmd = self._replace_keywords("$IP -a netns del")
81 if self.args.verbose > 3:
86 def adjust_command(self, stage, command): argument
91 if self.args.verbose:
92 print('{}.adjust_command'.format(self.sub_class))
100 if self.args.verbose:
102 cmdlist.insert(0, self.args.NAMES['NS'])
105 cmdlist.insert(0, self.args.NAMES['IP'])
114 if self.args.verbose:
118 def _nl_ns_create(self): argument
119 ns = self.args.NAMES["NS"];
120 dev0 = self.args.NAMES["DEV0"];
121 dev1 = self.args.NAMES["DEV1"];
122 dummy = self.args.NAMES["DUMMY"];
124 if self.args.verbose:
125 print('{}._nl_ns_create'.format(self.sub_class))
144 ticks -= 1
159 ticks -= 1
162 def _ipr2_ns_create_cmds(self): argument
165 ns = self.args.NAMES['NS']
167 cmds.append(self._replace_keywords('netns add {}'.format(ns)))
168 cmds.append(self._replace_keywords('link add $DEV1 type veth peer name $DEV0'))
169 cmds.append(self._replace_keywords('link set $DEV1 netns {}'.format(ns)))
170 cmds.append(self._replace_keywords('link add $DUMMY type dummy'.format(ns)))
171 cmds.append(self._replace_keywords('link set $DUMMY netns {}'.format(ns)))
172 cmds.append(self._replace_keywords('netns exec {} $IP link set $DEV1 up'.format(ns)))
173 cmds.append(self._replace_keywords('netns exec {} $IP link set $DUMMY up'.format(ns)))
174 cmds.append(self._replace_keywords('link set $DEV0 up'.format(ns)))
176 if self.args.device:
177 cmds.append(self._replace_keywords('link set $DEV2 netns {}'.format(ns)))
178 cmds.append(self._replace_keywords('netns exec {} $IP link set $DEV2 up'.format(ns)))
182 def _ipr2_ns_create(self): argument
187 self._exec_cmd_batched('pre', self._ipr2_ns_create_cmds())
189 def _nl_ns_destroy(self): argument
190 ns = self.args.NAMES['NS']
193 def _ipr2_ns_destroy_cmd(self): argument
194 return self._replace_keywords('netns delete {}'.format(self.args.NAMES['NS']))
196 def _ipr2_ns_destroy(self): argument
201 self._exec_cmd('post', self._ipr2_ns_destroy_cmd())
204 def _proc(self): argument
205 ip = self._replace_keywords("$IP -b -")
213 def _proc_check(self): argument
214 proc = self._proc
221 def _exec_cmd(self, stage, command): argument
227 if self.args.verbose > 3:
230 proc = self._proc
235 if self.args.verbose > 3:
238 self._proc_check()
240 def _exec_cmd_batched(self, stage, commands): argument
242 self._exec_cmd(stage, cmd)
244 def _replace_keywords(self, cmd): argument
250 subcmd = tcmd.safe_substitute(self.args.NAMES)