# SDN_NFV Lab1: Environment Setup and Basic Operation ###### tags: `SDN_NFV` <style> .red { color: red; } </style> <style> .blue { color: blue; } </style> <style> .green { color: green; } </style> ## Part1 ### Q1: When ONOS activates **org.onosproject.openflow** ,” what are the APPs which it also activates? ### Q1_Ans: When <span class = 'green'>**org.onosproject.openflow**</span> activated, the following three apps are also acticated simultanously as the snapshot shown. 1. <span class = 'blue'>**org.onosproject.optical-model**</span> 2. <span class = 'blue'>**org.onosproject.lidpprovider**</span> 3. <span class = 'blue'>**org.onosproject.openflow-base**</span> ![](https://i.imgur.com/m7ggBa9.png) ### Q2: As topology in p.22, can H1 ping H2 successfully? Why or why not?? ### Q2_Ans: Before activating <span class = 'green'>org.onosproject.fwd</span>, the ping **failed** as the snapshot shown below. The reason why the ping failed is that there are no flows installed on the data-plane. The forwarding flows can be installed by activating the simple <span class = 'blue'>Reactive Forwarding app, org.onosproject.fwd</span>. ![](https://i.imgur.com/oWFBGSS.png) After <span class = 'green'>org.onosproject.fwd</span> is activated, the ping **succeeded** as the snapshot shown below. ![](https://i.imgur.com/xjjhH3F.png) ### Q3: Which TCP port the controller listens for the OpenFlow connection request from the switch? ### Q3_Ans: Controllers should listen on <span class = 'green'>**TCP port 6653**</span> for switches that want to set up a connection. ### Q4: In question 3, which APP enables the controller to listen on the TCP port? ### Q4_Ans: As the two snapshot below shown, when <span class = 'green'>org.openproject.openflow</span> is <span class = 'red'>deactivated</span>, protocal tcp port 6653 is <span class = 'red'>disabled</span>. When <span class = 'green'>org.openproject.openflow</span> is activated, protocal tcp port 6653 is <span class = 'blue'>enabled</span>. ![](https://i.imgur.com/TKro5wc.png) ![](https://i.imgur.com/EFb0Su3.png) ## Part 2: Create a Custom Topology This is my Python script to build the Topology, and the following snapshot is the result of execution. ```python= from mininet.topo import Topo class project1_Topo_110112042( Topo ): def __init__( self ): Topo.__init__( self ) # Add hosts h1 = self.addHost( 'h1' ) h2 = self.addHost( 'h2' ) h3 = self.addHost( 'h3' ) # Add switches s1 = self.addSwitch( 's1' ) s2 = self.addSwitch( 's2' ) s3 = self.addSwitch( 's3' ) s4 = self.addSwitch( 's4' ) # Add links self.addLink( h1, s1 ) self.addLink( h2, s2 ) self.addLink( h3, s3 ) self.addLink( s1, s4 ) self.addLink( s2, s4 ) self.addLink( s3, s4 ) topos = { 'topo_part2_110112042': project1_Topo_110112042 } ``` ![](https://i.imgur.com/fpgrfnC.png) As the result snapshot above: Three hosts, h1, h2 and h3 is added. Four switches, s1, s2, s3, s4 is added. Six links, h1-s1, h2-s2, h3-s3, s1-s4, s2-s4, s3-s4 is added. Pingall test result: h1, h2, h3 can ping each other successfully. ## Part 3:Part 3: Statically Assign Hosts IP Address In Mininet ```python= from mininet.topo import Topo class project1_Topo_110112042( Topo ): def __init__( self ): Topo.__init__( self ) # Add hosts h1 = self.addHost( 'h1', ip='192.168.0.1/27') h2 = self.addHost( 'h2', ip='192.168.0.2/27') h3 = self.addHost( 'h3', ip='192.168.0.3/27') # Add switches s1 = self.addSwitch( 's1' ) s2 = self.addSwitch( 's2' ) s3 = self.addSwitch( 's3' ) s4 = self.addSwitch( 's4' ) # Add links self.addLink( h1, s1 ) self.addLink( h2, s2 ) self.addLink( h3, s3 ) self.addLink( s1, s4 ) self.addLink( s2, s4 ) self.addLink( s3, s4 ) topos = { 'topo_part3_110112042': project1_Topo_110112042 } ``` ![](https://i.imgur.com/Nfikg3i.png) If the ip bit length is 27 bit, it means that the ip mask is 225.225.225.224 for they both mean the last 5 bit is unchangable in the subnet. The snapshot shows that the ip of the hosts are: h1 : 192.168.0.1 h2 : 192.168.0.2 h3 : 192.168.0.3 Also, pingall test had passed and the subnet mask is 255.255.255.224 ## Part 4: What you’ve learned or solved 1. Install and launch ONOS and MININET 2. Activate and deactivate ONOS apps and observe their influence on netstate, ping test and others. 3. Write python scripts to create custom topologies and assign the properties of hosts and switches by modifying scripts. 4. Learn to use ONOS to control network component such as hosts, switches and links and observe its interaction with MININET.