Docstoc

OSPF Finite State Machine Simulator

Document Sample
OSPF Finite State Machine Simulator Powered By Docstoc
					Interface State Machine Simulator                                    12/17/2011




                    OSPF Finite State Machine Simulator




                                             By
                                    Raja Sirisha Cholleti

                                Cholleti@uwm.edu
                    CS-999: Independent Study (Capstone Project)
                               Semester: Spring 2006



                                         Advisor:
                                     Dr. Mukul Goyal


                            University of Wisconsin-Milwaukee
                        College of Engineering and Applied Science
                                       PO Box: 784
                            Milwaukee, Wisconsin 53201-0784



                                            Date
                                         05/08/2006




Raja Sirisha Cholleti                                                        1
Interface State Machine Simulator                                                   12/17/2011



Executive Summary:

         The objective of this project is to develop a simulator for the interface and

neighbor state machines followed by an OSPF interface. The interaction between these

finite state machines can become quite complicated as the network topology and the

sequence of external events vary. Correctly understanding this interaction becomes

important for people concerned with network operation and protocol implementation. We

hope that the proposed simulator will be useful in this context as well as an educational

tool for understanding the behavior of the OSPF protocol.

         Project accomplished developing the simulator for interface state machine of the

OSPF interface. It included gathering the information about the interface and neighbor

state machine of the OSPF-RFC2328. The project allows the user to specify the network

topology and the initial state of the OSPF interfaces of interest. This software will allow

the user to select an interface and an external event that arrives next on this interface. To

facilitate the event selection, the simulator displays all valid events that can be invoked

on the selected interface in its current state. When the user selects the event, the simulator

runs the state machines until the sequence of internal events generated as a result have

been processed generating user-readable output in the process. The simulator output will

show the sequence of state transitions for the selected interface and the internal event

generated in the process.

         This project used the C++ language and the Flex interpreter on UNIX

environment.




Raja Sirisha Cholleti                                                                       2
Interface State Machine Simulator              12/17/2011




Table of Contents:

    1. Introduction                       4

    2. Theory                             6

    3. Process                            11

    4. User Documentation                 12

    5. Conclusion                         12

    6. References                         13

    7. Appendix                           14

             1) Interface State Machine

             2) UML Diagram

             3) Test Log

             4) Code




Raja Sirisha Cholleti                                  3
Interface State Machine Simulator                                                 12/17/2011




Introduction:
         An OSPF interface is a connection between the router and a network. The finite

state machine followed by an OSPF interface consists of two components: interface state

machine and neighbor state machine. The interface state machine is concerned with the

selection of a leader on the network and the neighbor state machine is concerned with the

establishment of adjacency with a neighbor router on the network. The interface and

neighbor state machine are connected together via a set of events. Some of these events

are external and trigger a transition in interface/neighbor state machines. Other events are

internal and are generated as a result of a transition in interface/neighbor state machines.

Further, a transition in interface state machine may generate an internal event for the

neighbor state machine and vice-versa. For example, when the event InterfaceDown is

invoked on the interface, an internal event KillNbr is generated for the neighbor state

machine.

         The interaction between the OSPF finite state machines can become quite

complicated as the network topology and the sequence of external events vary. Correctly

understanding this interaction becomes important for people concerned with network

operation and protocol implementation. We hope that the proposed simulator will be

useful in this context as well as an educational tool for understanding the behavior of the

OSPF protocol.




Raja Sirisha Cholleti                                                                      4
Interface State Machine Simulator                                               12/17/2011


Scope:
Scope of the project includes:

     Developing the specifications for interface state machine and router state machine

         based on the available OSPF RFC-2328.

     Designing the system using UML.

     Developing the interface state machine system using C++ language and Flex

         interpreter.

     Testing: Scope of the testing includes Unit testing and Functional testing.

     Documentation of the project.

Literatures used in this project are OSPF – RFC 2328, 2154, C++ articles, and articles on

Flex interpreter.




Raja Sirisha Cholleti                                                                   5
Interface State Machine Simulator                                                   12/17/2011



Theory: [RFC-2328]

         An OSPF interface is a connection between the router and a network. This

Interface belongs to the area that has attached network. All router protocol packets

originated from this router contains this interfaces area ID. An OSPF router converses

with its neighbor routers. Each conversation is bound to one particular router interface.

The finite state machine followed by an OSPF interface consists of two components:

interface state machine and neighbor state machine.

         The interface state machine is concerned with the selection of a leader on the

network and the neighbor state machine is concerned with the establishment of adjacency

with a neighbor router on the network. However adjacencies are always established with

routers connected by point-to-point networks, Point-to-MultiPoint networks and virtual

links. On broadcast and NBMA networks, all routers establish adjacency to both the

Designated Router and the Backup Designated Router. The interface and neighbor state

machine are connected together via a set of events. Some of these events are external and

trigger a transition of the router in one state to the other state in interface/neighbor state

machines. Other events are internal and are generated as a result of a transition in

interface/neighbor state machines. Further, a transition in interface state machine may

generate an internal event for the neighbor state machine and vice-versa.




Raja Sirisha Cholleti                                                                       6
Interface State Machine Simulator                                                     12/17/2011


Interface States:

        Down: This is the initial interface state. In this state, the interface is unusable and

         no protocol traffic is sent or received. All interface parameters should be set to

         initial values and there should be no adjacencies developed with this interface.

        Loopback: Interface can be looped back in hardware or software. This means the

         interface is unavailable for regular traffic but can be used to gain information on

         the quality of this interface by sending ICMP pings or through a bit error test.

         Because of this IP packets are still addressed to an interface in Loop back. These

         kinds of interfaces are advertised in the router’s LSA as single host routes, whose

         destination is the IP interface address.

        Waiting: In this the router tries to determine the network’s designated router and

         Backup Designated router. For this the router monitors the Hello packets it

         receives. To prevent unnecessary change of designated or backup designated

         router, router is not allowed to elect the designated or backup designated router

         until it transitions out of this state.

        Point to Point: In this state, interface is operational and connects to the physical

         point to point or virtual link. Upon entering this state, interface attempts to form

         adjacency with the neighboring router. For every HelloInterval seconds Hello

         packets are sent to the neighbor.

        DR Other: The interface is on broadcast or NBMA network where another router

         is selected as designated. This interface has not been selected as backup

         designated router either. If the designated and backup designated routers exist,

         then the interface forms adjacencies with both of them.



Raja Sirisha Cholleti                                                                         7
Interface State Machine Simulator                                                     12/17/2011


        Backup: Router itself is the backup designated router. If the designated router of

         the network fails, this will be promoted as designated router. Backup designated

         router functions differently than designated router in case of flooding procedure.

         This router forms adjacencies with all other routers of the attached network. For

         every HelloInterval seconds Hello packets are sent to the neighbors that are not

         eligible to become Designated Router.

        DR: Router itself is the designated router. This router forms adjacencies with all

         other routers of the attached network. The network LSA must be originated by the

         router for the network node. All the links to the attached network routers will be

         contained in the LSA. For every HelloInterval seconds Hello packets are sent to

         the neighbors that are not eligible to become Designated Router.



Interface Events: State changes are caused by the events. The interface events that cause

interface state changes are:

        InterfaceUp: Lower level protocols indicate that this interface is operational. This

         enables the interface to transition from Down to Interface Up. In virtual links,

         interface operation indication is the result of the calculation of the shortest path.

        WaitTimer: To indicate the end of wait time before electing the designated or

         back up designated router, the wait timer is fired.

        BackupSeen: Router has detected the existence or non existence of the backup

         designated router. This can be done in two ways. First, a hello packet may be

         received from the neighbor indicating itself as backup designated router. Second,

         a hello packet may be received from the neighbor claiming itself as designated


Raja Sirisha Cholleti                                                                            8
Interface State Machine Simulator                                                   12/17/2011


         router and indicating that there is no backup designated router. In both the cases,

         the router must have bidirectional communication with the neighbor. This signals

         an end to the waiting state.

        NeighborChange: There has been a change in the set of bidirectional neighbors

         associated with the network. The backup designated router and designated router

         have to be recalculated. The neighbor changes that cause the NeighborChange

         event are:

          One of the bidirectional routers is newly declaring itself as designated router

             or backup designated router.

          For the bidirectional routers, the advertised router priority has been changed.

          One of the bidirectional routers is no more declaring itself as designated router

             or backup designated router.

          The neighbor state has transitioned to 2-way or higher from any state lower

             than 2-way.

          The neighbor state has transitioned to Init or lower from any state higher than

             Init.

    The first three are detected through the examining the neighbor’s hello packet.

        LoopInd: Either from the network manager or lower level protocols, indication

         has been received that the interface is now looped back to itself.

        UnloopInd: Either from the network manager or lower level protocols, indication

         has been received that the interface is now no longer looped back to itself.

        InterfaceDown: Lower level protocols indicate that this interface is no longer

         usable. No matter what the interface state can be, it will go to Down state.



Raja Sirisha Cholleti                                                                        9
Interface State Machine Simulator                                                   12/17/2011


Interface state machine:

Each state change is invoked by an event. This event may cause different outputs

depending on the current state of the interface. Each event can cause intermediate events

and final interface states depending on the actions to perform. Some of the actions

involve generating neighbor events too.

Interface state machine details are documented in Appendix – 1.

Interface State Machine:




                                                                       UnLoopInd

                                                    DOWN                                     Loopback




                                                         InterfaceUp




                                    Waiting                                        Point to Point



                                          WaitTimer/BackupSeen




                                               NeighborChange

                  NeighborChange
                                                                       DROther
  Backup                                ?




                                                         NeighborChange



Raja Sirisha Cholleti                                                                       10
                                                       DR
Interface State Machine Simulator                                                    12/17/2011



Process:

        Developing the specifications based on the available OSPF RFC-2328: The

         interface state machine and neighbor state machine details from OSPF – RFC

         2328 are reviewed and all the state changes, events invoked and actions taken for

         those events, etc are documented in a tabular form using Microsoft Excel for ease

         of design.

        Designing the system using UML: The system design is developed using UML.

         The UML diagram is attached in the appendix 2.

        Developing the interface state machine system using C++ language and Flex

         interpreter: Flex is a tool for generating scanners: programs which recognized

         lexical patterns in text. Flex reads the given input files for a description of a

         scanner to generate. The Interface state machine file developed in the

         specifications part is inputted to the flex scanner.

         The generated scanner tokens are used in the C++ code to build the interface

         system. This will take the state of the interface and relevant event type for that

         state as input from the user and presents new state and the new events that can be

         invoked on the new state as the output. This will be working recursively until the

         user selects to exit the system.

        Testing: Tested each individual component of the code as part of the unit testing.

         Test cases for the system were developed and used in the Functional testing. The

         test log is included in the appendix 3. User interface was also tested.

        Documentation of the project: Drafting and finalizing the Project report.




Raja Sirisha Cholleti                                                                       11
Interface State Machine Simulator                                                  12/17/2011




User Documentation:

        Compile the flex file – “flex l5.l”

        Compile the c++ file – “g++ main6.cpp”

        Run main6.cpp – “a.out”

        The state machine simulator displays the topology of the routers – Select a router.

        The interfaces and its states on the selected router will be displayed – Select the

         interface.

        All possible events that can be invoked on that interface state will be displayed –

         Select an event to be invoked.

        After the calculations, all the intermediate new states and the final new state will

         be displayed with all new possible events that can be invoked on the new state –

         Select an event for the new state.

        Select relevant options as required by the system. For example whether the

         network is point to point or NBMA or the Router is elected DR/BDR etc.

        To exit the system – Select Exit option.



Conclusion:

         The system designed for interface state machine worked as per the specifications

defined and the design approved. The interface state machine simulator built takes the

state of the interface and relevant event type for that state as input from the user and

presents new state and the new events that can be invoked on the new state as the output.

This will be working recursively until the user selects to exit the system.


Raja Sirisha Cholleti                                                                     12
Interface State Machine Simulator                                              12/17/2011


         The extension to this project can be the Neighbor state machine simulator, which

will show the state changes of the routers. Also can show the interaction between these

two state machines as this becomes difficult to understand with large, complicated

topology.




References:

        [RFC2328]: OSPF – RFC2328 - J. Moy: Ascend Communications, Inc.:
         April 1998: http://www.faqs.org/rfcs/rfc2328.html
        [Flex95]: Flex; Edition 2.5, March 1995:
         www.gnu.org/software/flex/manual/html_mono/flex.html
        [CPP03]: C++: The C++ Resources Network, 2000-2003 : www.cplusplus.com




Appendix:
2: UML Diagram




Raja Sirisha Cholleti                                                                  13
Interface State Machine Simulator                                                                      12/17/2011




                                                         User



                                    Starts the Simulator


                              Simulator

                                              Displays the network
                                                    topology


                                     Selects the router


                                             Displays the Interfaces
                                                 on the Router



                                 Selects the interface


                                              Displays the state of
 Selects to exit the system




                                               the Interface with
                                                possible Events


                                     Selects the Event


                                                  Performs the
                                                  Calculations
                                                                                   Selects the Event




                                   Displays the New state of the Interface and
            Exit                  all possible events that can be invoked on the
                                                     new state




Raja Sirisha Cholleti                                                                                         14
                                                                     User
                             Interface State Machine Simulator                                                    12/17/2011


                                                Starts the Simulator


                                        Simulator

                                                          Displays the network
                                                                topology


                                                 Selects the router


                                                         Displays the Interfaces
                                                             on the Router



                                             Selects the interface


                                                           Displays the state of
Selects to exit the system




                                                            the Interface with
                                                             possible Events


                                                 Selects the Event


                                                                 Performs the
                                                                 Calculations
                                                                                              Selects the Event




                                              Displays the New state of the Interface and
           Exit                              all possible events that can be invoked on the
                                                                new state




                             Raja Sirisha Cholleti                                                                       15

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:18
posted:12/18/2011
language:Latin
pages:15