How to Fetch the IP route rules reside in Namespaces using IPDB functionality

23 views
Skip to first unread message

rishi narian

unread,
Jan 16, 2019, 12:42:06 PM1/16/19
to pyroute2-dev
Hi,

   I have a requirement to fetch all ip rule list (policy tables) configured under namespace. I am using the IPDB functionality to fetch the same, but not getting the output.
   Could any one help me to get the ip rules using IPDB .


Trying using Below Logic:

   # Fetch all name space list
    namespace_list = netns.listnetns()

    # Get the namespace list
    for name in namespace_list:
        den = ''
       
        netns.setns(name)
        den = pyroute2.IPDB(nl=pyroute2.NetNS(name))

        # Get the Namespace Information from kernel
        for x in den.by_name.values():
              print x

Thanks
Rishi
Reply all
Reply to author
Forward
0 new messages