From 0109446686954bcca27cc912042b00688f0c5aa8 Mon Sep 17 00:00:00 2001 From: edoardocoli Date: Sat, 24 Jun 2023 12:57:20 +0200 Subject: [PATCH] Mininet Update --- MininetNetPractice.py | 14 ++++++++++---- MininetTopo.conf | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/MininetNetPractice.py b/MininetNetPractice.py index cfe1e1c..f502942 100644 --- a/MininetNetPractice.py +++ b/MininetNetPractice.py @@ -73,17 +73,17 @@ def build_topology(config_file): elif parts[0] == 'linkRS': #Parse links routers to switches node1 = parts[1] node2 = parts[2] - # topo.addLink(node1, node2) + # topo.addLink TODO elif parts[0] == 'linkSS': #Parse links switches to switches node1 = parts[1] node2 = parts[2] - # topo.addLink(node1, node2) + # topo.addLink TODO elif parts[0] == 'linkSH': #Parse links switches to hosts node1 = parts[1] node2 = parts[2] - # topo.addLink(node1, node2) + # topo.addLink TODO return topo @@ -98,7 +98,13 @@ def run_topology(config_file): if line.startswith('#'): #Skip comment continue parts = line.split(" ") - if parts[0] == 'route': #Parse routing tables + if parts[0] == 'N_route': #Parse routing tables + name = parts[1] + pck_src = parts[2] + pck_nexthop = parts[3] + # cmd = 'ip route add ' + pck_src + ' via ' + pck_nexthop TODO + # (net.getNodeByName(name)).cmd(cmd) + elif parts[0] == 'route': #Parse routing tables name = parts[1] pck_src = parts[2] pck_nexthop = parts[3] diff --git a/MininetTopo.conf b/MininetTopo.conf index 1e935c9..b49471f 100644 --- a/MininetTopo.conf +++ b/MininetTopo.conf @@ -1,9 +1,9 @@ ######### Set Network Nodes ######### -## N_host name ## +## N_host name ## ## host name intfIP/mask defRoute ## -## N_router name ## +## N_router name ## ## router name intfIP/mask ## -## N_switch name ## +## N_switch name ## ##################################### # host H4 161.46.247.131/26 161.46.247.129 # host H3 161.46.247.196/27 161.46.247.195 @@ -14,7 +14,6 @@ N_host h1 N_host h2 N_router r1 N_router r2 -N_router r3 N_switch s1 N_switch s2 @@ -24,23 +23,25 @@ N_switch s2 ## reused in the links before new ## ## interfaces can be defined for the node.## ############################################# Set Network Links ############################################ +## NN_link node1, node2 ## ## linkRR router1, router1_intfName, router1_intfIP/mask, router2, router2_intfName, router2_intfIP/mask ## ## linkRH host, host_intfName, router, router_intfName, router_intfIP/mask ## -## linkRS ## -## linkSS switch1, switch2 ## -## linkSH switch, host ,host_intfName ## -## NN_link node1, node2 ## +## linkRS TODO ## +## linkSS TODO ## +## linkSH TODO ## ############################################################################################################ # linkRR R1 R13 161.46.247.254/30 R2 R21 161.46.247.253/30 # linkRH H3 H31 R2 R22 161.46.247.195/27 # linkRH H4 H41 R2 R23 161.46.247.129/26 + +NN_link s1 s2 NN_link r1 s1 NN_link r2 s2 -NN_link s1 s2 NN_link h1 s1 NN_link h2 s2 ################## Route Table ################ +## N_route TODO ## ## route name final_destIP/mask nextHop intf ## ############################################### # route R1 161.46.247.192/27 161.46.247.254 R13