## 6 Network Topology Creation Using Mininet-WiFi
### Network Topology S2(5/6)1--Different Access Network and Shared Core, Railway Track Parallel to Road  
A Python script is written to create a network topology with Mininet-Wifi where trains and cars have different access networks, both domains shared the core network, and railways have parallel tracks to roads. Figure 3 shows the S2(5/6)1 scenario, where an ONOS SDN controller programmatically controls the forwarding elements of the topology. The network switches and access points are SDN-based devices and they are operated and  
Figure 2: Test setup overview. controlled via OpenFlow protocol. Host Car1 represents a car, and host Train1 represents a rail. Access points ap1 and ap2 are defined for roads, and ap3 and ap4 are defined for railways. Access points ap1 and ap3 are connected to network switch S11, and ap2 and ap4 are connected to switch S33. The switch S22 is connected to S11 and S33. The host \"RailServer\" is defined as a railways service server, and \"CarServer\" is defined as a road service server: both servers are connected to switch S22. In this simple network topology, switch S22 is the core network switch, and S11 and S33 are the edge switches. The network topology can be complex with more core and edge network elements. For the demonstration, a simple topology is selected. In Figure 3, we can see that railways and roads have different access networks but a shared core network. To design this scenario, a topology development code is written in Python. The source code of this complete project is available at [26]. As we mentioned, for this practical work, the ONOS SDN controller is used. To define the ONOS as a remote controller as the element of the topology, the code given in Listing 1 is used as the Python topology code. To use the remote controller in Mininet-WiFi, port 6653 is assigned to the ONOS controller defined as \"c1\". Since Mininet-WiFi and the SDN controller are executed from the same virtual machine/laptop, IP '127.0.0.1' is assigned to the controller. ```
'Create_a_network.' net=Mininet_wifi(topo=None, build=False, ipBase=\"192.168.0.0/24') info('...Adding_Remote_controller\
' ) c1=net.addController(name='c1', controller=RemoteController, ip=\"127.0.0.1',protocol=\"tcp',port=6653)
```  
After adding the ONOS controller, network switches and access points are defined. To define the switches, _net.addSwitch()_ with \"OpenFlow13\" protocol is used, as shown in Listing 2. Using _net.addSwitch()_, three Open Virtual Kernel switches (OVS), S11, S22, and S33, are defined that work on \"OpenFlow13\" protocol. The command _net.addStation()_ is used to define the cars and trains because it has the capability of defining the moving functionality and speed of the host. The hosts \"CarServer\" and \"RailServer\" are defined using the _net.addHost()_. The _args_0 function is used to define the initial location of the moving nodes. Figure 3: S2(5/6)1: Different Access Network and Shared Core, Track Parallel to Road. ```
info('...Add_switches\
') s11=net.addSwitch(s11',cls=OVSKernelSwitch,protocols=\"OpenFlow13\") info('...Creatingnodes\
'') Train1_args,Car1_args=dict(),dict() If'-s'inargs: Train1_args['position'],Car1_args['position'] ='30,10,0','30,320,0' Train1=net.addStation('Train',mac='00:00:00:00:00:01', ip='192.168.7.101/24',position='30,10,0','...Train1_args) Car1=net.addStation('Car1',mac='00:00:00:00:02', ip='192.168.0.201/24',position='30,320,0','...Car1_args) info('...Add_hosts_for_Service_Server\
') CarServer=net.addHost('CarServer',cls=Host, ip='192.168.0.204/24',mac='00:00:00:00:00:08') RailServer=net.addHost('RailServer',cls=Host, ip='192.168.7.104/24',mac='00:00:00:00:07')
```  
Listing 2: Defining the Moving Host and Server Host. To define the access points in Mininet-Wifi, _net.addAccessPoint()_ is used as shown in Listing 3. It provides the ability to define and assign parameters such as the position of the access point, mode, operating channel, transmitting power in dBm, and coverage range in meters.