test_rpc_get_lwaftr_state.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:vmx-docker-lwaftr 作者: Juniper 项目源码 文件源码
def snabb_state(query_output):
    root = ET.fromstring(query_output)
    print ("<snabb>")
    for instance in root:
        # In each instance, we need to query the id, pci, pid.
        print ("<instance>")
        for child in instance:
            PRINT_TAG(child, "id")
            PRINT_TAG(child,"pid")
        PRINT_TAG(child,"next_hop_mac_v4")
        PRINT_TAG(child,"next_hop_mac_v6")
        #child = None
        #for child in instance:
        if child.tag == "pci":
                for pcis in child:
                    for pci_child in pcis:
                            PRINT_TAG(pci_child,"rxpackets")
                            PRINT_TAG(pci_child,"txpackets")
                            PRINT_TAG(pci_child,"rxdrop")
                            PRINT_TAG(pci_child,"txdrop")
        print "</instance>"
    print ("</snabb>")
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号