Commit 6843028c authored by Federico Sismondi's avatar Federico Sismondi

Merge branch 'agent_routing_to_second_network_options' into 'master'

CoAP client network prefix must be aaaa::/64,CoAP server network prefix must be cccc::/64

See merge request !31
parents 08bd0719 d2b21800
......@@ -253,6 +253,14 @@ For more information: README.md
"""
# validate correct use of network for client and for server when using agent as a router mode
# TODO echo back to user diagram of expected network setup when using agent as a router features
if re_route_packets_prefix and re_route_packets_host and re_route_packets_if:
if 'client' in name and re_route_packets_prefix is not 'aaaa':
raise Exception('CoAP client network prefix must be aaaa::/64 when using agent as a router mode')
elif 'server' in name and re_route_packets_prefix is not 'cccc':
raise Exception('CoAP server network prefix must be cccc::/64 when using agent as a router mode')
p = urlparse(url)
data = {
"user": p.username,
......
......@@ -470,7 +470,7 @@ class OpenTunLinux(object):
# (show ping packet on wireshark but don't send to mote at all)
# TODO write predefined networking diagram
second_optional_wsn_network_prefix = 'aaaa' if 'client' in self.name else 'cccc'
second_optional_wsn_network_prefix = 'cccc' if 'client' in self.name else 'aaaa'
static_routes = [
'ip -6 route add ' + self.ipv6_prefix + ':1415:9200::/96 dev ' + self.ifname + ' metric 1',
......@@ -491,10 +491,13 @@ class OpenTunLinux(object):
# =====
log.info('\ncreated following virtual interface:')
log.info('-'*72)
os.system('ip addr show ' + self.ifname)
log.info('-' * 72)
log.info('\nupdate routing table:')
os.system('netstat -rn')
os.system('ip -6 route show')
log.info('-' * 72)
# =====
except IOError as err:
# happens when not root
......@@ -709,7 +712,7 @@ class OpenTunMACOS(object):
# (show ping packet on wireshark but don't send to mote at all)
# TODO write predefined networking diagram
second_optional_wsn_network_prefix = 'aaaa' if 'client' in self.name else 'cccc'
second_optional_wsn_network_prefix = 'cccc' if 'client' in self.name else 'aaaa'
static_routes = [
'route add -inet6 {0}:1415:9200::/96 -interface {1}'.format(self.ipv6_prefix, self.ifname),
......@@ -734,11 +737,13 @@ class OpenTunMACOS(object):
# =====
log.info('\ncreated following virtual interface:')
print('-'*72)
os.system('ifconfig {0}'.format(self.ifname))
print('-' * 72)
log.info('\nupdate routing table:')
os.system('netstat -rn')
os.system('ip -6 route show')
print('-' * 72)
# =====
# =====start radvd
# os.system('radvd start')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment