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


Python NetworkHelper.get_fdb_entry方法代码示例

本文整理汇总了Python中f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper.get_fdb_entry方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkHelper.get_fdb_entry方法的具体用法?Python NetworkHelper.get_fdb_entry怎么用?Python NetworkHelper.get_fdb_entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper的用法示例。


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

示例1: test_add_remove_fdbs

# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper import NetworkHelper [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.network_helper.NetworkHelper import get_fdb_entry [as 别名]
def test_add_remove_fdbs(bigip, icontrol_driver):
    """ Test simulating L2 pop events to add/remove fdb entries."""

    net_helper = NetworkHelper()
    tunnels = list()
    fdb_entries = list()

    seg_id_start = 167
    seg_id_end = 176
    n_records = 9 

    # create tunnels on BIG-IP, and fake fdb entries
    for seg_id in range(seg_id_start, seg_id_end):
        tunnel_name = 'tunnel-vxlan-{}'.format(seg_id)
        model = {
            'name': tunnel_name,
            'key': seg_id,
            'profile': 'vxlan_ovs',
            'localAddress': '201.0.155.10'}
        net_helper.create_multipoint_tunnel(bigip.bigip, model)
        tunnels.append(tunnel_name)

        # create a set of fdb entries that reference network seg ID
        for _ in range(n_records):
            entry = create_fdb_entry(seg_id)
            fdb_entries.append(entry)

    # add fdb entries
    for fdb_entry in fdb_entries:
        # mimic neutron L2 pop add_fdb_entries
        icontrol_driver.fdb_add(fdb_entry)

    for fdb_entry in fdb_entries:
        # mimic neutron L2 pop add_fdb_entries
        icontrol_driver.fdb_add(fdb_entry)

    # check created
    for tunnel_name in tunnels:
        records = net_helper.get_fdb_entry(bigip.bigip, tunnel_name=tunnel_name)
        assert records

    # remove fdb entries
    for fdb_entry in fdb_entries:
        # mimic neutron L2 pop remove_fdb_entries
        icontrol_driver.fdb_remove(fdb_entry)

    # check removed
    for tunnel_name in tunnels:
        records = net_helper.get_fdb_entry(bigip.bigip, tunnel_name=tunnel_name)
        assert not records
        net_helper.delete_tunnel(bigip.bigip, tunnel_name)
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:53,代码来源:test_l2_pop.py


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