Begin router support
This commit is contained in:
parent
b0f3f5ea85
commit
22da39377e
2 changed files with 8 additions and 2 deletions
|
@ -71,6 +71,7 @@
|
||||||
| | - icmp6 echo request working in controller | |
|
| | - icmp6 echo request working in controller | |
|
||||||
| | - Hosts can ping6 the switch | |
|
| | - Hosts can ping6 the switch | |
|
||||||
| | - Ran into P4 casting bug: https://github.com/p4lang/p4c/issues/1765 | |
|
| | - Ran into P4 casting bug: https://github.com/p4lang/p4c/issues/1765 | |
|
||||||
|
| | -> seems to be more than just casting bug | |
|
||||||
| | | |
|
| | | |
|
||||||
| | Next target: | |
|
| | Next target: | |
|
||||||
| | - Focus on enabling the "Internet" with ICMP6 translation | |
|
| | - Focus on enabling the "Internet" with ICMP6 translation | |
|
||||||
|
|
|
@ -194,11 +194,12 @@ class L2Controller(object):
|
||||||
dev = "{}-eth0".format(host)
|
dev = "{}-eth0".format(host)
|
||||||
net = v6route['net']
|
net = v6route['net']
|
||||||
ipaddr = "{}/{}".format(net[1],net.prefixlen)
|
ipaddr = "{}/{}".format(net[1],net.prefixlen)
|
||||||
|
router = net[self.info['switch_suffix']]
|
||||||
|
|
||||||
self.add_host_ips(host, str(net), str(ipaddr), dev)
|
self.config_v6_host(host, str(net), str(ipaddr), dev, router)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_host_ips(host, net, ipaddr, dev):
|
def config_v6_host(host, net, ipaddr, dev, router=None):
|
||||||
log.debug("Config host: {} {}->{} on {}".format(host, net, ipaddr, dev))
|
log.debug("Config host: {} {}->{} on {}".format(host, net, ipaddr, dev))
|
||||||
|
|
||||||
subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev])
|
subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev])
|
||||||
|
@ -212,6 +213,10 @@ class L2Controller(object):
|
||||||
# Now add global address
|
# Now add global address
|
||||||
subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev])
|
subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev])
|
||||||
|
|
||||||
|
# add default gw if in router mode
|
||||||
|
if router:
|
||||||
|
subprocess.call(["mx", host, "ip", "route", "add", "default", "via", router])
|
||||||
|
|
||||||
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