Date: Thu, 28 Mar 2024 15:27:29 +0000 (UTC) Message-ID: <1710541625.801.1711639649187@ip-10-30-146-46.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_800_1469882424.1711639649184" ------=_Part_800_1469882424.1711639649184 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page isn't so much about configuring the software switches&= nbsp;=E2=80=93 these switches don't need any configuration =E2=80=93 i= t's more about setting up a Mininet network that reflects the network configuration loaded on the = controller.
First, create a network topology file the usual way using the Mininet To= pology API. See an example here: srTopo8.py
Add hosts and switches
host1 = =3D self.addHost( 'h1' ) s1 =3D self.addSwitch('s1')
Add links between switches, and connect hosts to switches
self.a= ddLink( host1, s1) self.addLink( s1, s2 )
Then create another file that loads the Topology file you created above.= This file will create the network and connect the switches to the controll= er.
See an example of such a file here: sr_cpqd_full.py
Load the topo file
from sr= Topo8 import SRTopo ... #omitted lines topo =3D SRTopo()
Make sure you use the CPqD switch (UserSwitch) and not the default OVS s= witch, and point the switches to the remote controller (or local controller= if you use localhost)
net =3D= alterNet(topo=3Dtopo, switch=3DUserSwitch, controller=3Dpartial(RemoteCont= roller,ip=3D'127.0.0.1'))
The Mininet Topology API does not currently allow us to create multiple = links between the same pair of switches. Thus we need to use a different AP= I (the Net API) to create extra links.
We do so by loading the switches from the 'net' and adding more links
#adding= extra links between routers s1, s2, s3, s4, s5, s6, s7, s8 =3D net.switches net.addLink( s7, s8 ) net.addLink( s7, s8 ) net.addLink( s3, s1 ) net.addLink( s2, s5 ) net.addLink( s3, s4 ) net.start()
This example shows all the extra links created in the prototype used in = the demo prototype vide= os.
Next we need to configure the hosts with the correct IP and Gateway info= rmation
# host = h1 is attached to router s1 h1.setIP("10.200.1.2/24") h1.setMAC("00:00:00:00:01:02") setDefaultRoute(h1, "10.200.1.1")
The example above, shows that host h1's IP and MAC addresses are set usi= ng the setIP and setMAC api calls. It also shows that the default gateway f= or host h1 is 10.200.1.1. Note that this default gateway has to be configur= ed in the configuration= file loaded on the controller - specifically in the 'subnet' field of = the switch configuration.
Finally note that the configuration at the controller currently requires= the configuration of the links in the network. This can be useful in scena= rios where the network operator wishes to consider the configuration as the= 'golden rule' - in such cases, if a network link is wired incorrectly, the= the controller will figure out that the discovered link does not match the= configuration, and will disallow the link from being used in the network -= i.e. no traffic will use the link. On the other hand, it can be cumbersome= at times to configure all the network links in the controller config file.= It can especially be tricky when using a Mininet based network, because th= e Mininet APIs used above do not allow the user to specify the ports = when adding a link using addLink. Thus in order to get the controller confi= guration right, we need to create the network, connect it to the controller= , figure out which port-numbers Mininet used to create the links, use those= port numbers in the controller config file, and finally reload the control= ler.
Once the python files are created in mininet/custom directory, use the f= ollowing command to launch Mininet
# sudo = ./mininet/custom/sr_cpqd_full.py
See Using the CLI section = to verify that the correct switches and links have been discovered by the c= ontroller.