+ debug + stringify
This commit is contained in:
parent
615e0f89ef
commit
4b52b12846
1 changed files with 16 additions and 14 deletions
|
@ -92,19 +92,6 @@ class L2Controller(object):
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def add_host_ips(host, net, ipaddr, dev):
|
|
||||||
subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev])
|
|
||||||
for v6dev in [ "lo", "default", "all", dev ]:
|
|
||||||
subprocess.call(["mx", host, "sysctl", "net.ipv6.conf.{}.disable_ipv6=0".format(v6dev)])
|
|
||||||
|
|
||||||
# Set down & up to regain link local address
|
|
||||||
subprocess.call(["mx", host, "ip", "link", "set", dev, "down"])
|
|
||||||
subprocess.call(["mx", host, "ip", "link", "set", dev, "up"])
|
|
||||||
|
|
||||||
# Now add global address
|
|
||||||
subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev])
|
|
||||||
|
|
||||||
def init_ndp(self):
|
def init_ndp(self):
|
||||||
""" initialise neighbor discovery protocol"""
|
""" initialise neighbor discovery protocol"""
|
||||||
|
|
||||||
|
@ -186,7 +173,22 @@ class L2Controller(object):
|
||||||
net = ipaddress.ip_network(v6route['net'])
|
net = ipaddress.ip_network(v6route['net'])
|
||||||
ipaddr = net[1]
|
ipaddr = net[1]
|
||||||
|
|
||||||
self.add_host_ips(host, net, ipaddr, dev)
|
self.add_host_ips(host, str(net), str(ipaddr), dev)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def add_host_ips(host, net, ipaddr, dev):
|
||||||
|
log.debug("Config host: {} {}->{} on {}".format(host, net, ipaddr, dev)
|
||||||
|
|
||||||
|
subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev])
|
||||||
|
for v6dev in [ "lo", "default", "all", dev ]:
|
||||||
|
subprocess.call(["mx", host, "sysctl", "net.ipv6.conf.{}.disable_ipv6=0".format(v6dev)])
|
||||||
|
|
||||||
|
# Set down & up to regain link local address
|
||||||
|
subprocess.call(["mx", host, "ip", "link", "set", dev, "down"])
|
||||||
|
subprocess.call(["mx", host, "ip", "link", "set", dev, "up"])
|
||||||
|
|
||||||
|
# Now add global address
|
||||||
|
subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev])
|
||||||
|
|
||||||
def debug_print_pkg(self, pkg, msg="INCOMING"):
|
def debug_print_pkg(self, pkg, msg="INCOMING"):
|
||||||
log.debug("{}: {}".format(msg, pkg.__repr__()))
|
log.debug("{}: {}".format(msg, pkg.__repr__()))
|
||||||
|
|
Loading…
Reference in a new issue