(This only works for Linux network namespaces for now, until FreeBSD and OpenVZ have been ported to using the
cored.py
Python daemon.)
cored.py
Python daemon.)
Use of the Tk::Img library was added to CORE. This allows you to use various image types besides just the GIFs that were supported before -- such as JPG, PNG, TIF, etc. Now the custom node icon and canvas wallpaper dialogs accept various image types.
or
# for RedHat/Fedora
yum install tkimg
# for Debian/Ubuntu
sudo apt-get install libtk-img
core/python/examples/netns/
. Here is a snippet from one of the samples, how you would make N nodes connected to a switch:
from core import pycore
from core.misc import ipaddr
def main:
...
# IP subnet
prefix = ipaddr.IPv4Prefix("10.83.0.0/16")
session = pycore.Session()
# emulated ethernet switch
switch = session.addobj(cls = pycore.nodes.SwitchNode)
print "creating %d nodes with addresses from %s" % \
(options.numnodes, prefix)
for i in xrange(1, options.numnodes + 1):
tmp = session.addobj(cls = pycore.nodes.LxcNode, name = "n%d" % i)
tmp.newnetif(switch, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
tmp.cmd(["sysctl", "net.ipv4.icmp_echo_ignore_broadcasts=0"])
n.append(tmp)
# start a shell on node 1
n[1].term("bash")