++todos; begin router mode
This commit is contained in:
parent
2cafdc5e12
commit
c4a4e370f0
4 changed files with 52 additions and 7 deletions
11
doc/plan.org
11
doc/plan.org
|
@ -7,13 +7,14 @@
|
|||
| | Write mail / phone | x |
|
||||
| 2019-02-22 | Have all papers handed in | |
|
||||
| | | |
|
||||
| 2019-02-23 | python2 / ipaddress is buggy | |
|
||||
| 2019-02-23 | python2 / ipaddress is buggy | x |
|
||||
| | p4utils is python2 only support | |
|
||||
| | bmpy_utils is not installable with pip | |
|
||||
| | python2 / latest ipaddress==1.0.22 still has the bug | |
|
||||
| | ipaddress.ip_network("2001:db8:61::/64") | |
|
||||
| | IPv6Network(u'3230:3031:3a64:6238:3a36:313a:3a2f:3634/128') | |
|
||||
| | | |
|
||||
| | egress routing | x |
|
||||
| | | |
|
||||
| | | |
|
||||
| 2019-02-28 | Meet Laurent #2 | |
|
||||
|
@ -64,7 +65,10 @@
|
|||
*** TODO Implement ICMP <-> ICMP6 translation
|
||||
**** DONE Parse icmp
|
||||
**** DONE Parse icmpv6
|
||||
**** TODO Add (static) egress configuration
|
||||
**** DONE Add (static) egress configuration
|
||||
**** TODO Make switch answer icmp6 echo request for
|
||||
**** TODO Make switch answer icmp echo request for
|
||||
**** TODO Add default route for v6 and v4 hosts
|
||||
**** TODO Translate icmp <-> icmp6
|
||||
**** TODO Create table entry for mapping v4->v6 [net]
|
||||
**** TODO Create table entry for mapping v6->v4 [net]
|
||||
|
@ -80,8 +84,7 @@
|
|||
**** See time table above
|
||||
*** Additional features queue (to be discussed)
|
||||
**** TODO Offset based translation (v4->v6) -> same as range (?)
|
||||
**** TODO IP address learning (v6/v4) for real life switch?
|
||||
|
||||
**** TODO IP address learning (v6/v4) for real life switch? How do hosts find it?
|
||||
** Thesis documentation
|
||||
*** Motivation
|
||||
TBD
|
||||
|
|
|
@ -18,14 +18,16 @@ import subprocess
|
|||
# Broken in python2
|
||||
#import ipaddress
|
||||
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger("main")
|
||||
|
||||
class L2Controller(object):
|
||||
def __init__(self, sw_name):
|
||||
# Command line mapping
|
||||
self.modes = ['base']
|
||||
self.modes = ['base', 'router']
|
||||
|
||||
|
||||
self.address_suffix = 42
|
||||
|
||||
# Network / egress
|
||||
self.v6_mask = "64"
|
||||
|
@ -35,6 +37,7 @@ class L2Controller(object):
|
|||
self.v6_routes['base'] = []
|
||||
self.v6_routes['base'].append({ "net": "2001:db8:61::", "port": "1"})
|
||||
self.v6_routes['base'].append({ "net": "2001:db8:62::", "port": "2"})
|
||||
self.v6_routes['router'] = self.v6_routes['base']
|
||||
|
||||
self.v4_mask = "24"
|
||||
self.v4_routes = {}
|
||||
|
@ -42,6 +45,17 @@ class L2Controller(object):
|
|||
self.v4_routes['base'] = []
|
||||
self.v4_routes['base'].append({ "net": "10.0.41.", "port": "3"})
|
||||
self.v4_routes['base'].append({ "net": "10.0.42.", "port": "4"})
|
||||
self.v4_routes['router'] = self.v4_routes['base']
|
||||
|
||||
self.v6_addresses = {}
|
||||
self.v6_addresses[None] = []
|
||||
self.v6_addresses['base'] = []
|
||||
self.v6_addresses['router'] = [ { "addr": "{}{}".format(n['net'], self.address_suffix), "port": n['port'] } for n in self.v6_routes['router'] ]
|
||||
|
||||
self.v4_addresses = {}
|
||||
self.v4_addresses[None] = []
|
||||
self.v4_addresses['base'] = []
|
||||
self.v4_addresses['router'] = [ { "addr": "{}{}".format(n['net'], self.address_suffix), "port": n['port'] } for n in self.v4_routes['router'] ]
|
||||
|
||||
self.init_boilerplate(sw_name)
|
||||
|
||||
|
@ -82,6 +96,7 @@ class L2Controller(object):
|
|||
self.fill_tables()
|
||||
self.config_hosts()
|
||||
|
||||
|
||||
def fill_tables(self):
|
||||
self.controller.table_clear("v6_routing")
|
||||
for v6route in self.v6_routes[self.mode]:
|
||||
|
@ -93,6 +108,12 @@ class L2Controller(object):
|
|||
net = self.prefix_to_net(v4route['net'], self.v4_mask)
|
||||
self.controller.table_add("v4_routing", "set_egress_port", [net], [v4route['port']])
|
||||
|
||||
self.controller.table_clear("v6_addresses")
|
||||
for v6addr in self.v6_addresses[self.mode]:
|
||||
self.controller.table_add("v6_address", "icmp6_answer", [v6addr['addr']], [v4addr['port']])
|
||||
|
||||
|
||||
|
||||
def config_hosts(self):
|
||||
""" Assumptions:
|
||||
- all routes are networks (no /128 v6 or /32 v4
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
|
||||
#define THE_ANSWER_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING 42 /* Important constant */
|
||||
#define ROUTING_TABLE_SIZE 64 /* maximum routes per protocol */
|
||||
#define ADDRESS_TABLE_SIZE 64 /* maximum number of addresses per protocol */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,11 +16,31 @@ control MyIngress(inout headers hdr,
|
|||
inout metadata meta,
|
||||
inout standard_metadata_t standard_metadata) {
|
||||
|
||||
/********************** ADDRESS TABLES ***********************************/
|
||||
action icmp6_answer(port_t port) {
|
||||
/* do something:
|
||||
- change src/dst
|
||||
- change type
|
||||
*/
|
||||
}
|
||||
|
||||
table v6_addresses {
|
||||
key = {
|
||||
hdr.ipv6.dst_addr: exact;
|
||||
}
|
||||
actions = {
|
||||
icmp6_answer;
|
||||
NoAction;
|
||||
}
|
||||
size = ADDRESS_TABLE_SIZE;
|
||||
default_action = NoAction;
|
||||
|
||||
}
|
||||
|
||||
/********************** ROUTING (egress definiton) TABLES ***********************************/
|
||||
action set_egress_port (port_t out_port) {
|
||||
standard_metadata.egress_spec = out_port;
|
||||
}
|
||||
|
||||
table v6_routing {
|
||||
key = {
|
||||
hdr.ipv6.dst_addr: lpm;
|
||||
|
|
Loading…
Reference in a new issue