diff --git a/TestON/drivers/common/cli/hostdriver.py b/TestON/drivers/common/cli/hostdriver.py
new file mode 100644
index 0000000..238721e
--- /dev/null
+++ b/TestON/drivers/common/cli/hostdriver.py
@@ -0,0 +1,198 @@
+#!/usr/bin/env python
+"""
+Copyright 2018 Open Networking Foundation (ONF)
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+( at your option ) any later version.
+
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with TestON.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import pexpect
+import re
+import sys
+import types
+import os
+import time
+from math import pow
+from drivers.common.clidriver import CLI
+
+class HostDriver( CLI ):
+    """
+    This class is created as a standalone host driver.
+    """
+    def __init__( self ):
+        super( HostDriver, self ).__init__()
+        self.handle = self
+        self.name = None
+        self.shortName = None
+        self.home = None
+
+    def connect( self, **connectargs ):
+        """
+        Creates ssh handle for host.
+        NOTE:
+        The ip_address would come from the topo file using the host tag, the
+        value can be an environment variable as well as a "localhost" to get
+        the ip address needed to ssh to the "bench"
+        """
+        try:
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+            self.name = self.options[ 'name' ]
+            self.shortName = self.options[ 'shortName' ]
+
+            try:
+                if os.getenv( str( self.ip_address ) ) is not None:
+                    self.ip_address = os.getenv( str( self.ip_address ) )
+                else:
+                    main.log.info( self.name +
+                                   ": Trying to connect to " +
+                                   self.ip_address )
+            except KeyError:
+                main.log.info( "Invalid host name," +
+                               " connecting to local host instead" )
+                self.ip_address = 'localhost'
+            except Exception as inst:
+                main.log.error( "Uncaught exception: " + str( inst ) )
+
+            self.handle = super(
+                HostDriver,
+                self ).connect(
+                user_name=self.user_name,
+                ip_address=self.ip_address,
+                port=None,
+                pwd=self.pwd )
+
+            if self.handle:
+                main.log.info( "Connection successful to the " +
+                               self.user_name +
+                               "@" +
+                               self.ip_address )
+                self.handle.sendline( "" )
+                self.handle.expect( self.prompt )
+                return main.TRUE
+            else:
+                main.log.error( "Connection failed to " +
+                                self.user_name +
+                                "@" +
+                                self.ip_address )
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
+    def disconnect( self, **connectargs ):
+        """
+        Called when test is complete to disconnect the handle.
+        """
+        response = main.TRUE
+        try:
+            if self.handle:
+                # Disconnect from the host
+                self.handle.sendline( "" )
+                self.handle.expect( self.prompt )
+                self.handle.sendline( "exit" )
+                i = self.handle.expect( [ "closed", pexpect.TIMEOUT ], timeout=2 )
+                if i == 1:
+                    main.log.error(
+                        self.name +
+                        ": timeout when waiting for response" )
+                    main.log.error( "response: " + str( self.handle.before ) )
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            response = main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+        except ValueError:
+            main.log.exception( "Exception in disconnect of " + self.name )
+            response = main.TRUE
+        except Exception:
+            main.log.exception( self.name + ": Connection failed to the host" )
+            response = main.FALSE
+        return response
+
+    def ping( self, dst, ipv6=False, wait=3 ):
+        """
+        Description:
+            Ping from this host to another
+        Required:
+            dst: IP address of destination host
+        Optional:
+            ipv6: will use ping6 command if True; otherwise use ping command
+            wait: timeout for ping command
+        """
+        try:
+            command = "ping6" if ipv6 else "ping"
+            command += " -c 1 -i 1 -W " + str( wait ) + " " + str( dst )
+            main.log.info( self.name + ": Sending: " + command )
+            self.handle.sendline( command )
+            i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ],
+                                    timeout=wait + 1 )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            self.handle.sendline( "" )
+            self.handle.expect( self.prompt )
+            response = self.handle.before
+            if re.search( ',\s0\%\spacket\sloss', response ):
+                main.log.info( self.name + ": no packets lost, host is reachable" )
+                return main.TRUE
+            else:
+                main.log.warn(
+                    self.name +
+                    ": PACKET LOST, HOST IS NOT REACHABLE" )
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
+    def ifconfig( self, wait=3 ):
+        """
+        Run ifconfig command on host and return output
+        """
+        try:
+            command = "ifconfig"
+            main.log.info( self.name + ": Sending: " + command )
+            self.handle.sendline( command )
+            i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ],
+                                    timeout=wait + 1 )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            self.handle.sendline( "" )
+            self.handle.expect( self.prompt )
+            response = self.handle.before
+            return response
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index d1a7faf..38d7531 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -122,9 +122,9 @@
         try:
             for key, value in main.componentDictionary.items():
                 if hasattr( main, key ):
-                    if value[ 'type' ] in [ 'MininetSwitchDriver' ]:
+                    if value[ 'type' ] in [ 'MininetSwitchDriver', 'OFDPASwitchDriver' ]:
                         self.switches[ key ] = getattr( main, key )
-                    elif value[ 'type' ] in [ 'MininetHostDriver' ]:
+                    elif value[ 'type' ] in [ 'MininetHostDriver', 'HostDriver' ]:
                         self.hosts[ key ] = getattr( main, key )
             return main.TRUE
         except Exception:
@@ -138,7 +138,7 @@
         hosts = {}
         try:
             for hostComponent in self.hosts.values():
-                #TODO: return more host data
+                # TODO: return more host data
                 hosts[ hostComponent.options[ 'shortName' ] ] = {}
         except Exception:
             main.log.error( self.name + ": host component not as expected" )
diff --git a/TestON/drivers/common/cli/ofdpa/__init__.py b/TestON/drivers/common/cli/ofdpa/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/drivers/common/cli/ofdpa/__init__.py
diff --git a/TestON/drivers/common/cli/ofdpa/ofagent.conf.template b/TestON/drivers/common/cli/ofdpa/ofagent.conf.template
new file mode 100644
index 0000000..9dccbcf
--- /dev/null
+++ b/TestON/drivers/common/cli/ofdpa/ofagent.conf.template
@@ -0,0 +1,99 @@
+# Controller
+#-----------------------
+#CTRL1_IP="127.0.0.1"
+#CTRL1_PORT="6653"
+#CTRL2_IP="127.0.0.1"
+#CTRL2_PORT="6653"
+#CTRL3_IP="127.0.0.1"
+#CTRL3_PORT="6653"
+
+#LISTEN_IP="0.0.0.0"
+#LISTEN_PORT="6653"
+
+# Datapath ID
+#-----------------------
+#DPID=`cat /sys/class/net/ma1/address | sed 's/://g'`
+#DPID="1"
+
+# In-band management
+#-----------------------
+#IB_MGMT_VLAN="1"
+#IB_MGMT_PORT_ARG="-p 5"
+
+# Debug options
+#-----------------------
+#OPT_ARGS="-a2 -d4 -c1 -c2 -c3 -c4 -c5"
+
+# Maximu number of log files (valid: 0-10; 0:disble logging)
+MAX_LOG_NUM=0
+
+#----------------------------------------------------------------------------
+# OPT_ARGS:
+#----------------------------------------------------------------------------
+#
+# Controllers:
+#  -i, --dpid=DATAPATHID      The Datapath ID for this switch.
+#  -l, --listen=IP[:PORT]     A local IP address on which to listen for
+#                             controllers (may use this option multiple times)
+#  -t, --controller=IP[:PORT] A Controller IP address (may use this option
+#                             multiple times)
+#
+# TLS:
+#      --cacert=CACERTIFICATE The Certificate Authority certficate
+#      --cert=CERTIFICATE     The SSL public certificate file for the switch
+#      --cipher=CIPHER        The list of ciphers to use
+#      --key=KEYFILE          The SSL private key file for the switch
+#
+# Management VLAN:
+#  -p, --port=MGMTPORT        A port in the mgmt VLAN (may use this option
+#                             multiple times)
+#  -v, --vlan=MGMTVLAN        The VLAN to be reserved for management.
+#
+# Debugging:
+#  -a, --agentdebuglvl=AGENTDEBUGLVL
+#                             The verbosity of OF Agent debug messages.
+#  -c, --ofdpadebugcomp=OFPDACOMPONENT
+#                             The OF-DPA component for which debug messages are
+#                             enabled.
+#  -d, --ofdpadebuglvl=OFDPADEBUGLVL
+#                             The verbosity of OF-DPA debug messages.
+#
+#
+# Note:
+# IPv6 address parameters are specified following RFC3986.
+# To include a port number, enclose the IPv6 address in square brackets:
+#         Example: -t [2001:db8:1f70::999:de8:7648:6e8]:6653
+#
+# To use TLS when connecting to a controller, prefix the IP address with "tls:".
+#         Example: -t tls:[2001:db8:1f70::999:de8:7648:6e8]:6653
+#
+# Note: it is necessary to have a private key and public certificate to use TLS.
+# If the CA certificate is not provided, then the switch does not validate
+# certificates.  This can be helpful if self-signed certificates are being used.
+#
+# Default values:
+# No controllers connections
+# Note: may listen on mutiple IP addresses.  E.g., IPv4 and IPv6.
+# OFAGENTDEBUGLVL  = 0
+# Valid OF Agent debug levels are 0 - 2.
+# OFDPADEBUGLVL  = 0
+# Valid OF-DPA debug levels are 0 - 4.
+# No components enabled for debug:
+# Valid OF-DPA components are:
+#         1 = API
+#         2 = Mapping
+#         3 = RPC
+#         4 = OFDB
+#         5 = Datapath
+#         6 = G8131
+#         7 = Y1731
+#         8 = sFlow
+#         9 = SDK
+# DATAPATHID = 0xda7a
+# No defaults for the management VLAN and port(s).  The management VLAN feature
+# is disabled by default.
+# CIPHER = HIGH
+# CACERTIFICATE =
+# KEYFILE = /etc/ssl/private/switch.key
+# CERTIFICATE = /etc/ssl/certs/switch.crt
+#----------------------------------------------------------------------------
diff --git a/TestON/drivers/common/cli/ofdpa/ofdpaswitchdriver.py b/TestON/drivers/common/cli/ofdpa/ofdpaswitchdriver.py
new file mode 100644
index 0000000..b080c96
--- /dev/null
+++ b/TestON/drivers/common/cli/ofdpa/ofdpaswitchdriver.py
@@ -0,0 +1,327 @@
+#!/usr/bin/env python
+"""
+Copyright 2018 Open Networking Foundation (ONF)
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+( at your option ) any later version.
+
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with TestON.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import pexpect
+import re
+import json
+import types
+import time
+import os
+from drivers.common.clidriver import CLI
+from core import utilities
+from shutil import copyfile
+
+class OFDPASwitchDriver( CLI ):
+
+    def __init__( self ):
+        """
+        Initialize client
+        """
+        super( CLI, self ).__init__()
+        self.name = None
+        self.handle = None
+        self.prompt = "~#"
+        # Respect to bin folder
+        self.home = "../drivers/common/cli/ofdpa/"
+        # Local home for functions using scp
+        self.tempDirectory = "/tmp/"
+        self.conf = "ofagent.conf"
+        self.switchDirectory = "/etc/ofagent/"
+
+    def connect( self, **connectargs ):
+        """
+        Creates ssh handle for Accton cli.
+        """
+        try:
+            # Parse keys in xml object
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+            # Get the name
+            self.name = self.options['name']
+            # Get the dpid
+            self.dpid = self.options[ 'dpid' ]
+            # Parse the IP address
+            try:
+                if os.getenv( str( self.ip_address ) ) is not None:
+                    self.ip_address = os.getenv( str( self.ip_address ) )
+                # Otherwise is an ip address
+                else:
+                    main.log.info( self.name + ": Trying to connect to " + self.ip_address )
+            # Error handling
+            except KeyError:
+                main.log.info( "Invalid host name," + " connecting to local host instead" )
+                self.ip_address = 'localhost'
+            except Exception as inst:
+                main.log.error( "Uncaught exception: " + str( inst ) )
+            # Build the handle using the above information
+            self.handle = super(OFDPASwitchDriver, self ).connect(
+                user_name=self.user_name,
+                ip_address=self.ip_address,
+                port=None,
+                pwd=self.pwd)
+            # Successful connection
+            if self.handle:
+                main.log.info( "Connection successful to the host " + self.user_name + "@" + self.ip_address )
+                self.handle.sendline( "" )
+                self.handle.expect( self.prompt )
+                return main.TRUE
+            # Connection failed
+            else:
+                main.log.error( "Connection failed to the host " + self.user_name + "@" + self.ip_address )
+                main.log.error( "Failed to connect to the OFDPA CLI" )
+                return main.FALSE
+        # Error handling
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def disconnect( self ):
+        """
+        Called when Test is complete to disconnect the OFDPASwitchDriver handle.
+        """
+        response = main.TRUE
+        try:
+            if self.handle:
+                # Stop the ofagent
+                self.stopOfAgent()
+                # Disconnect from the device
+                self.handle.sendline( "" )
+                self.handle.expect( self.prompt )
+                self.handle.sendline( "exit" )
+                self.handle.expect( "closed" )
+        # Errors handling
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            response = main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+        except ValueError:
+            main.log.exception( "Exception in disconnect of " + self.name )
+            response = main.TRUE
+        except Exception:
+            main.log.exception( self.name + ": Connection failed to the host" )
+            response = main.FALSE
+            return response
+
+    def assignSwController( self, ip, port="6653", ptcp=""):
+        """
+        Description:
+            The assignment is realized properly creating the agent.conf
+            for each switch and then pushing it into the device.
+        Required:
+            ip - Ip addresses of controllers. This can be a list or a string.
+        Optional:
+            port - controller port is ignored
+            ptcp - ptcp information is ignored
+        Return:
+            Returns main.TRUE if the switch is correctly assigned to controllers,
+            otherwise it will return main.FALSE or an appropriate exception(s)
+        """
+        assignResult = main.TRUE
+        # Initial arguments for OFDPA
+        opt_args = 'OPT_ARGS="-d 2 -c 2 -c 4 '
+        onosIp = ""
+        # Parses the controller option
+        try:
+            if isinstance( ip, types.StringType ):
+                onosIp = "-t " + str( ip )
+            elif isinstance( ip, types.ListType ):
+                for ipAddress in ip:
+                        onosIp += "-t " + str( ipAddress ) + " "
+            else:
+                main.log.error( self.name + ": Invalid ip address" )
+                return main.FALSE
+            # Complete the arguments adding the dpid
+            opt_args += onosIp + '-i %s' % self.dpid + '"'
+            # Create a copy of the cfg file using the template
+            self.createCfg()
+            # Load the cfg file and adds the missing option
+            self.updateCfg( opt_args )
+            # Backup the cfg on the switch
+            self.backupCfg()
+            # Push the new cfg on the device
+            self.pushCfg()
+            # Start the ofagent on the device
+            self.startOfAgent()
+            # Enable all the ports
+            assignResult = utilities.retry(
+                self.enablePorts,
+                main.FALSE,
+                kwargs={},
+                attempts=5,
+                sleep=10)
+            # Done return true
+            return assignResult
+        # Errors handling
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
+    def createCfg( self ):
+        """
+        Create in bench context a new config file starting from the template
+        """
+        copyfile(self.home + self.conf + ".template", self.tempDirectory + self.conf)
+
+    def updateCfg( self, opt_args):
+        """
+        Add the arguments related to the current switch (self)
+        """
+        with open(self.tempDirectory + self.conf, "a") as cfg:
+            cfg.write(opt_args + "\n")
+            cfg.close()
+
+    def backupCfg( self ):
+        """
+        Create a backup file of the old configuration on the switch
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( self.prompt )
+        self.handle.sendline( "cp %s%s %s%s.backup" % (self.switchDirectory, self.conf, self.switchDirectory, self.conf) )
+        self.handle.expect( self.prompt )
+
+    def pushCfg( self ):
+        """
+        Push the new configuration from the network bench
+        """
+        # We use os.system to send the command from TestON cluster
+        # to the switches. This means that passwordless access is
+        # necessary in order to push the configuration file
+        os.system( "scp " + self.tempDirectory + self.conf + " " +
+                   self.user_name + "@" + self.ip_address + ":" + self.switchDirectory)
+
+    def startOfAgent( self ):
+        """
+        Start the ofagent on the device
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( self.prompt )
+        self.handle.sendline( "service ofagentd start" )
+        self.handle.expect( self.prompt )
+
+    def stopOfAgent( self ):
+        """
+        Stop the ofagent on the device
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( self.prompt )
+        self.handle.sendline( "service ofagentd stop" )
+        self.handle.expect( self.prompt )
+
+    def dumpFlows( self ):
+        """
+        Dump the flows from the devices
+        FIXME need changes in the workflow in order to be used
+        """
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( self.prompt )
+            # Create the dump of the flows locally on the switches
+            self.handle.sendline( "client_flowtable_dump" )
+            self.handle.expect( self.prompt )
+            response = self.handle.before
+            # Write back in the tmp folder - needs to be changed in future
+            with open(self.tempDirectory + "flows_%s.txt" % self.dpid, "w") as flows:
+                flows.write(response + "\n")
+                flows.close()
+            # Done return for further processing
+            return response
+        # Errors handling
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
+    def dumpGroups( self ):
+        """
+        Dump the groups from the devices
+        FIXME need changes in the workflow in order to be used
+        """
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( self.prompt )
+            self.handle.sendline( "client_grouptable_dump > groups.txt" )
+            self.handle.expect( self.prompt )
+            response = self.handle.before
+            # Write back in the tmp folder - needs to be changed in future
+            with open(self.tempDirectory + "groups_%s.txt" % self.dpid, "w") as groups:
+                groups.write(response + "\n")
+                groups.close()
+            # Done return for further processing
+            return response
+        # Errors handling
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
+    def enablePorts( self ):
+        """
+        Enable all the ports on the devices
+        It needs to wait for the boot
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( self.prompt )
+        self.handle.sendline( "client_port_table_dump" )
+        self.handle.expect( self.prompt )
+        response = self.handle.before
+        if "Error from ofdpaClientInitialize()" in response:
+            main.log.warn(
+                self.name +
+                ": Not yet started" )
+            return main.FALSE
+        main.log.info( self.name + ": started" )
+        self.handle.sendline( "sh portspeed.sh" )
+        self.handle.expect( self.prompt )
+        return main.TRUE
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 52ef98a..b7d10bd 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -3035,7 +3035,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def checkStatus( self, numoswitch, numolink, numoctrl = -1, logLevel="info" ):
+    def checkStatus( self, numoswitch, numolink = -1, numoctrl = -1, logLevel="info" ):
         """
         Checks the number of switches & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
@@ -3071,7 +3071,7 @@
                 return main.ERROR
             switchCheck = ( int( devices ) == int( numoswitch ) )
             # Is the number of links is what we expected
-            linkCheck = ( int( links ) == int( numolink ) )
+            linkCheck = ( int( links ) == int( numolink ) ) or int( numolink ) == -1
             nodeCheck = ( int( nodes ) == int( numoctrl ) ) or int( numoctrl ) == -1
             if switchCheck and linkCheck and nodeCheck:
                 # We expected the correct numbers
@@ -3085,8 +3085,9 @@
                 result = main.FALSE
             output = output + "\n ONOS sees %i devices" % int( devices )
             output = output + " (%i expected) " % int( numoswitch )
-            output = output + "and %i links " % int( links )
-            output = output + "(%i expected)" % int( numolink )
+            if int( numolink ) > 0:
+                output = output + "and %i links " % int( links )
+                output = output + "(%i expected)" % int( numolink )
             if int( numoctrl ) > 0:
                 output = output + "and %i controllers " % int( nodes )
                 output = output + "(%i expected)" % int( numoctrl )
