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

Python nettestlib.dummy_devices函数代码示例

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

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



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

示例1: test_add_static_ip_to_the_existing_net_with_bond

    def test_add_static_ip_to_the_existing_net_with_bond(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            network_attrs1 = {'bonding': BOND_NAME,
                              'bridged': False,
                              'ipaddr': IPv4_ADDRESS,
                              'netmask': IPv4_NETMASK,
                              'switch': switch}

            network_attrs2 = {'bonding': BOND_NAME,
                              'bridged': True,
                              'vlan': VLAN,
                              'switch': switch}

            bond = {BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}
            netconf = {NETWORK_NAME: network_attrs1,
                       NETWORK2_NAME: network_attrs2}

            net2 = {NETWORK2_NAME: netconf[NETWORK2_NAME]}

            with adapter.setupNetworks(netconf, bond, NOCHK):
                adapter.assertNetworkIp(NETWORK_NAME, network_attrs1)
                adapter.assertNetworkIp(NETWORK2_NAME, network_attrs2)
                network_attrs2['ipaddr'] = IPv4_ADDRESS2
                network_attrs2['netmask'] = IPv4_NETMASK
                adapter.setupNetworks(net2, bond, NOCHK)
                adapter.assertNetworkIp(NETWORK_NAME, network_attrs1)
                adapter.assertNetworkIp(NETWORK2_NAME, network_attrs2)
开发者ID:nirs,项目名称:vdsm,代码行数:27,代码来源:static_ip_test.py


示例2: test_add_bond_with_two_nics

    def test_add_bond_with_two_nics(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            BONDCREATE = {
                BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}

            with adapter.setupNetworks({}, BONDCREATE, NOCHK):
                adapter.assertBond(BOND_NAME, BONDCREATE[BOND_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:7,代码来源:bond_basic_test.py


示例3: _test_add_net_with_ip

    def _test_add_net_with_ip(self, families, switch,
                              bonded=False, vlaned=False, bridged=False):
        with dummy_devices(2) as (nic1, nic2):
            network_attrs = {'bridged': bridged, 'switch': switch}

            if IpFamily.IPv4 in families:
                network_attrs['ipaddr'] = IPv4_ADDRESS
                network_attrs['netmask'] = IPv4_NETMASK
            if IpFamily.IPv6 in families:
                network_attrs['ipv6addr'] = IPv6_ADDRESS

            if bonded:
                bondcreate = {
                    BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}
                network_attrs['bonding'] = BOND_NAME
            else:
                bondcreate = {}
                network_attrs['nic'] = nic1

            if vlaned:
                network_attrs['vlan'] = VLAN

            netcreate = {NETWORK_NAME: network_attrs}

            with adapter.setupNetworks(netcreate, bondcreate, NOCHK):
                adapter.assertNetworkIp(NETWORK_NAME,
                                        netcreate[NETWORK_NAME])
开发者ID:nirs,项目名称:vdsm,代码行数:27,代码来源:static_ip_test.py


示例4: test_adding_a_net_with_mtu_lower_than_base_nic_mtu

    def test_adding_a_net_with_mtu_lower_than_base_nic_mtu(self, switch,
                                                           bridged, bonded):
        with dummy_devices(1) as (nic,):
            NETWORK1_ATTRS = {'bridged': bridged,
                              'vlan': VLAN1,
                              'mtu': 1000,
                              'switch': switch}
            NETNEW = {NETWORK1_NAME: NETWORK1_ATTRS}

            if bonded:
                NETWORK1_ATTRS['bonding'] = BOND_NAME
                BONDBASE = {BOND_NAME: {'nics': [nic], 'switch': switch}}
                link2monitor = BOND_NAME
            else:
                NETWORK1_ATTRS['nic'] = nic
                BONDBASE = {}
                link2monitor = nic

            with adapter.setupNetworks(NETNEW, BONDBASE, nftestlib.NOCHK):
                with nftestlib.monitor_stable_link_state(link2monitor):
                    adapter.assertLinkMtu(nic, NETWORK1_ATTRS)

                    if bonded:
                        vlan1 = BOND_NAME + '.' + str(
                            NETWORK1_ATTRS['vlan'])
                        adapter.assertLinkMtu(BOND_NAME, NETWORK1_ATTRS)
                    else:
                        vlan1 = nic + '.' + str(NETWORK1_ATTRS['vlan'])

                    adapter.assertLinkMtu(vlan1, NETWORK1_ATTRS)
开发者ID:nirs,项目名称:vdsm,代码行数:30,代码来源:link_mtu_test.py


示例5: test_mtu_default_value_of_base_nic_after_all_nets_are_removed

    def test_mtu_default_value_of_base_nic_after_all_nets_are_removed(self,
                                                                      switch,
                                                                      bridged,
                                                                      bonded):
        if switch == 'legacy' and bonded:
            pytest.xfail('BZ#1633528')
        with dummy_devices(1) as (nic,):
            NETWORK1_ATTRS = {'bridged': bridged,
                              'vlan': VLAN1,
                              'mtu': 1600,
                              'switch': switch}
            NETBASE = {NETWORK1_NAME: NETWORK1_ATTRS}
            DEFAULT_MTU = {'mtu': 1500}
            if bonded:
                NETWORK1_ATTRS['bonding'] = BOND_NAME
                BONDBASE = {BOND_NAME: {'nics': [nic], 'switch': switch}}
            else:
                NETWORK1_ATTRS['nic'] = nic
                BONDBASE = {}

            with adapter.setupNetworks(NETBASE, BONDBASE, nftestlib.NOCHK):
                adapter.setupNetworks(
                    {NETWORK1_NAME: {'remove': True}}, {}, nftestlib.NOCHK)

                adapter.assertLinkMtu(nic, DEFAULT_MTU)
                if bonded:
                    adapter.assertLinkMtu(BOND_NAME, DEFAULT_MTU)
开发者ID:nirs,项目名称:vdsm,代码行数:27,代码来源:link_mtu_test.py


示例6: test_bond_devices_are_up

 def test_bond_devices_are_up(self):
     with dummy_devices(2) as (nic1, nic2):
         with bond_device() as bond:
             bond.add_slaves((nic1, nic2))
             bond.up()
             self.assertTrue(iface(nic1).is_up())
             self.assertTrue(iface(nic2).is_up())
             self.assertTrue(iface(bond.master).is_up())
开发者ID:nirs,项目名称:vdsm,代码行数:8,代码来源:link_bond_test.py


示例7: test_configured_connections_attributes_existence

    def test_configured_connections_attributes_existence(self):
        with dummy_devices(1) as nics:
            with nm_connections(self.iface, IPV4ADDR, slaves=nics) as connames:
                nm_con = self._get_connection(connames[0])

                self.assertEqual(connames[0], nm_con.connection.id)
                self.assertIsNotNone(nm_con.connection.uuid)
                self.assertIsNotNone(nm_con.connection.type)
开发者ID:nirs,项目名称:vdsm,代码行数:8,代码来源:nmdbus_test.py


示例8: test_remove_all_non_active_connection_from_a_device

    def test_remove_all_non_active_connection_from_a_device(self):
        iface = iface_name()
        with dummy_devices(1) as nics:
            with nm_connections(iface, IPV4ADDR, slaves=nics, con_count=3):

                device = networkmanager.Device(iface)
                device.cleanup_inactive_connections()

                self.assertEqual(1, sum(1 for _ in device.connections()))
开发者ID:nirs,项目名称:vdsm,代码行数:9,代码来源:nm_test.py


示例9: test_remove_bond

    def test_remove_bond(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            BONDCREATE = {
                BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}
            BONDREMOVE = {BOND_NAME: {'remove': True}}

            with adapter.setupNetworks({}, BONDCREATE, NOCHK):
                adapter.setupNetworks({}, BONDREMOVE, NOCHK)
                adapter.assertNoBond(BOND_NAME)
开发者ID:oVirt,项目名称:vdsm,代码行数:9,代码来源:bond_basic_test.py


示例10: test_bond_options_with_the_mode_specified_last

    def test_bond_options_with_the_mode_specified_last(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            BONDCREATE = {BOND_NAME: {
                'nics': [nic1, nic2],
                'options': 'lacp_rate=fast mode=802.3ad',
                'switch': switch}}

            with adapter.setupNetworks({}, BONDCREATE, NOCHK):
                adapter.assertBond(BOND_NAME, BONDCREATE[BOND_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:9,代码来源:bond_basic_test.py


示例11: test_add_net_with_mtu

 def test_add_net_with_mtu(self, switch, bridged):
     with dummy_devices(1) as (nic,):
         NETCREATE = {NETWORK_NAME: {'nic': nic,
                                     'bridged': bridged,
                                     'mtu': 2000,
                                     'switch': switch}}
         with adapter.setupNetworks(NETCREATE, {}, nftestlib.NOCHK):
             adapter.assertNetwork(NETWORK_NAME, NETCREATE[NETWORK_NAME])
             adapter.assertLinkMtu(nic, NETCREATE[NETWORK_NAME])
开发者ID:nirs,项目名称:vdsm,代码行数:9,代码来源:link_mtu_test.py


示例12: test_bond_mode_1

    def test_bond_mode_1(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            BONDCREATE = {BOND_NAME: {
                'nics': [nic1, nic2],
                'options': 'mode=1 primary=' + nic1,
                'switch': switch}}

            with adapter.setupNetworks({}, BONDCREATE, NOCHK):
                adapter.assertBond(BOND_NAME, BONDCREATE[BOND_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:9,代码来源:bond_basic_test.py


示例13: test_add_bridge_with_custom_opts

 def test_add_bridge_with_custom_opts(self, switch):
     with dummy_devices(1) as (nic,):
         NETCREATE = {NETWORK_NAME: {
             'nic': nic,
             'switch': switch,
             'custom': {
                 'bridge_opts': 'multicast_snooping=0 multicast_router=0'}}}
         with adapter.setupNetworks(NETCREATE, {}, nftestlib.NOCHK):
             adapter.assertBridgeOpts(NETWORK_NAME,
                                      NETCREATE[NETWORK_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:10,代码来源:bridge_test.py


示例14: test_bond_create_failure_on_slave_add

    def test_bond_create_failure_on_slave_add(self):
        with dummy_devices(2) as (nic1, nic2):
            with bond_device() as base_bond:
                base_bond.add_slaves((nic1, nic2))

                bond_name = random_iface_name('bond_', max_length=11)
                with self.assertRaises(IOError):
                    with Bond(bond_name) as broken_bond:
                        broken_bond.create()
                        broken_bond.add_slaves((nic1, nic2))
                self.assertFalse(Bond(bond_name).exists())
开发者ID:nirs,项目名称:vdsm,代码行数:11,代码来源:link_bond_test.py


示例15: test_do_not_detach_slaves_while_changing_options

    def test_do_not_detach_slaves_while_changing_options(self):
        OPTIONS = {'miimon': '110'}

        with dummy_devices(2) as (nic1, nic2):
            with bond_device() as bond:
                bond.add_slaves((nic1, nic2))
                mock_slaves = bond.del_slaves = bond.add_slaves = mock.Mock()

                bond.set_options(OPTIONS)

                mock_slaves.assert_not_called()
开发者ID:nirs,项目名称:vdsm,代码行数:11,代码来源:link_bond_test.py


示例16: test_change_bond_slaves

    def test_change_bond_slaves(self, switch):
        with dummy_devices(3) as (nic1, nic2, nic3):
            BONDCREATE = {
                BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}
            BONDEDIT = {
                BOND_NAME: {'nics': [nic1, nic3], 'switch': switch}}

            with adapter.setupNetworks({}, BONDCREATE, NOCHK):
                with nftestlib.monitor_stable_link_state(BOND_NAME):
                    adapter.setupNetworks({}, BONDEDIT, NOCHK)
                    adapter.assertBond(BOND_NAME, BONDEDIT[BOND_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:11,代码来源:bond_basic_test.py


示例17: test_create_network_and_reuse_existing_owned_bridge

 def test_create_network_and_reuse_existing_owned_bridge(self, switch):
     with dummy_devices(2) as (nic1, nic2):
         NETSETUP1 = {NETWORK_NAME: {'nic': nic1, 'switch': switch}}
         NETSETUP2 = {NETWORK_NAME: {'nic': nic2, 'switch': switch}}
         with adapter.setupNetworks(NETSETUP1, {}, nftestlib.NOCHK):
             with _create_tap() as tapdev:
                 _attach_dev_to_bridge(tapdev, NETWORK_NAME)
                 with nftestlib.monitor_stable_link_state(NETWORK_NAME):
                     adapter.setupNetworks(NETSETUP2, {}, nftestlib.NOCHK)
                     adapter.assertNetwork(NETWORK_NAME,
                                           NETSETUP2[NETWORK_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:11,代码来源:bridge_test.py


示例18: test_bond_mode_change

 def test_bond_mode_change(self, switch):
     with dummy_devices(2) as nics:
         BONDCREATE = {BOND_NAME: {'nics': nics,
                                   'switch': switch,
                                   'options': 'mode=1 miimon=150'}}
         BONDEDIT = {BOND_NAME: {'nics': nics,
                                 'switch': switch,
                                 'options': 'mode=3'}}
         with adapter.setupNetworks({}, BONDCREATE, NOCHK):
             adapter.setupNetworks({}, BONDEDIT, NOCHK)
             adapter.assertBond(BOND_NAME, BONDEDIT[BOND_NAME])
开发者ID:oVirt,项目名称:vdsm,代码行数:11,代码来源:bond_basic_test.py


示例19: test_bond_slaves_order_does_not_affect_the_mac_address

    def test_bond_slaves_order_does_not_affect_the_mac_address(self, switch):
        with dummy_devices(2) as (nic1, nic2):
            bond1 = {BOND_NAME: {'nics': [nic1, nic2], 'switch': switch}}
            bond2 = {BOND_NAME: {'nics': [nic2, nic1], 'switch': switch}}

            with adapter.setupNetworks({}, bond1, NOCHK):
                bond1_hwaddr = adapter.netinfo.bondings[BOND_NAME]['hwaddr']
            with adapter.setupNetworks({}, bond2, NOCHK):
                bond2_hwaddr = adapter.netinfo.bondings[BOND_NAME]['hwaddr']

            assert bond1_hwaddr == bond2_hwaddr
开发者ID:oVirt,项目名称:vdsm,代码行数:11,代码来源:bond_basic_test.py


示例20: test_bond_exists

    def test_bond_exists(self):
        OPTIONS = {'mode': '1', 'miimon': '300'}
        with dummy_devices(2) as (nic1, nic2):
            with bond_device() as _bond:
                _bond.set_options(OPTIONS)
                _bond.add_slaves((nic1, nic2))
                _bond.up()

                bond = Bond(_bond.master)
                self.assertEqual(bond.slaves, set((nic1, nic2)))
                self.assertEqual(bond.options, OPTIONS)
开发者ID:nirs,项目名称:vdsm,代码行数:11,代码来源:link_bond_test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python models.Ambiente类代码示例发布时间:2022-05-27
下一篇:
Python network.WLAN类代码示例发布时间: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