コード例 #1
0
 def add(event, ifaces):
     print("add interface %s" % (event['dev']))
     if not ifaces.has_key(event['index']):
         ifaces['by-name'][event['dev']] = ifaces[
             event['index']] = interface(event)
     else:
         print("already exists, skippin'")
コード例 #2
0
ファイル: ip_playback.py プロジェクト: svinota/cx
 def add(event, ifaces):
     print("add interface %s" % (event["dev"]))
     if not ifaces.has_key(event["index"]):
         ifaces["by-name"][event["dev"]] = ifaces[event["index"]] = interface(event)
     else:
         print("already exists, skippin'")
コード例 #3
0
#!/usr/bin/env python

from __future__ import print_function
from cxnet.netlink.iproute2 import iproute2
from ip_playback import sync
from ip_interface import interface
from time import sleep
from pprint import pprint

#
# startup: init objects
#

print("8<-------------------- init")
ifaces = dict([(x['index'], interface(x)) for x in iproute2.get_all_links()])
[ifaces[x['index']]['addresses'].append(x) for x in iproute2.get_all_addrs()]
print("8<-------------------- init results")
[print(x) for x in ifaces.items()]
#
# playback log records
#
print("8<-------------------- sleep")
sleep(20)
print("8<-------------------- log playback")
sync(ifaces)
print("8<-------------------- playback results")
pprint(ifaces)

#
# results
#
コード例 #4
0
ファイル: ip_objects.py プロジェクト: svinota/cx
#!/usr/bin/env python

from __future__ import print_function
from cxnet.netlink.iproute2 import iproute2
from ip_playback import sync
from ip_interface import interface
from time import sleep
from pprint import pprint

#
# startup: init objects
#

print("8<-------------------- init")
ifaces = dict([ (x['index'],interface(x)) for x in iproute2.get_all_links() ])
[ ifaces[x['index']]['addresses'].append(x) for x in iproute2.get_all_addrs() ]
print("8<-------------------- init results")
[ print(x) for x in ifaces.items() ]
#
# playback log records
#
print("8<-------------------- sleep")
sleep(20)
print("8<-------------------- log playback")
sync(ifaces)
print("8<-------------------- playback results")
pprint(ifaces)

#
# results
#