Exemple #1
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
#
Exemple #2
0
    port = py9p.PORT
    address = 'localhost'
    dbg = False

    for i,k in opt:
        if i == "-D":
            dbg = True
        if i == "-p":
            port = int(k)
        if i == "-l":
            address = k

    print("%s:%s, debug=%s" % (address,port,dbg))
    storage = Storage(RootDir)
    srv = py9p.Server(listen=(address, port), chatty=dbg, dotu=True)
    srv.mount(v9fs(storage))

    ifaces = {}
    ifaces['by-name'] = dict([ (x['dev'],x) for x in ifaces.values() ])
    iproute2.get_all_links()
    iproute2.get_all_addrs()
    storage.root.sync()
    storage.root.children["interfaces"].ifaces = ifaces
    storage.root.children["interfaces"].subst_map = ifaces['by-name']

    s = Thread(target=sync,name="sync thread",args=(ifaces,True))
    s.daemon = True
    s.start()

    srv.serve()
Exemple #3
0
    port = py9p.PORT
    address = 'localhost'
    dbg = False

    for i, k in opt:
        if i == "-D":
            dbg = True
        if i == "-p":
            port = int(k)
        if i == "-l":
            address = k

    print("%s:%s, debug=%s" % (address, port, dbg))
    storage = Storage(RootDir)
    srv = py9p.Server(listen=(address, port), chatty=dbg, dotu=True)
    srv.mount(v9fs(storage))

    ifaces = {}
    ifaces['by-name'] = dict([(x['dev'], x) for x in ifaces.values()])
    iproute2.get_all_links()
    iproute2.get_all_addrs()
    storage.root.sync()
    storage.root.children["interfaces"].ifaces = ifaces
    storage.root.children["interfaces"].subst_map = ifaces['by-name']

    s = Thread(target=sync, name="sync thread", args=(ifaces, True))
    s.daemon = True
    s.start()

    srv.serve()
Exemple #4
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
#