Merge "test_kubernetes: mock file operations in test_ssh_key"
[yardstick.git] / tests / unit / network_services / traffic_profile / test_ixia_rfc2544.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2016-2017 Intel Corporation
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 from __future__ import absolute_import
19 from __future__ import division
20 import unittest
21 import mock
22
23 from tests.unit import STL_MOCKS
24
25 STLClient = mock.MagicMock()
26 stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
27 stl_patch.start()
28
29 if stl_patch:
30     from yardstick.network_services.traffic_profile.traffic_profile \
31         import TrexProfile
32     from yardstick.network_services.traffic_profile.ixia_rfc2544 import \
33         IXIARFC2544Profile
34     from yardstick.network_services.traffic_profile import ixia_rfc2544
35
36
37 class TestIXIARFC2544Profile(unittest.TestCase):
38     TRAFFIC_PROFILE = {
39         "schema": "isb:traffic_profile:0.1",
40         "name": "fixed",
41         "description": "Fixed traffic profile to run UDP traffic",
42         "traffic_profile": {
43             "traffic_type": "FixedTraffic",
44             "frame_rate": 100,  # pps
45             "flow_number": 10,
46             "frame_size": 64}}
47
48     PROFILE = {'description': 'Traffic profile to run RFC2544 latency',
49                'name': 'rfc2544',
50                'traffic_profile': {'traffic_type': 'IXIARFC2544Profile',
51                                    'frame_rate': 100},
52                'public': {'ipv4':
53                           {'outer_l2': {'framesize':
54                                         {'64B': '100', '1518B': '0',
55                                          '128B': '0', '1400B': '0',
56                                          '256B': '0', '373b': '0',
57                                          '570B': '0'}},
58                            'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
59                                           'proto': 'udp', 'count': '1',
60                                           'srcip4': '90.90.1.1-90.105.255.255',
61                                           'dscp': 0, 'ttl': 32},
62                            'outer_l4': {'srcport': '2001',
63                                         'dsrport': '1234'}}},
64                'private': {'ipv4':
65                            {'outer_l2': {'framesize':
66                                          {'64B': '100', '1518B': '0',
67                                           '128B': '0', '1400B': '0',
68                                           '256B': '0', '373b': '0',
69                                           '570B': '0'}},
70                             'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255',
71                                            'proto': 'udp', 'count': '1',
72                                            'srcip4': '1.1.1.1-1.15.255.255',
73                                            'dscp': 0, 'ttl': 32},
74                             'outer_l4': {'dstport': '2001',
75                                          'srcport': '1234'}}},
76                'schema': 'isb:traffic_profile:0.1'}
77
78     def test_get_ixia_traffic_profile_error(self):
79         traffic_generator = mock.Mock(autospec=TrexProfile)
80         traffic_generator.my_ports = [0, 1]
81         traffic_generator.priv_ports = [-1]
82         traffic_generator.pub_ports = [1]
83         traffic_generator.client = \
84             mock.Mock(return_value=True)
85         STATIC_TRAFFIC = {
86             "private": {
87                 "id": 1,
88                 "bidir": "False",
89                 "duration": 60,
90                 "iload": "100",
91                 "outer_l2": {
92                     "dstmac": "00:00:00:00:00:03",
93                     "framesPerSecond": True,
94                     "framesize": 64,
95                     "srcmac": "00:00:00:00:00:01"
96                 },
97                 "outer_l3": {
98                     "dscp": 0,
99                     "dstip4": "152.16.40.20",
100                     "proto": "udp",
101                     "srcip4": "152.16.100.20",
102                     "ttl": 32
103                 },
104                 "outer_l3v4": {
105                     "dscp": 0,
106                     "dstip4": "152.16.40.20",
107                     "proto": "udp",
108                     "srcip4": "152.16.100.20",
109                     "ttl": 32
110                 },
111                 "outer_l3v6": {
112                     "count": 1024,
113                     "dscp": 0,
114                     "dstip4": "152.16.100.20",
115                     "proto": "udp",
116                     "srcip4": "152.16.40.20",
117                     "ttl": 32
118                 },
119                 "outer_l4": {
120                     "dstport": "2001",
121                     "srcport": "1234"
122                 },
123                 "traffic_type": "continuous"
124             },
125             "public": {
126                 "id": 2,
127                 "bidir": "False",
128                 "duration": 60,
129                 "iload": "100",
130                 "outer_l2": {
131                     "dstmac": "00:00:00:00:00:04",
132                     "framesPerSecond": True,
133                     "framesize": 64,
134                     "srcmac": "00:00:00:00:00:01"
135                 },
136                 "outer_l3": {
137                     "count": 1024,
138                     "dscp": 0,
139                     "dstip4": "152.16.100.20",
140                     "proto": "udp",
141                     "srcip4": "152.16.40.20",
142                     "ttl": 32
143                 },
144                 "outer_l3v4": {
145                     "count": 1024,
146                     "dscp": 0,
147                     "dstip4": "152.16.100.20",
148                     "proto": "udp",
149                     "srcip4": "152.16.40.20",
150                     "ttl": 32
151                 },
152                 "outer_l3v6": {
153                     "count": 1024,
154                     "dscp": 0,
155                     "dstip4": "152.16.100.20",
156                     "proto": "udp",
157                     "srcip4": "152.16.40.20",
158                     "ttl": 32
159                 },
160                 "outer_l4": {
161                     "dstport": "1234",
162                     "srcport": "2001"
163                 },
164                 "traffic_type": "continuous"
165             }
166         }
167         ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
168
169         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
170         r_f_c2544_profile.rate = 100
171         mac = {"src_mac_0": "00:00:00:00:00:01",
172                "src_mac_1": "00:00:00:00:00:02",
173                "src_mac_2": "00:00:00:00:00:02",
174                "dst_mac_0": "00:00:00:00:00:03",
175                "dst_mac_1": "00:00:00:00:00:04",
176                "dst_mac_2": "00:00:00:00:00:04"}
177         self.assertRaises(IOError, r_f_c2544_profile._get_ixia_traffic_profile,
178                           self.PROFILE, mac, xfile="tmp",
179                           static_traffic=STATIC_TRAFFIC)
180
181
182     @mock.patch("yardstick.network_services.traffic_profile.ixia_rfc2544.open")
183     def test_get_ixia_traffic_profile(self, mock_open):
184         traffic_generator = mock.Mock(autospec=TrexProfile)
185         traffic_generator.my_ports = [0, 1]
186         traffic_generator.priv_ports = [-1]
187         traffic_generator.pub_ports = [1]
188         traffic_generator.client = \
189             mock.Mock(return_value=True)
190         STATIC_TRAFFIC = {
191             "private": {
192                 "id": 1,
193                 "bidir": "False",
194                 "duration": 60,
195                 "iload": "100",
196                 "outer_l2": {
197                     "dstmac": "00:00:00:00:00:03",
198                     "framesPerSecond": True,
199                     "framesize": 64,
200                     "srcmac": "00:00:00:00:00:01"
201                 },
202                 "outer_l3": {
203                     "dscp": 0,
204                     "dstip4": "152.16.40.20",
205                     "proto": "udp",
206                     "srcip4": "152.16.100.20",
207                     "ttl": 32
208                 },
209                 "outer_l3v4": {
210                     "dscp": 0,
211                     "dstip4": "152.16.40.20",
212                     "proto": "udp",
213                     "srcip4": "152.16.100.20",
214                     "ttl": 32,
215                     "count": "1"
216                 },
217                 "outer_l3v6": {
218                     "count": 1024,
219                     "dscp": 0,
220                     "dstip4": "152.16.100.20",
221                     "proto": "udp",
222                     "srcip4": "152.16.40.20",
223                     "ttl": 32,
224                     "count": "1"
225                 },
226                 "outer_l4": {
227                     "dstport": "2001",
228                     "srcport": "1234",
229                     "count": "1"
230                 },
231                 "traffic_type": "continuous"
232             },
233             "public": {
234                 "id": 2,
235                 "bidir": "False",
236                 "duration": 60,
237                 "iload": "100",
238                 "outer_l2": {
239                     "dstmac": "00:00:00:00:00:04",
240                     "framesPerSecond": True,
241                     "framesize": 64,
242                     "srcmac": "00:00:00:00:00:01"
243                 },
244                 "outer_l3": {
245                     "count": 1024,
246                     "dscp": 0,
247                     "dstip4": "152.16.100.20",
248                     "proto": "udp",
249                     "srcip4": "152.16.40.20",
250                     "ttl": 32
251                 },
252                 "outer_l3v4": {
253                     "count": 1024,
254                     "dscp": 0,
255                     "dstip4": "152.16.100.20",
256                     "proto": "udp",
257                     "srcip4": "152.16.40.20",
258                     "ttl": 32,
259                     "count": "1"
260                 },
261                 "outer_l3v6": {
262                     "count": 1024,
263                     "dscp": 0,
264                     "dstip4": "152.16.100.20",
265                     "proto": "udp",
266                     "srcip4": "152.16.40.20",
267                     "ttl": 32,
268                     "count": "1"
269                 },
270                 "outer_l4": {
271                     "dstport": "1234",
272                     "srcport": "2001",
273                     "count": "1"
274                 },
275                 "traffic_type": "continuous"
276             }
277         }
278         ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
279
280         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
281         r_f_c2544_profile.rate = 100
282         mac = {"src_mac_0": "00:00:00:00:00:01",
283                "src_mac_1": "00:00:00:00:00:02",
284                "src_mac_2": "00:00:00:00:00:02",
285                "dst_mac_0": "00:00:00:00:00:03",
286                "dst_mac_1": "00:00:00:00:00:04",
287                "dst_mac_2": "00:00:00:00:00:04"}
288         result = r_f_c2544_profile._get_ixia_traffic_profile(
289             self.PROFILE, mac, xfile="tmp", static_traffic=STATIC_TRAFFIC)
290         self.assertIsNotNone(result)
291
292     @mock.patch("yardstick.network_services.traffic_profile.ixia_rfc2544.open")
293     def test_get_ixia_traffic_profile_v6(self, mock_open):
294         traffic_generator = mock.Mock(autospec=TrexProfile)
295         traffic_generator.my_ports = [0, 1]
296         traffic_generator.priv_ports = [-1]
297         traffic_generator.pub_ports = [1]
298         traffic_generator.client = \
299             mock.Mock(return_value=True)
300         STATIC_TRAFFIC = {
301             "private": {
302                 "id": 1,
303                 "bidir": "False",
304                 "duration": 60,
305                 "iload": "100",
306                 "outer_l2": {
307                     "dstmac": "00:00:00:00:00:03",
308                     "framesPerSecond": True,
309                     "framesize": 64,
310                     "srcmac": "00:00:00:00:00:01"
311                 },
312                 "outer_l3": {
313                     "dscp": 0,
314                     "dstip4": "152.16.40.20",
315                     "proto": "udp",
316                     "srcip4": "152.16.100.20",
317                     "ttl": 32
318                 },
319                 "outer_l3v4": {
320                     "dscp": 0,
321                     "dstip4": "152.16.40.20",
322                     "proto": "udp",
323                     "srcip4": "152.16.100.20",
324                     "ttl": 32
325                 },
326                 "outer_l3v6": {
327                     "count": 1024,
328                     "dscp": 0,
329                     "dstip4": "152.16.100.20",
330                     "proto": "udp",
331                     "srcip4": "152.16.40.20",
332                     "ttl": 32
333                 },
334                 "outer_l4": {
335                     "dstport": "2001",
336                     "srcport": "1234"
337                 },
338                 "traffic_type": "continuous"
339             },
340             "public": {
341                 "id": 2,
342                 "bidir": "False",
343                 "duration": 60,
344                 "iload": "100",
345                 "outer_l2": {
346                     "dstmac": "00:00:00:00:00:04",
347                     "framesPerSecond": True,
348                     "framesize": 64,
349                     "srcmac": "00:00:00:00:00:01"
350                 },
351                 "outer_l3": {
352                     "count": 1024,
353                     "dscp": 0,
354                     "dstip4": "152.16.100.20",
355                     "proto": "udp",
356                     "srcip4": "152.16.40.20",
357                     "ttl": 32
358                 },
359                 "outer_l3v4": {
360                     "count": 1024,
361                     "dscp": 0,
362                     "dstip4": "152.16.100.20",
363                     "proto": "udp",
364                     "srcip4": "152.16.40.20",
365                     "ttl": 32
366                 },
367                 "outer_l3v6": {
368                     "count": 1024,
369                     "dscp": 0,
370                     "dstip4": "152.16.100.20",
371                     "proto": "udp",
372                     "srcip4": "152.16.40.20",
373                     "ttl": 32
374                 },
375                 "outer_l4": {
376                     "dstport": "1234",
377                     "srcport": "2001"
378                 },
379                 "traffic_type": "continuous"
380             }
381         }
382         ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
383
384         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
385         r_f_c2544_profile.rate = 100
386         mac = {"src_mac_0": "00:00:00:00:00:01",
387                "src_mac_1": "00:00:00:00:00:02",
388                "src_mac_2": "00:00:00:00:00:02",
389                "dst_mac_0": "00:00:00:00:00:03",
390                "dst_mac_1": "00:00:00:00:00:04",
391                "dst_mac_2": "00:00:00:00:00:04"}
392         profile_data = {'description': 'Traffic profile to run RFC2544',
393                         'name': 'rfc2544',
394                         'traffic_profile':
395                         {'traffic_type': 'IXIARFC2544Profile',
396                          'frame_rate': 100},
397                         'public':
398                         {'ipv4':
399                          {'outer_l2': {'framesize':
400                                        {'64B': '100', '1518B': '0',
401                                         '128B': '0', '1400B': '0',
402                                         '256B': '0', '373b': '0',
403                                         '570B': '0'}},
404                           'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
405                                          'proto': 'udp', 'count': '1',
406                                          'srcip4': '90.90.1.1-90.105.255.255',
407                                          'dscp': 0, 'ttl': 32},
408                           'outer_l3v6': {'dstip6': '1.1.1.1-1.15.255.255',
409                                          'proto': 'udp', 'count': '1',
410                                          'srcip6': '90.90.1.1-90.105.255.255',
411                                          'dscp': 0, 'ttl': 32},
412                           'outer_l4': {'srcport': '2001',
413                                        'dsrport': '1234'}}},
414                         'private': {'ipv4':
415                                     {'outer_l2': {'framesize':
416                                                   {'64B': '100', '1518B': '0',
417                                                    '128B': '0', '1400B': '0',
418                                                    '256B': '0', '373b': '0',
419                                                    '570B': '0'}},
420                                      'outer_l3v4':
421                                      {'dstip4': '9.9.1.1-90.105.255.255',
422                                       'proto': 'udp', 'count': '1',
423                                       'srcip4': '1.1.1.1-1.15.255.255',
424                                       'dscp': 0, 'ttl': 32},
425                                      'outer_l3v6':
426                                      {'dstip6': '9.9.1.1-90.105.255.255',
427                                       'proto': 'udp', 'count': '1',
428                                       'srcip6': '1.1.1.1-1.15.255.255',
429                                       'dscp': 0, 'ttl': 32},
430
431                                      'outer_l4': {'dstport': '2001',
432                                                   'srcport': '1234'}}},
433                         'schema': 'isb:traffic_profile:0.1'}
434         result = r_f_c2544_profile._get_ixia_traffic_profile(
435             profile_data, mac, static_traffic=STATIC_TRAFFIC)
436         self.assertIsNotNone(result)
437
438     def test__ixia_traffic_generate(self):
439         traffic_generator = mock.Mock(autospec=TrexProfile)
440         traffic_generator.my_ports = [0, 1]
441         traffic_generator.priv_ports = [-1]
442         traffic_generator.pub_ports = [1]
443         traffic_generator.client = \
444             mock.Mock(return_value=True)
445         traffic = {"public": {'iload': 10},
446                    "private": {'iload': 10}}
447         ixia_obj = mock.MagicMock()
448         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
449         r_f_c2544_profile.rate = 100
450         result = r_f_c2544_profile._ixia_traffic_generate(traffic_generator,
451                                                           traffic, ixia_obj)
452         self.assertIsNone(result)
453
454     def test_execute(self):
455         traffic_generator = mock.Mock(autospec=TrexProfile)
456         traffic_generator.my_ports = [0, 1]
457         traffic_generator.priv_ports = [-1]
458         traffic_generator.pub_ports = [1]
459         traffic_generator.client = \
460             mock.Mock(return_value=True)
461         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
462         r_f_c2544_profile.first_run = True
463         r_f_c2544_profile.params = {"public": {'iload': 10},
464                                     "private": {'iload': 10}}
465
466         r_f_c2544_profile.get_streams = mock.Mock()
467         r_f_c2544_profile.full_profile = {}
468         r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
469         r_f_c2544_profile.get_multiplier = mock.Mock()
470         r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
471         ixia_obj = mock.MagicMock()
472         self.assertEqual(None, r_f_c2544_profile.execute(traffic_generator,
473                                                          ixia_obj))
474
475     def test_get_drop_percentage(self):
476         traffic_generator = mock.Mock(autospec=TrexProfile)
477         traffic_generator.my_ports = [0, 1]
478         traffic_generator.priv_ports = [0]
479         traffic_generator.pub_ports = [1]
480         traffic_generator.client = \
481             mock.Mock(return_value=True)
482         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
483         r_f_c2544_profile.params = self.PROFILE
484         ixia_obj = mock.MagicMock()
485         r_f_c2544_profile.execute = mock.Mock()
486         r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
487         r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
488         r_f_c2544_profile.get_multiplier = mock.Mock()
489         r_f_c2544_profile.tmp_throughput = 0
490         r_f_c2544_profile.tmp_drop = 0
491         r_f_c2544_profile.full_profile = {}
492         samples = {}
493         for ifname in range(1):
494             name = "xe{}".format(ifname)
495             samples[name] = {"rx_throughput_fps": 20,
496                              "tx_throughput_fps": 20,
497                              "rx_throughput_mbps": 10,
498                              "tx_throughput_mbps": 10,
499                              "RxThroughput": 10,
500                              "TxThroughput": 10,
501                              "in_packets": 1000,
502                              "out_packets": 1000}
503         tol_min = 100.0
504         tolerance = 0.0
505         self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
506                              traffic_generator, samples,
507                              tol_min, tolerance, ixia_obj))
508
509     def test_get_drop_percentage_update(self):
510         traffic_generator = mock.Mock(autospec=TrexProfile)
511         traffic_generator.my_ports = [0, 1]
512         traffic_generator.priv_ports = [0]
513         traffic_generator.pub_ports = [1]
514         traffic_generator.client = \
515             mock.Mock(return_value=True)
516         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
517         r_f_c2544_profile.params = self.PROFILE
518         ixia_obj = mock.MagicMock()
519         r_f_c2544_profile.execute = mock.Mock()
520         r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
521         r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
522         r_f_c2544_profile.get_multiplier = mock.Mock()
523         r_f_c2544_profile.tmp_throughput = 0
524         r_f_c2544_profile.tmp_drop = 0
525         r_f_c2544_profile.full_profile = {}
526         samples = {}
527         for ifname in range(1):
528             name = "xe{}".format(ifname)
529             samples[name] = {"rx_throughput_fps": 20,
530                              "tx_throughput_fps": 20,
531                              "rx_throughput_mbps": 10,
532                              "tx_throughput_mbps": 10,
533                              "RxThroughput": 10,
534                              "TxThroughput": 10,
535                              "in_packets": 1000,
536                              "out_packets": 1002}
537         tol_min = 0.0
538         tolerance = 1.0
539         self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
540                              traffic_generator, samples,
541                              tol_min, tolerance, ixia_obj))
542
543     def test_get_drop_percentage_div_zero(self):
544         traffic_generator = mock.Mock(autospec=TrexProfile)
545         traffic_generator.my_ports = [0, 1]
546         traffic_generator.priv_ports = [0]
547         traffic_generator.pub_ports = [1]
548         traffic_generator.client = \
549             mock.Mock(return_value=True)
550         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
551         r_f_c2544_profile.params = self.PROFILE
552         ixia_obj = mock.MagicMock()
553         r_f_c2544_profile.execute = mock.Mock()
554         r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
555         r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
556         r_f_c2544_profile.get_multiplier = mock.Mock()
557         r_f_c2544_profile.tmp_throughput = 0
558         r_f_c2544_profile.tmp_drop = 0
559         r_f_c2544_profile.full_profile = {}
560         samples = {}
561         for ifname in range(1):
562             name = "xe{}".format(ifname)
563             samples[name] = {"rx_throughput_fps": 20,
564                              "tx_throughput_fps": 20,
565                              "rx_throughput_mbps": 10,
566                              "tx_throughput_mbps": 10,
567                              "RxThroughput": 10,
568                              "TxThroughput": 10,
569                              "in_packets": 1000,
570                              "out_packets": 0}
571         tol_min = 0.0
572         tolerance = 0.0
573         r_f_c2544_profile.tmp_throughput = 0
574         self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
575                              traffic_generator, samples,
576                              tol_min, tolerance, ixia_obj))
577
578     def test_get_multiplier(self):
579         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
580         r_f_c2544_profile.max_rate = 100
581         r_f_c2544_profile.min_rate = 100
582         self.assertEqual("1.0", r_f_c2544_profile.get_multiplier())
583
584     def test_start_ixia_latency(self):
585         traffic_generator = mock.Mock(autospec=TrexProfile)
586         traffic_generator.my_ports = [0, 1]
587         traffic_generator.priv_ports = [0]
588         traffic_generator.pub_ports = [1]
589         traffic_generator.client = \
590             mock.Mock(return_value=True)
591         r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
592         r_f_c2544_profile.max_rate = 100
593         r_f_c2544_profile.min_rate = 100
594         ixia_obj = mock.MagicMock()
595         r_f_c2544_profile._get_ixia_traffic_profile = \
596             mock.Mock(return_value={})
597         r_f_c2544_profile.full_profile = {}
598         r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
599         self.assertEqual(
600             None,
601             r_f_c2544_profile.start_ixia_latency(traffic_generator,
602                                                  ixia_obj))
603
604
605 if __name__ == '__main__':
606     unittest.main()