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