예제 #1
0
    def test_get_instances(self):
        new_blank = Forward()
        new_blank.addTargets(['192.168.113.123'],
                             'bclinux7',
                             'north_king',
                             'wolf_spirit',
                             timeout=40,
                             port=25)
        new_blank.addTargets(['192.168.113.124-192.168.113.126'], 'vlb',
                             'south_king', 'fish_spirit')
        instances = new_blank.getInstances(preLogin=False)
        node123 = instances['192.168.113.123']
        node124 = instances['192.168.113.124']
        node125 = instances['192.168.113.125']
        node126 = instances['192.168.113.126']

        self.assertTrue(
            isinstance(
                node123,
                getattr(
                    importlib.import_module('forward.devclass.%s' %
                                            'bclinux7'), 'BCLINUX7')))
        self.assertTrue(
            isinstance(
                node125,
                getattr(importlib.import_module('forward.devclass.%s' % 'vlb'),
                        'VLB')))
예제 #2
0
    def test_get_instances(self):
        new_blank = Forward()
        new_blank.addTargets(
            ['192.168.113.123'],
            'bclinux7',
            'north_king',
            'wolf_spirit',
            timeout=40,
            port=25
        )
        new_blank.addTargets(
            ['192.168.113.124-192.168.113.126'],
            'vlb',
            'south_king',
            'fish_spirit'
        )
        instances = new_blank.getInstances(preLogin=False)
        node123 = instances['192.168.113.123']
        node124 = instances['192.168.113.124']
        node125 = instances['192.168.113.125']
        node126 = instances['192.168.113.126']

        self.assertTrue(isinstance(node123, getattr(
            importlib.import_module('forward.devclass.%s' % 'bclinux7'),
            'BCLINUX7'
        )))
        self.assertTrue(isinstance(node125, getattr(
            importlib.import_module('forward.devclass.%s' % 'vlb'),
            'VLB'
        )))
예제 #3
0
 def test_add_targets(self):
     new_blank = Forward()
     new_blank.addTargets(['192.168.113.123'],
                          'bclinux7',
                          'north_king',
                          'wolf_spirit',
                          timeout=40,
                          port=25)
     new_blank.addTargets(['192.168.113.124-192.168.113.126'], 'vlb',
                          'south_king', 'fish_spirit')
     self.assertEquals(
         new_blank.targets,
         [[
             '192.168.113.123', 'bclinux7', 'north_king', 'wolf_spirit', {
                 'timeout': 40,
                 'port': 25
             }
         ], ['192.168.113.124', 'vlb', 'south_king', 'fish_spirit', {}],
          ['192.168.113.125', 'vlb', 'south_king', 'fish_spirit', {}],
          ['192.168.113.126', 'vlb', 'south_king', 'fish_spirit', {}]])
예제 #4
0
 def test_add_targets(self):
     new_blank = Forward()
     new_blank.addTargets(
         ['192.168.113.123'],
         'bclinux7',
         'north_king',
         'wolf_spirit',
         timeout=40,
         port=25
     )
     new_blank.addTargets(
         ['192.168.113.124-192.168.113.126'],
         'vlb',
         'south_king',
         'fish_spirit'
     )
     self.assertEquals(new_blank.targets, [
         ['192.168.113.123', 'bclinux7', 'north_king', 'wolf_spirit', {'timeout': 40, 'port': 25}],
         ['192.168.113.124', 'vlb', 'south_king', 'fish_spirit', {}],
         ['192.168.113.125', 'vlb', 'south_king', 'fish_spirit', {}],
         ['192.168.113.126', 'vlb', 'south_king', 'fish_spirit', {}]
     ])