## 6 Network Topology Creation Using Mininet-WiFi
### Network Topology S2(5/6)1--Different Access Network and Shared Core, Railway Track Parallel to Road
When an IPv4 packet arrives at any access point/switch, it looks into its forwarding table/rules, and if there are no forwarding rules for that source and destination IP pair at the current switch/access point, the packet is sent to the ONOS controller for processing as an OpenFlow \"Packettin\" message. The application checks whether both source and destination IPs are in the same network slice (trains or cars), and if they are not, the packet drop rule is installed using the OpenFlow13 protocol at the current switch/access point. This implies that any traf c between cars to trains and to their assigned service server is disabled. If both source and destination IP pairs are in the same network slice, the application checks whether the data packet is tagged with a VLAN ID or not. If the data packet is not tagged with VLAN, and source and destination hosts are connected to the same access point/switch, the controller installs the forwarding rule using OpenFlow13 protocol at the current access point/switch, and the data packet is sent to the destination host/node. If the data packet is not tagged with a VLAN ID, and the source and destination host/node are connected to the same access point/switch, the data packet is tagged with a VLAN ID based on the network slice. For this forwarding application, the number 3 is used as the VLAN ID to tag the data packets from/to railways/rails, and the number 4 is used as the VLAN ID to tag the data packets from/to roads/cars. After tagging the data packet, the forwarding tag rule and forwarding untag rule are installed using the OpenFlow13 protocol at the current access point/switch for the IP pairs, and the data packet is forwarded to the next switch. If the data packet is tagged with a VLAN ID and the source and destination host/node are connected to the same access point/switch, the forward tag rule and untag rule are installed for the given source destination IP pair at the current access point/switch. If the data packet is tagged with a VLAN ID and the host/node is not connected to the same access point/switch, the forward rule is installed at the current access point/switch and the data packet is forwarded in the network. Figure 9: Flow diagram of SDN application. If nodes move from one location to another and connect to the nearest assigned access points, the developed application informs the controller via a \"Packettn\" message about the position of the nodes and connected access points. VLAN tagging is a mechanism that allows the creation of multiple networks at Layer 2 of the core network. VLAN tagging is carried out by assigning a VLAN ID to the data header as an additional element to the Ethernet header of a packet [38]. The assigned tag can be used as a \"ltering decision factor for the forwarding operation at switches/access points. The VLAN tag de ne s which side of the network part a data packet belongs to by matching the tag of the data packet header. Figure 10 shows data packet tagging with the VLAN mechanism used in the developed ONOS application. Switches S1, S2, S7, and S8 are the edge switches, and S3, S4, S5, and S6 are the core switches. Access points ap1, ap2 and ap3 are the access network elements for cars, and ap4, ap5, and ap6 are the access network elements for trains. When a data packet is sent from the car to CarServer, access point ap1 tags the data packet with VLAN ID: 4 (cars' slice) and forwards the packet to the next switch S3. Since the data packet is already tagged with a VLAN ID, S3 matches the VLAN ID and forwards the data packet to S5; it also matches the VLAN ID and sends the data packet into the network. When this data packet arrives at the edge switch S7 where the destination host CarServer is connected, it removes the VLAN ID and sends the data packet to the CarServer. A similar working principle is followed for the train's data. The access point ap4 tags the data packet with VLAN ID: 3 (train' slice). Core network switches S4 and S6 match the VLAN ID of the data packet and send the packet into the network.