Search code examples
rpcjuniperpyez

PyEZ: RPC: Get route info for specific grandchild element


I want to get wia RPC info like this:

> show route output interface ae40.4181 | display xml rpc 
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.4R2/junos">
    <rpc>
        <get-route-information>
            <output>
                        <interface>ae40.4181</interface>
                    </output>
            </get-route-information>
        </rpc>
        <cli>
            <banner></banner>
        </cli>
    </rpc-reply>

How shloud I pass these parameters to dev.rpc.get_route_information?

Which are other possible ways to get this info?


Solution

  • try using dev.execute for this case

    for example

    rpc = '''<get-route-information>
                <output><interface>ae40.4181</interface>
                        </output>
                </get-route-information>'''
    dev.execute(rpc)
    

    let me know if you face any issue