How to get the Namespace Identifier (ID) using pyroute2 functionality.

17 views
Skip to first unread message

daren...@gmail.com

unread,
Mar 15, 2018, 3:45:02 PM3/15/18
to pyroute2-dev
Hi,

   I am using pyroute2 functionality to fetch the namespace information.  In linux Machine.

 bash# ip netns ls 
vdhd (id: 4)
atrt (id: 3)
prtest (id: 2)
rc_fd (id: 1)
wtest (id: 0)
main

I would like to fetch the id's of namespace using pyroute2 IPDB functionality with out referring the values()

The below code prints the namespace names configures in kernel.

   # Get the Namespace Information from kernel
    namespace_list = []
    namespace_list = netns.listnetns()
    print namespace_list
  

The below code prints the namespace ID  present in the interface, but i would like to fetch directly.(Is there a way).

         ipden = pyroute2.IPDB(nl=pyroute2.NetNS(name))
    for x in ipden.by_name.values():
      print x.link_netnsid


Thanks
Daren

Peter Saveliev

unread,
Mar 17, 2018, 2:55:21 AM3/17/18
to daren k, pyroute2-dev
This functionality is not implemented yet, but I try to do it asap.

--
You received this message because you are subscribed to the Google Groups "pyroute2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages