apiserver: mock socket.gethostbyname
[yardstick.git] / tests / unit / network_services / traffic_profile / test_ixia_rfc2544.py
index 6dba64a..cd0aacb 100644 (file)
@@ -20,65 +20,7 @@ from __future__ import division
 import unittest
 import mock
 
-STL_MOCKS = {
-    'stl': mock.MagicMock(),
-    'stl.trex_stl_lib': mock.MagicMock(),
-    'stl.trex_stl_lib.base64': mock.MagicMock(),
-    'stl.trex_stl_lib.binascii': mock.MagicMock(),
-    'stl.trex_stl_lib.collections': mock.MagicMock(),
-    'stl.trex_stl_lib.copy': mock.MagicMock(),
-    'stl.trex_stl_lib.datetime': mock.MagicMock(),
-    'stl.trex_stl_lib.functools': mock.MagicMock(),
-    'stl.trex_stl_lib.imp': mock.MagicMock(),
-    'stl.trex_stl_lib.inspect': mock.MagicMock(),
-    'stl.trex_stl_lib.json': mock.MagicMock(),
-    'stl.trex_stl_lib.linecache': mock.MagicMock(),
-    'stl.trex_stl_lib.math': mock.MagicMock(),
-    'stl.trex_stl_lib.os': mock.MagicMock(),
-    'stl.trex_stl_lib.platform': mock.MagicMock(),
-    'stl.trex_stl_lib.pprint': mock.MagicMock(),
-    'stl.trex_stl_lib.random': mock.MagicMock(),
-    'stl.trex_stl_lib.re': mock.MagicMock(),
-    'stl.trex_stl_lib.scapy': mock.MagicMock(),
-    'stl.trex_stl_lib.socket': mock.MagicMock(),
-    'stl.trex_stl_lib.string': mock.MagicMock(),
-    'stl.trex_stl_lib.struct': mock.MagicMock(),
-    'stl.trex_stl_lib.sys': mock.MagicMock(),
-    'stl.trex_stl_lib.threading': mock.MagicMock(),
-    'stl.trex_stl_lib.time': mock.MagicMock(),
-    'stl.trex_stl_lib.traceback': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
-    'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
-    'stl.trex_stl_lib.types': mock.MagicMock(),
-    'stl.trex_stl_lib.utils': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.common': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.json': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.os': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.random': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.re': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.string': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
-    'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
-    'stl.trex_stl_lib.warnings': mock.MagicMock(),
-    'stl.trex_stl_lib.yaml': mock.MagicMock(),
-    'stl.trex_stl_lib.zlib': mock.MagicMock(),
-    'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
 
 STLClient = mock.MagicMock()
 stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
@@ -114,7 +56,7 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                                          '256B': '0', '373b': '0',
                                          '570B': '0'}},
                            'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
-                                          'proto': 'udp',
+                                          'proto': 'udp', 'count': '1',
                                           'srcip4': '90.90.1.1-90.105.255.255',
                                           'dscp': 0, 'ttl': 32},
                            'outer_l4': {'srcport': '2001',
@@ -126,7 +68,7 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                                           '256B': '0', '373b': '0',
                                           '570B': '0'}},
                             'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255',
-                                           'proto': 'udp',
+                                           'proto': 'udp', 'count': '1',
                                            'srcip4': '1.1.1.1-1.15.255.255',
                                            'dscp': 0, 'ttl': 32},
                             'outer_l4': {'dstport': '2001',
@@ -269,7 +211,8 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                     "dstip4": "152.16.40.20",
                     "proto": "udp",
                     "srcip4": "152.16.100.20",
-                    "ttl": 32
+                    "ttl": 32,
+                    "count": "1"
                 },
                 "outer_l3v6": {
                     "count": 1024,
@@ -277,11 +220,13 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                     "dstip4": "152.16.100.20",
                     "proto": "udp",
                     "srcip4": "152.16.40.20",
-                    "ttl": 32
+                    "ttl": 32,
+                    "count": "1"
                 },
                 "outer_l4": {
                     "dstport": "2001",
-                    "srcport": "1234"
+                    "srcport": "1234",
+                    "count": "1"
                 },
                 "traffic_type": "continuous"
             },
@@ -310,7 +255,8 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                     "dstip4": "152.16.100.20",
                     "proto": "udp",
                     "srcip4": "152.16.40.20",
-                    "ttl": 32
+                    "ttl": 32,
+                    "count": "1"
                 },
                 "outer_l3v6": {
                     "count": 1024,
@@ -318,11 +264,13 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                     "dstip4": "152.16.100.20",
                     "proto": "udp",
                     "srcip4": "152.16.40.20",
-                    "ttl": 32
+                    "ttl": 32,
+                    "count": "1"
                 },
                 "outer_l4": {
                     "dstport": "1234",
-                    "srcport": "2001"
+                    "srcport": "2001",
+                    "count": "1"
                 },
                 "traffic_type": "continuous"
             }
@@ -453,8 +401,12 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                                         '128B': '0', '1400B': '0',
                                         '256B': '0', '373b': '0',
                                         '570B': '0'}},
+                          'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
+                                         'proto': 'udp', 'count': '1',
+                                         'srcip4': '90.90.1.1-90.105.255.255',
+                                         'dscp': 0, 'ttl': 32},
                           'outer_l3v6': {'dstip6': '1.1.1.1-1.15.255.255',
-                                         'proto': 'udp',
+                                         'proto': 'udp', 'count': '1',
                                          'srcip6': '90.90.1.1-90.105.255.255',
                                          'dscp': 0, 'ttl': 32},
                           'outer_l4': {'srcport': '2001',
@@ -465,11 +417,17 @@ class TestIXIARFC2544Profile(unittest.TestCase):
                                                    '128B': '0', '1400B': '0',
                                                    '256B': '0', '373b': '0',
                                                    '570B': '0'}},
+                                     'outer_l3v4':
+                                     {'dstip4': '9.9.1.1-90.105.255.255',
+                                      'proto': 'udp', 'count': '1',
+                                      'srcip4': '1.1.1.1-1.15.255.255',
+                                      'dscp': 0, 'ttl': 32},
                                      'outer_l3v6':
                                      {'dstip6': '9.9.1.1-90.105.255.255',
-                                      'proto': 'udp',
+                                      'proto': 'udp', 'count': '1',
                                       'srcip6': '1.1.1.1-1.15.255.255',
                                       'dscp': 0, 'ttl': 32},
+
                                      'outer_l4': {'dstport': '2001',
                                                   'srcport': '1234'}}},
                         'schema': 'isb:traffic_profile:0.1'}