本文整理汇总了Python中vnc_api.vnc_api.VirtualNetwork.set_mac_aging_time方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualNetwork.set_mac_aging_time方法的具体用法?Python VirtualNetwork.set_mac_aging_time怎么用?Python VirtualNetwork.set_mac_aging_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnc_api.vnc_api.VirtualNetwork
的用法示例。
在下文中一共展示了VirtualNetwork.set_mac_aging_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_provider_network
# 需要导入模块: from vnc_api.vnc_api import VirtualNetwork [as 别名]
# 或者: from vnc_api.vnc_api.VirtualNetwork import set_mac_aging_time [as 别名]
def test_provider_network(self):
'''
Verify:
1. Check creating a non-provider VNs with
non-provider VNs connected to it is not allowed
2. Check a non provider-VN can not be created
with is_provider_network property set to True
3. Check is_provider_network property of a
provider-VN is True by default
4. Check is_provider_network property of a
provider-VN can be set as True
5. Check is_provider_network property of provider-VN
can not be set as False
6. Check is_provider_network property of non provider-VN
can not be set as True
7. Check is_provider_network property of non provider-VN
can be set as False
8. Check setting other parameters of a non provider-VN
is not affected
9. Check db_resync sets is_provider_network property
of provider-VN as True (simulating upgrade case)
10. Check non provider VNs can be added to
provider VN
11. Check the provider-VN can be added to a VN
12. Check non provider-VN can not be added to a VN
13. Check many VNs can be linked to the provider-VN
14. Check (provider-vn -> any-VN),DENY acl rule is added to
the provider-VN
15. Check (VN -> provider-VN),DENY acl rule is added to
the VN
16. Adding a (VN -> provider-VN),PASS acl rule at VN removes
(VN -> provider-VN),DENY acl rule
Assumption: ip-fabric VN is the provider-VN
'''
# create two VNs - vn1, vn2
vn1_name = self.id() + '_vn1'
vn2_name = self.id() + '_vn2'
vn3_name = self.id() + '_vn3'
vn4_name = self.id() + '_vn4'
vn1_obj1 = VirtualNetwork(vn1_name)
vn2_obj1 = VirtualNetwork(vn2_name)
vn3_obj1 = VirtualNetwork(vn3_name)
vn4_obj1 = VirtualNetwork(vn4_name)
self._vnc_lib.virtual_network_create(vn1_obj1)
self._vnc_lib.virtual_network_create(vn2_obj1)
self._vnc_lib.virtual_network_create(vn3_obj1)
# try creating non provider_vn with linked
# non provider_vn (linked before creating)
vn4_obj1.add_virtual_network(vn3_obj1)
self.assertRaises(BadRequest,
self._vnc_lib.virtual_network_create,
vn4_obj1)
vn4_obj1.add_virtual_network(vn2_obj1)
self.assertRaises(BadRequest,
self._vnc_lib.virtual_network_create,
vn4_obj1)
# remove vn3_obj1 and vn2_obj1
# as its not allowed
vn4_obj1.del_virtual_network(vn3_obj1)
vn4_obj1.del_virtual_network(vn2_obj1)
# set is_provider_network on a non provider-vn
# and try creating it
vn4_obj1.set_is_provider_network(True)
self.assertRaises(BadRequest,
self._vnc_lib.virtual_network_create,
vn4_obj1)
# set it as False and retry creating it
vn4_obj1.set_is_provider_network(False)
self._vnc_lib.virtual_network_create(vn4_obj1)
# Check updating other parameters of a non provider VN
# when no provider VN is not connected
vn4_obj1.set_mac_aging_time(400)
self._vnc_lib.virtual_network_update(vn4_obj1)
# retrieve provider network, assuming ip-fabric for now
provider_fq_name = ['default-domain', 'default-project', 'ip-fabric']
provider_vn = self._vnc_lib.virtual_network_read(
fq_name=provider_fq_name)
self.assertEqual(provider_vn.get_is_provider_network(), True)
# check is_provider_network of provider_vn
# can be set to True (ie only as its default)
provider_vn.set_is_provider_network(True)
self._vnc_lib.virtual_network_update(provider_vn)
# check is_provider_network of provider_vn
# can not be set to False
provider_vn.set_is_provider_network(False)
self.assertRaises(BadRequest,
self._vnc_lib.virtual_network_update,
provider_vn)
# check is_provider_network of non provider_vn
# can be set to False
#.........这里部分代码省略.........