Component Drivers

Connects and provides interfaces to various components in the OpenFlow/SDN topology.

The three main methods of a component driver are connect, disconnect and execute. Usually, while writing a custom driver, the user might entirely skip writing these methods and use them from the parent component class or call the equivalent super component method, followed by any logic that is specific to this component.

As a reference to write a custom driver, please refer to Mininet driver.

In this example, the Mininet driver inherits from the abstract Emulator driver which in turn inherits from the CLI driver. The Mininet driver reuses the execute and disconnect API from the CLI driver. The connect API is the only API that is redifined.

class Mininet(Emulator):

        def __init__(self):
            super(Emulator, self).__init__()
            self.handle = self

        def connect(self,user_name, ip_address, pwd,options):
            self.handle = super(Mininet, self).connect(user_name, ip_address, pwd)

Here the connect will call the super (clidriver) connect.

Driver specific methods/functions can be specified using the simple execute command of mininet cli driver.

 def pingall( self, timeout=300 ):
        """
           Verifies the reachability of the hosts using pingall command.
           Optional parameter timeout allows you to specify how long to
           wait for pingall to complete
           Returns:
           main.TRUE if pingall completes with no pings dropped
           otherwise main.FALSE"""
        if self.handle:
            main.log.info(
                self.name +
                ": Checking reachabilty to the hosts using pingall" )
            try:
                response = self.execute(
                    cmd="pingall",
                    prompt="mininet>",
                    timeout=int( timeout ) )

Stuck? Found a bug? Questions?

Email us if you’re stuck, think you’ve found a bug, or just want to send some feedback. Please have a look at the guidelines to learn how to efficiently submit a bug report.

Creating Driver

NOTE: More documentation for writing driversr will be added in the future.