• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python systestlib.random_interface函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_get

 def test_get(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config('default interface %s' % intf)
         result = dut.api('switchports').get(intf)
         self.assertIsInstance(result, dict)
         self.assertEqual(result['mode'], 'access')
         self.assertEqual(result['access_vlan'], '1')
         self.assertEqual(result['trunk_native_vlan'], '1')
         self.assertEqual(result['trunk_allowed_vlans'], '1-4094')
开发者ID:arista-eosplus,项目名称:pyeapi,代码行数:10,代码来源:test_api_switchports.py


示例17: test_set_access_vlan_to_value

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


示例18: test_set_mtu_value_as_string

 def test_set_mtu_value_as_string(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['default interface %s' % intf, 'interface %s' % intf,
                     'ip address 111.111.111.111/24'])
         resource = dut.api('ipinterfaces')
         result = resource.set_mtu(intf, '2000')
         self.assertTrue(result, 'dut=%s' % dut)
         config = dut.run_commands('show running-config interfaces %s' %
                                   intf, 'text')
         self.assertIn('mtu 2000', config[0]['output'], 'dut=%s' % dut)
         dut.config('default interface %s' % intf)
开发者ID:CullyB,项目名称:pyeapi,代码行数:12,代码来源:test_api_ipinterfaces.py


示例19: test_delete_and_return_true

 def test_delete_and_return_true(self):
     for dut in self.duts:
         intf = random_interface(dut)
         dut.config(['interface %s' % intf, 'ip address 199.1.1.1/24'])
         resource = dut.api('ipinterfaces')
         result = resource.delete(intf)
         self.assertTrue(result, 'dut=%s' % dut)
         config = dut.run_commands('show running-config interfaces %s' %
                                   intf, 'text')
         self.assertNotIn('ip address 199.1.1.1/24', config[0]['output'],
                          'dut=%s' % dut)
         dut.config('default interface %s' % intf)
开发者ID:CullyB,项目名称:pyeapi,代码行数:12,代码来源:test_api_ipinterfaces.py


示例20: test_set_trunk_allowed_vlans

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python systray.Systray类代码示例发布时间:2022-05-27
下一篇:
Python systemml.matrix函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap