當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。