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


Python data_utils.rand_mac_address函数代码示例

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


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

示例1: test_update_port_mixed_ops

    def test_update_port_mixed_ops(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()
        extra = {'key1': 'value1', 'key2': 'value2'}

        _, port = self.create_port(node_id=node_id, address=address,
                                   extra=extra)

        new_address = data_utils.rand_mac_address()
        new_extra = {'key1': 0.123, 'key3': {'cat': 'meow'}}

        patch = [{'path': '/address',
                  'op': 'replace',
                  'value': new_address},
                 {'path': '/extra/key1',
                  'op': 'replace',
                  'value': new_extra['key1']},
                 {'path': '/extra/key2',
                  'op': 'remove'},
                 {'path': '/extra/key3',
                  'op': 'add',
                  'value': new_extra['key3']}]

        self.client.update_port(port['uuid'], patch)

        _, body = self.client.show_port(port['uuid'])
        self.assertEqual(new_address, body['address'])
        self.assertEqual(new_extra, body['extra'])
开发者ID:NeetaP,项目名称:tempest,代码行数:28,代码来源:test_ports.py

示例2: test_update_port_mixed_ops_integrity

    def test_update_port_mixed_ops_integrity(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()
        extra = {'key1': 'value1', 'key2': 'value2'}

        _, port = self.create_port(node_id=node_id, address=address,
                                   extra=extra)
        port_id = port['uuid']

        new_address = data_utils.rand_mac_address()
        new_extra = {'key1': 'new-value1', 'key3': 'new-value3'}

        patch = [{'path': '/address',
                  'op': 'replace',
                  'value': new_address},
                 {'path': '/extra/key1',
                  'op': 'replace',
                  'value': new_extra['key1']},
                 {'path': '/extra/key2',
                  'op': 'remove'},
                 {'path': '/extra/key3',
                  'op': 'add',
                  'value': new_extra['key3']},
                 {'path': '/nonexistent',
                  'op': 'replace',
                  'value': 'value'}]

        self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,
                          patch)

        # patch should not be applied
        _, body = self.client.show_port(port_id)
        self.assertEqual(address, body['address'])
        self.assertEqual(extra, body['extra'])
开发者ID:Dynavisor,项目名称:tempest,代码行数:34,代码来源:test_ports_negative.py

示例3: test_rand_mac_address

    def test_rand_mac_address(self):
        actual = data_utils.rand_mac_address()
        self.assertIsInstance(actual, str)
        self.assertRegexpMatches(actual, "^([0-9a-f][0-9a-f]:){5}"
                                         "[0-9a-f][0-9a-f]$")

        actual2 = data_utils.rand_mac_address()
        self.assertNotEqual(actual, actual2)
开发者ID:overcastcloud,项目名称:tempest-lib,代码行数:8,代码来源:test_data_utils.py

示例4: test_list_ports_details_with_address

    def test_list_ports_details_with_address(self):
        node_id = self.node["uuid"]
        address = data_utils.rand_mac_address()
        self.create_port(node_id=node_id, address=address)
        for i in range(0, 5):
            self.create_port(node_id=node_id, address=data_utils.rand_mac_address())

        _, body = self.client.list_ports_detail(address=address)
        self.assertEqual(1, len(body["ports"]))
        self.assertEqual(address, body["ports"][0]["address"])
开发者ID:ionutbalutoiu,项目名称:ironic,代码行数:10,代码来源:test_ports.py

示例5: test_update_port_malformed_port_uuid

    def test_update_port_malformed_port_uuid(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()

        self.create_port(node_id=node_id, address=address)

        new_address = data_utils.rand_mac_address()
        self.assertRaises(lib_exc.BadRequest, self.client.update_port,
                          uuid='malformed:uuid',
                          patch=[{'path': '/address', 'op': 'replace',
                                  'value': new_address}])
开发者ID:Dynavisor,项目名称:tempest,代码行数:11,代码来源:test_ports_negative.py

示例6: test_update_port_replace_mac_with_duplicated

    def test_update_port_replace_mac_with_duplicated(self):
        node_id = self.node['uuid']
        address1 = data_utils.rand_mac_address()
        address2 = data_utils.rand_mac_address()

        _, port1 = self.create_port(node_id=node_id, address=address1)

        _, port2 = self.create_port(node_id=node_id, address=address2)
        port_id = port2['uuid']

        patch = [{'path': '/address',
                  'op': 'replace',
                  'value': address1}]
        self.assertRaises(lib_exc.Conflict,
                          self.client.update_port, port_id, patch)
开发者ID:Dynavisor,项目名称:tempest,代码行数:15,代码来源:test_ports_negative.py

示例7: setUp

    def setUp(self):
        super(TestPorts, self).setUp()

        _, self.chassis = self.create_chassis()
        _, self.node = self.create_node(self.chassis['uuid'])
        _, self.port = self.create_port(self.node['uuid'],
                                        data_utils.rand_mac_address())
开发者ID:NeetaP,项目名称:tempest,代码行数:7,代码来源:test_ports.py

示例8: test_create_port_duplicated_mac

 def test_create_port_duplicated_mac(self):
     node_id = self.node['uuid']
     address = data_utils.rand_mac_address()
     self.create_port(node_id=node_id, address=address)
     self.assertRaises(lib_exc.Conflict,
                       self.create_port, node_id=node_id,
                       address=address)
开发者ID:Dynavisor,项目名称:tempest,代码行数:7,代码来源:test_ports_negative.py

示例9: test_update_port_remove

    def test_update_port_remove(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()
        extra = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}

        _, port = self.create_port(node_id=node_id, address=address,
                                   extra=extra)

        # Removing one item from the collection
        self.client.update_port(port['uuid'],
                                [{'path': '/extra/key2',
                                 'op': 'remove'}])
        extra.pop('key2')
        _, body = self.client.show_port(port['uuid'])
        self.assertEqual(extra, body['extra'])

        # Removing the collection
        self.client.update_port(port['uuid'], [{'path': '/extra',
                                               'op': 'remove'}])
        _, body = self.client.show_port(port['uuid'])
        self.assertEqual({}, body['extra'])

        # Assert nothing else was changed
        self.assertEqual(node_id, body['node_uuid'])
        self.assertEqual(address, body['address'])
开发者ID:NeetaP,项目名称:tempest,代码行数:25,代码来源:test_ports.py

示例10: test_create_port_malformed_port_uuid

    def test_create_port_malformed_port_uuid(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()
        uuid = 'malformed:uuid'

        self.assertRaises(lib_exc.BadRequest, self.create_port,
                          node_id=node_id, address=address, uuid=uuid)
开发者ID:Dynavisor,项目名称:tempest,代码行数:7,代码来源:test_ports_negative.py

示例11: test_delete_port

    def test_delete_port(self):
        node_id = self.node["uuid"]
        address = data_utils.rand_mac_address()
        _, port = self.create_port(node_id=node_id, address=address)

        self.delete_port(port["uuid"])

        self.assertRaises(lib_exc.NotFound, self.client.show_port, port["uuid"])
开发者ID:ionutbalutoiu,项目名称:ironic,代码行数:8,代码来源:test_ports.py

示例12: _get_ips_from_subnet

 def _get_ips_from_subnet(self, **kwargs):
     subnet = self.create_subnet(self.network, **kwargs)
     port_mac = data_utils.rand_mac_address()
     port = self.create_port(self.network, mac_address=port_mac)
     real_ip = next(iter(port['fixed_ips']), None)['ip_address']
     eui_ip = data_utils.get_ipv6_addr_by_EUI64(subnet['cidr'],
                                                port_mac).format()
     return real_ip, eui_ip
开发者ID:TonyChengTW,项目名称:OpenStack_Liberty_Control,代码行数:8,代码来源:test_dhcp_ipv6.py

示例13: test_create_port

    def test_create_port(self):
        node_id = self.node['uuid']
        address = data_utils.rand_mac_address()

        _, port = self.create_port(node_id=node_id, address=address)

        _, body = self.client.show_port(port['uuid'])

        self._assertExpected(port, body)
开发者ID:NeetaP,项目名称:tempest,代码行数:9,代码来源:test_ports.py

示例14: test_create_port_with_extra

    def test_create_port_with_extra(self):
        node_id = self.node["uuid"]
        address = data_utils.rand_mac_address()
        extra = {"str": "value", "int": 123, "float": 0.123, "bool": True, "list": [1, 2, 3], "dict": {"foo": "bar"}}

        _, port = self.create_port(node_id=node_id, address=address, extra=extra)

        _, body = self.client.show_port(port["uuid"])
        self._assertExpected(port, body)
开发者ID:ionutbalutoiu,项目名称:ironic,代码行数:9,代码来源:test_ports.py

示例15: test_create_port_specifying_uuid

    def test_create_port_specifying_uuid(self):
        node_id = self.node["uuid"]
        address = data_utils.rand_mac_address()
        uuid = data_utils.rand_uuid()

        _, port = self.create_port(node_id=node_id, address=address, uuid=uuid)

        _, body = self.client.show_port(uuid)
        self._assertExpected(port, body)
开发者ID:ionutbalutoiu,项目名称:ironic,代码行数:9,代码来源:test_ports.py


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