当前位置: 首页>>代码示例>>Python>>正文


Python systestlib.random_interface函数代码示例

本文整理汇总了Python中systestlib.random_interface函数的典型用法代码示例。如果您正苦于以下问题:Python random_interface函数的具体用法?Python random_interface怎么用?Python random_interface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了random_interface函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_and_delete_portchannel_sub_interface

    def test_create_and_delete_portchannel_sub_interface(self):
        for dut in self.duts:
            et1 = random_interface(dut)
            et2 = random_interface(dut, exclude=[et1])

            dut.config(['no interface Port-Channel1',
                        'default interface %s' % et1,
                        'interface %s' % et1,
                        'channel-group 1 mode on',
                        'default interface %s' % et2,
                        'interface %s' % et2,
                        'channel-group 1 mode on'])
            # Create subint Port-Channel1.1
            api = dut.api('interfaces')
            result = api.create('Port-Channel1.1')
            self.assertTrue(result, 'dut=%s' % dut)
            command = 'show running-config interfaces Port-Channel1.1'
            output = dut.run_commands(command, encoding='text')
            self.assertIn('Port-Channel1.1', output[0]['output'])
            # Delete subint Port-Channel1.1
            result = dut.api('interfaces').delete('Port-Channel1.1')
            self.assertTrue(result)
            output = dut.run_commands(command, encoding='text')
            self.assertEqual(output[0]['output'], '')
            # Remove port-channel and default interfaces
            dut.config(['no interface Port-Channel1',
                        'default interface %s' % et1,
                        'default interface %s' % et2])
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:28,代码来源:test_api_interfaces.py

示例2: test_set_members

    def test_set_members(self):
        for dut in self.duts:
            et1 = random_interface(dut)
            et2 = random_interface(dut, exclude=[et1])
            et3 = random_interface(dut, exclude=[et1, et2])

            dut.config(['no interface Port-Channel1',
                        'default interface %s' % et1,
                        'interface %s' % et1,
                        'channel-group 1 mode on',
                        'default interface %s' % et2,
                        'interface %s' % et2,
                        'channel-group 1 mode on',
                        'default interface %s' % et3])

            api = dut.api('interfaces')
            result = api.set_members('Port-Channel1', [et1, et3])
            self.assertTrue(result, 'dut=%s' % dut)

            cmd = 'show running-config interfaces %s'

            # check to make sure et1 is still in the lag and et3 was
            # added to the lag
            for interface in [et1, et3]:
                config = dut.run_commands(cmd % interface, 'text')
                self.assertIn('channel-group 1 mode on',
                              config[0]['output'], 'dut=%s' % dut)

            # checks to  make sure et2 was remvoved form the lag
            config = dut.run_commands(cmd % et2, 'text')
            self.assertNotIn('channel-group 1 mode on',
                             config[0]['output'], 'dut=%s' % dut)
开发者ID:CullyB,项目名称:pyeapi,代码行数:32,代码来源:test_api_interfaces.py

示例3: test_get_returns_none

 def test_get_returns_none(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'no switchport'])
         result = dut.api('switchports').get(intf)
         self.assertIsNone(result)
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:7,代码来源:test_api_switchports.py

示例4: test_get_interface_wo_ip_adddress

 def test_get_interface_wo_ip_adddress(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'no switchport'])
         result = dut.api('ipinterfaces').get(intf)
         self.assertEqual(result['address'], '0.0.0.0')
开发者ID:CullyB,项目名称:pyeapi,代码行数:7,代码来源:test_api_ipinterfaces.py

示例5: test_set_portfast_to_true

 def test_set_portfast_to_true(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config('default interface %s' % intf)
         resource = dut.api('stp').interfaces
         result = resource.set_portfast(intf, True)
         self.assertTrue(result, 'dut=%s' % dut)
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:7,代码来源:test_api_stp.py

示例6: test_getall

 def test_getall(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config('default interface %s' % intf)
         result = dut.api('switchports').getall()
         self.assertIsInstance(result, dict, 'dut=%s' % dut)
         self.assertIn(intf, result, 'dut=%s' % dut)
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:7,代码来源:test_api_switchports.py

示例7: test_getall

 def test_getall(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf])
         result = dut.api('interfaces').getall()
         self.assertIsInstance(result, dict)
         for intf in [intf, 'Management1']:
             self.assertIn(intf, result)
开发者ID:CullyB,项目名称:pyeapi,代码行数:8,代码来源:test_api_interfaces.py

示例8: test_set_bpdugard_to_no

 def test_set_bpdugard_to_no(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'spanning-tree bpduguard enable'])
         resource = dut.api('stp').interfaces
         result = resource.set_bpduguard(intf, disable=True)
         self.assertTrue(result, 'dut=%s' % dut)
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:8,代码来源:test_api_stp.py

示例9: test_set_portfast_to_false

 def test_set_portfast_to_false(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'spanning-tree portfast'])
         resource = dut.api('stp').interfaces
         result = resource.set_portfast(intf, False)
         self.assertTrue(result, 'dut=%s' % dut)
开发者ID:brigoldberg,项目名称:pyeapi,代码行数:8,代码来源:test_api_stp.py

示例10: test_set_description

 def test_set_description(self):
     for dut in self.duts:
         text = random_string()
         intf = random_interface(dut)
         result = dut.api('interfaces').set_description(intf, text)
         self.assertTrue(result)
         config = dut.run_commands('show interfaces %s' % intf)
         config = config[0]['interfaces'][intf]
         self.assertEqual(config['description'], text)
开发者ID:CullyB,项目名称:pyeapi,代码行数:9,代码来源:test_api_interfaces.py

示例11: test_default

 def test_default(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['interface %s' % intf, 'shutdown'])
         result = dut.api('interfaces').default(intf)
         self.assertTrue(result)
         config = dut.run_commands('show interfaces %s' % intf)
         config = config[0]['interfaces'][intf]
         self.assertEqual(config['interfaceStatus'], 'connected')
开发者ID:CullyB,项目名称:pyeapi,代码行数:9,代码来源:test_api_interfaces.py

示例12: test_set_sflow_disable

 def test_set_sflow_disable(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config('default interface %s' % intf)
         result = dut.api('interfaces').set_sflow(intf, False)
         self.assertTrue(result)
         config = dut.run_commands('show running-config interfaces %s' %
                                   intf, 'text')
         self.assertIn('no sflow enable', config[0]['output'])
开发者ID:CullyB,项目名称:pyeapi,代码行数:9,代码来源:test_api_interfaces.py

示例13: test_set_description_negate

 def test_set_description_negate(self):
     for dut in self.duts:
         text = random_string()
         intf = random_interface(dut)
         dut.config(['interface %s' % intf, 'description %s' % text])
         result = dut.api('interfaces').set_description(intf, disable=True)
         self.assertTrue(result)
         config = dut.run_commands('show interfaces %s' % intf)
         config = config[0]['interfaces'][intf]
         self.assertEqual(config['description'], '')
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:10,代码来源:test_api_interfaces.py

示例14: test_get

 def test_get(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'no switchport', 'ip address 99.99.99.99/24',
                     'mtu 1800'])
         result = dut.api('ipinterfaces').get(intf)
         values = dict(name=intf, address='99.99.99.99/24',
                       mtu=1800)
         self.assertEqual(values, result, 'dut=%s' % dut)
开发者ID:CullyB,项目名称:pyeapi,代码行数:10,代码来源:test_api_ipinterfaces.py

示例15: test_delete_and_return_true

 def test_delete_and_return_true(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config('default interface %s' % intf)
         result = dut.api('switchports').delete(intf)
         self.assertTrue(result, 'dut=%s' % dut)
         config = dut.run_commands('show running-config interfaces %s' %
                                   intf, 'text')
         self.assertIn('no switchport', config[0]['output'], 'dut=%s' % dut)
         dut.config('default interface %s' % intf)
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:10,代码来源:test_api_switchports.py


注:本文中的systestlib.random_interface函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。