Sunday, 1 September 2013

Software Defined Networking - Tutorial (In Making)

Hi Friends,

I am new to this world of Software Defined Networking (SDN) , which many (even I ) believe will revolutionize how we look at the computer networking. I took a course on SDN in coursera (https://www.coursera.org/) under Prof. Nick, Georgia Tech. I am trying to put here what I learnt, my assignments, etc., . Your suggestions are welcome.

Thanks.

                                                SOFTWARE DEFINED NETWORKING (SDN)

INTRODUCTION:
SDN is an emerging network architecture where the control plane is decoupled from the data plane of the network equipment. As a result, the network intelligence and state are logically centralized, and the underlying network infrastructure is abstracted from the applications. Please refer to [1].
Open Flow protocol:
Open Flow protocol helps in establishing the communication between the control and data planes of supported network devices.

SDN Controllers (POX)
POX is a python based SDN controller.
Features:
It supports only Open Flow v1.0
Advantages:
Widely used, maintained, and supported.
Relatively easy to read and write the code.
Disadvantage:
Low Performance

Tutorial on POX controller
TOPOLOGY (Fig 1):

 












 


To verify the working of the SDN controller, we use a MININET, a network emulator to create the topology. The following section gives an insight into MININET and the useful API’s to create the topology.
Mininet is a network emulator. It runs a collection of end-hosts, switches, routers, and links on a single linux kernel. It uses a lightweight virtualization to make a single system look like a complete network, running the same kernel, system, and user code.
Working with the MININET:
a.      Creating the Topology
Important classes, methods, functions, and variables to code the topology in python

Topo: the base class for Mininet topologies. Base class:
addSwitch() : adds a switch to a topology and returns the switch name
addHost():adds a host to a topology and returns the host name
addLink(): adds a bidirectional link to a topology
Mininet: main class to create and manage a network
start(): Starts your netwok
pingAll(): tests connectivity by trying to have all nodes ping each other
stop(): Stops your network
net.hosts: all the hosts in  a network
dumpNodeConnections(): dumps connections to/from a set of nodes.
setLogLevel(‘info’|’debug’|’output’): set Mininet’s default output level; ‘info’ is recommended as it provides useful information.
b.      Useful VI Editor commands
a.      “ i “ – Insert the text after opening (sudo vi filename.py)
b.      “ :q “ – Quit without saving
c.       “ :wq “ – Save and quit


MININET TOPOLOGY TEMPLATE:
Please look for the comments, which helps you to place the logic for the topology of your wish.
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel

class Topo_of_wish(Topo):
    #"Single switch connected to n hosts."
    def __init__(self, n=2, **opts):
        # Initialize topology and default options
        Topo.__init__(self, **opts)
        “””
         Please enter the logic for the Topology you wish to perform
         “””
def simpleTest():
    #"Create and test a simple network"
    topo = Topo_of_wish(n=4)
    net = Mininet(topo)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    net.stop()

if __name__ == '__main__':
    # Tell mininet to print useful information
    setLogLevel('info')
    simpleTest()

Example 1
The logic for the single switch topology shown in Fig 1 is written in the class Topo_of_wish present in the above template:


The following screen shot shows the network cnnectivity and start of Topology construction and stop of Topology




Example 2

Data center Networks:
The Data center Networks are generally tree-like topology. End-hosts connect to top-of-rack switches, which form the leaves (edges) of the tree; one or more switches form the root; and one or more layers of aggregation switches form the middle of the tree. In a basic tree topology, each switch (except the core switch) has a single parent switch. Additional switches and links may be added to construct more complex tree topologies (e.g., fat tree) in an effort to improve fault tolerance or increase inter-rack bandwidth.



                                                Figure : 2

The following snapshot gives the logic to write the structure of the topology.


                                    POX CONTROLLER
The POX controller is a python based controller. The POX controller is worked on the single switch topology shown in example 1 (Figure 1)
a.      Useful POX API’s
1.      connection.send( … ) function sends an Open Flow message to a switch. When a connection to a switch start, a ConnectionUp event is fired. The above code invokes a _handle_ConnectionUp() function that implements the a particular application logic.
2.      ofp_action_output class is an action for use with ofp_packet_out and ofp_flow_mod. It specifies a switch port that you wish to send the packet out of. It can also take various “special” port numbers. For instance, to create an output action that would send packets to all ports except the port on which the packet originally arrived on. out_action = of.ofp_action_output(port = of.OFPP_FLOOD)
3.      ofp_match the objects of this class describe packet header fields and an input port to match on. All fields are optional – items that are not specified are “wildcards” and will match on anything.
Some notable fields of ofp_match objects are:
dl_src – The data link layer (MAC) source address
dl_dst – The data link layer (MAC) destination address
in_port – The packet input switch port
Example: Create a match that matches packets arriving on port 3:
match = of.ofp_match()
match.in_port = 3
4.      ofp_packet_out message instructs a switch to send a packet. The packet might be one constructed at the controller, or it might be one that the switch received, buffered, and forwarded to the controller. Notable fields are:
buffer_id – The buffer_id of a buffer you wish to send. Do not set if you are sending a constructed packet.
data – Raw bytes you wish the switch to send. Do not set if you are sending a buffered packet.
actions – A list of actions to apply
in_port – The port number this packt initially arrived on if you are sending by buffer_id, otherwise OFPP_NONE.
5.      ofp_flow_mod
This instructs a switch to install a flow table entry. Flow table entries match some fields of incoming packets, and executes some list of actions on matching packets. The actions are the same as for ofp_packet_out, mentioned above. The match is described by an ofp_match object.
Notable fields are:
idle_timeout – Number of idle seconds before the flow entry is removed. Defaults to no idle timeout.
hard_timeout – Number of seconds before the flow entry is removed. Defaults to no timeout.
actions – A list of actions on matching packets (e.g., ofp_action_output)
priority – When using non-exact (wildcarded) matches, this specifies the priority for overlapping matches. Higher values are higher priority. Not important for exact or non-overlapping entries.
buffer_id – The buffer_id of a buffer to apply the actions to immediately. Leave unspecified for none.
in_port – If using a buffer_id, this is the associated input port.
match – An ofp_match object. By default, this matches everything, so you should probably set some of its fields!
Example: Create a flow_mod that sends pavckets from port 3 out of port 4.
Fm = of.ofp_flow_mod ()
Fm.match.in_port = 3
Fm.actions.append(ofp_action_output( port = 4))

How to make the POX controllers use the MININET topology created ?
When you do not specify the controller when creating the topology, it will be treated as ovsc controller (default).
The above shows a POX controller to which an application has to be written.
            def  _handle_ConnectionUp(event):
                        msg = of.ofp_flow_mod()
                        msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD))
                        event.connection.send(msg)  
log.info("Hubifying    %s",     dpidToStr(event.dpid))
            def       launch  ():        
core.openflow.addListenerByName("Connec-onUp",_handle_ConnectionUp)       
log.info("Hub  running.")





Monday, 27 August 2012

Cross Cultural differences between US and India


 “When in Rome, do as the Romans” is an old adage which holds good in every transition phase of our life. So, we should be flexible in our thoughts about our transitions to attain substantial results. In my two weeks stay at Boulder, Colorado, I found significant differences in the life styles of the people in the United States and my home country, India. Apart from the superficial differences in clothing, food and accent, there are various other differences which are not quite vivid but play a major role in our success. Out of such, the adhering paragraphs point out three major differences in the perception of the people in the United States and India, which are time, individualism and communication style. At last, I shall explain how the change to new ideologies shall help me succeed.
First, in regards to the differences in the perception of time, Americans value time more than money (1) and they are punctual. In India, I used to take a cushion of ten minutes in the meetings schedule and it never created problem to me. Whereas in the US, I observed people get frustrated when things don’t go as per the schedule. I feel that adapting to the US perception of time will definitely help us to succeed, as it encourages us to be punctual. One more striking difference is that Americans are monochronic in nature contrary to the polychronic attitude of many Indians. This is because Americans believe interpersonal relations are subordinate to present schedule (2). I feel that becoming monochronic shall help us to focus one thing at a time and achieve success.
Second, in case of the concept of individualism, there exist lots of differences in the way people of these countries believe in it. Americans tend to be more individualistic in nature. It is evident in the way many Americans come out of their families when they are 18 (3). Whereas, in India we tend to be more dependent on our parents and always put their decision above our own decision. I strongly feel that we should enjoy every moment of our life and do what we wish. It gives us immense pleasure in our work even we fail in it.  
Third, the difference in the communication style between the US and India is quite a common issue. In India, we tend to be wordy in our communications, whether it be praising someone or raising a concern. For suppose, we have a problem with a person, we try to be indirect in our expression of concern just to maintain good relations with the person in future. In the united states, I observed that people tend to express a problem with an another person in a concise and direct manner though with a smile. This is certainly an issue which we can imbibe in us. The simple thumb rule is, you are not paid for your words.
 In conclusion, no culture is supreme. However, we can observe that the transition to the American ideologies from a few of Indian ones pertaining to the perception of time, individualism and communication style shall definitely help us to be punctual, focused and achieve success. Just to reiterate, we should be flexible in our thought process in adapting to a particular culture when you are there. I am supremely confident that the transition shall help me to achieve success in the next two years at University of Colorado, Boulder.



References:
1.      Baca, Matt., Dieter Bruhn“The ITP graduate preparatory session” university of Colorado-boulder. Boulder. CO.  20 Aug.2012
2.      Hahn, Harley. “Time sense: Polychronicity versus Monochronicity” http://www.harley.com/writing/time-sense.html.  Web. 22 Aug.2012
3.      Huq, Hasina, “Three in ten young adults live with their parents” http://www.csmonitor.com/USA/Society/2012/0315/Three-in-10-young-adults-live-with-parents-highest-level-since-1950s . Web. 22 Aug.2012

Wednesday, 2 May 2012

Convex Optimization Theory

" The greatest watershed in optimization is not between linearity and non linearity , but convexity and non convexity"

The fundamental idea behind the above mentioned claim is that the " local minimum of a convex formulation is the global minimum".  The mathematical proof is available in Stephen Boyd's text book on the optimization theory.

History of Convex Optimization Theory:

 Though the use of the convex optimization in the "Engineering applications" seem to be relatively new, its mathematical treatment is available in  1900 Russian literature. 

Applications of Convex Optimization:

a. System design, analysis and operation.
b. Problems arising in network design and operation, finance, supply chain management, scheduling.
c. Embedded Optimization 

Embedded optimization should be extremely reliable and shall also take predictable amount of time when convex optimization is used.

The challenges in the formulating the convex problems and the conditions for a problem to be convex will be discussed in the later ..... Time for lunch guyzzz....