本文整理汇总了Python中pyvcloud.vcd.gateway.Gateway.get_dhcp方法的典型用法代码示例。如果您正苦于以下问题:Python Gateway.get_dhcp方法的具体用法?Python Gateway.get_dhcp怎么用?Python Gateway.get_dhcp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.gateway.Gateway
的用法示例。
在下文中一共展示了Gateway.get_dhcp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_0098_teardown
# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_dhcp [as 别名]
def test_0098_teardown(self):
"""Remove the DHCP ip pools of gateway.
Invokes the delete_pool of the DhcpPool.
"""
gateway = Environment. \
get_test_gateway(TestDhcp._client)
gateway_obj = Gateway(TestDhcp._client,
TestDhcp._name,
href=gateway.get('href'))
dhcp_resource = gateway_obj.get_dhcp()
for ip_pool in dhcp_resource.ipPools.ipPool:
dhcp_pool_object = DhcpPool(TestDhcp._client, self._name,
ip_pool.poolId)
dhcp_pool_object.delete_pool()
dhcp_resource = gateway_obj.get_dhcp()
self.assertFalse(hasattr(dhcp_resource.ipPools, 'ipPool'))
示例2: test_0100_add_dhcp_pool
# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_dhcp [as 别名]
def test_0100_add_dhcp_pool(self):
"""Add DHCP pool in the gateway.
Invokes the add_dhcp_pool of the gateway.
"""
gateway_obj = Gateway(
TestGateway._client, self._name,
Environment.get_test_gateway(Environment.get_sys_admin_client())
.get('href'))
gateway_obj.add_dhcp_pool(TestGateway._pool_ip_range)
dhcp_resource = gateway_obj.get_dhcp()
# Verify
matchFound = False
for ipPool in dhcp_resource.ipPools.ipPool:
if ipPool.ipRange.text == TestGateway._pool_ip_range:
matchFound = True
break
self.assertTrue(matchFound)
示例3: test_0105_add_dhcp_binding
# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_dhcp [as 别名]
def test_0105_add_dhcp_binding(self):
"""Add DHCP Binding in the gateway.
Invokes the add_dhcp_binding of the gateway.
"""
gateway_obj = Gateway(
TestGateway._client, self._name,
Environment.get_test_gateway(Environment.get_sys_admin_client())
.get('href'))
gateway_obj.add_dhcp_binding(TestGateway._mac_address,
TestGateway._host_name,
TestGateway._binding_ip_address)
dhcp_resource = gateway_obj.get_dhcp()
# Verify
matchFound = False
for static_binding in dhcp_resource.staticBindings.staticBinding:
if static_binding.macAddress.text == TestGateway._mac_address:
matchFound = True
break
self.assertTrue(matchFound)
示例4: test_0000_setup
# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_dhcp [as 别名]
def test_0000_setup(self):
"""Add DHCP pool in the gateway.
Invokes the add_dhcp_pool of the gateway.
"""
TestDhcp._client = Environment.get_sys_admin_client()
TestDhcp._config = Environment.get_config()
gateway = Environment. \
get_test_gateway(TestDhcp._client)
gateway_obj = Gateway(TestDhcp._client,
TestDhcp._name,
href=gateway.get('href'))
gateway_obj.add_dhcp_pool(TestDhcp._pool_ip_range)
dhcp_resource = gateway_obj.get_dhcp()
# Verify
matchFound = False
for ipPool in dhcp_resource.ipPools.ipPool:
if ipPool.ipRange.text == TestDhcp._pool_ip_range:
matchFound = True
break
self.assertTrue(matchFound)