Home | History | Annotate | Download | only in tests
      1 import netlink.core as netlink
      2 import netlink.route.capi as capi
      3 import netlink.route.link as link
      4 
      5 sock = netlink.lookup_socket(netlink.NETLINK_ROUTE)
      6 
      7 cache = link.LinkCache()
      8 cache.refill(sock)
      9 
     10 testtap1 = cache['testtap1']
     11 print testtap1
     12 
     13 lbr = link.Link()
     14 lbr.type = 'bridge'
     15 lbr.name = 'testbridge'
     16 print lbr
     17 lbr.add()
     18 
     19 cache.refill(sock)
     20 lbr = cache['testbridge']
     21 print lbr
     22 
     23 lbr.enslave(testtap1)
     24 cache.refill(sock)
     25 testtap1 = cache['testtap1']
     26 
     27 print capi.rtnl_link_is_bridge(lbr._rtnl_link)
     28 print capi.rtnl_link_get_master(testtap1._rtnl_link)
     29