Esempio n. 1
0
    def removeAllPointIntents( self, scheduleMethod, args=None ):
        """
        This function removes point intents for all device pairs
        After all intent events are inserted, this funciton also insert intent and traffic checks
        """
        import itertools

        with self.eventGeneratorLock:
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
            availableControllers = []
            for controller in main.controllers:
                if controller.isUp():
                    availableControllers.append( controller.index )
            if len( availableControllers ) == 0:
                main.log.warn( "Event Generator - No available controllers" )
                return
            deviceCombos = list( itertools.permutations( main.devices, 2 ) )
            for i in xrange( 0, len( deviceCombos ), len( availableControllers ) ):
                for CLIIndex in availableControllers:
                    if i >= len( deviceCombos ):
                        break
                    main.eventScheduler.scheduleEvent( EventType().APP_INTENT_POINT_DEL,
                                                       EventScheduleMethod().RUN_NON_BLOCK,
                                                       [ deviceCombos[ i ][ 0 ].name, deviceCombos[ i ][ 1 ].name, CLIIndex ] )
                    i += 1
            # Pending checks after removing all intents
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
            sleepTime = int( main.params[ 'EVENT' ][ 'removeAllPointIntents' ][ 'sleepBeforeCheck' ] )
            main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
            self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
Esempio n. 2
0
 def startEvent(self, args):
     """
     args are the names of the two link ends, e.g. ['s1', 's2']
     """
     with self.eventLock:
         #main.log.info( "%s - starting event" % ( self.typeString ) )
         if len(args) < 2:
             main.log.warn("%s - Not enough arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         elif len(args) > 2:
             main.log.warn("%s - Too many arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         if args[0] == 'random' or args[1] == 'random':
             if self.typeIndex == EventType().NETWORK_LINK_DOWN:
                 with main.mininetLock:
                     linkRandom = main.Mininet1.getLinkRandom()
                 if linkRandom == None:
                     main.log.warn("No link available, aborting event")
                     return EventStates().ABORT
                 args[0] = linkRandom[0]
                 args[1] = linkRandom[1]
             elif self.typeIndex == EventType().NETWORK_LINK_UP:
                 import random
                 with main.variableLock:
                     downLinks = []
                     for link in main.links:
                         if link.isDown():
                             downLinks.append(link)
                     if len(downLinks) == 0:
                         main.log.warn(
                             "None of the links are in 'down' state, aborting event"
                         )
                         return EventStates().ABORT
                     linkList = random.sample(downLinks, 1)
                     self.linkA = linkList[0]
                     self.linkB = linkList[0].backwardLink
         elif args[0] == args[1]:
             main.log.warn("%s - invalid arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         if self.linkA == None or self.linkB == None:
             for link in main.links:
                 if link.deviceA.name == args[
                         0] and link.deviceB.name == args[1]:
                     self.linkA = link
                 elif link.deviceA.name == args[
                         1] and link.deviceB.name == args[0]:
                     self.linkB = link
                 if self.linkA != None and self.linkB != None:
                     break
             if self.linkA == None or self.linkB == None:
                 main.log.warn(
                     "Bidirectional link %s - %s does not exist: " %
                     (args[0], args[1]))
                 return EventStates().ABORT
         main.log.debug("%s - %s" % (self.typeString, self.linkA))
         return self.startLinkEvent()
Esempio n. 3
0
 def addAllChecks( self, scheduleMethod, args=None ):
     """
     The function adds all check events into the scheduler
     """
     with self.eventGeneratorLock:
         if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
             main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
         self.insertAllChecks( args )
         if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
             main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
Esempio n. 4
0
 def startEvent( self, args ):
     with self.eventLock:
         #main.log.info( "%s - starting event" % ( self.typeString ) )
         if self.typeIndex == EventType().APP_INTENT_HOST_ADD or self.typeIndex == EventType().APP_INTENT_HOST_DEL:
             if len( args ) < 3:
                 main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
                 return EventStates().ABORT
             elif len( args ) > 3:
                 main.log.warn( "%s - Too many arguments: %s" % ( self.typeString, args ) )
                 return EventStates().ABORT
             try:
                 if args[ 0 ] == 'random' or args[ 1 ] == 'random':
                     if self.typeIndex == EventType().APP_INTENT_HOST_ADD:
                         hostPairRandom = self.getRandomHostPair( connected=False )
                         if hostPairRandom == None:
                             main.log.warn( "All host pairs are connected, aborting event" )
                             return EventStates().ABORT
                         self.hostA = hostPairRandom[ 0 ]
                         self.hostB = hostPairRandom[ 1 ]
                     elif self.typeIndex == EventType().APP_INTENT_HOST_DEL:
                         intent = self.getRandomIntentByType( 'INTENT_HOST' )
                         if intent == None:
                             main.log.warn( "No host intent for deletion, aborting event" )
                             return EventStates().ABORT
                         self.hostA = intent.hostA
                         self.hostB = intent.hostB
                 elif args[ 0 ] == args[ 1 ]:
                     main.log.warn( "%s - invalid argument: %s, %s" % ( self.typeString, args[ 0 ], args[ 1 ] ) )
                     return EventStates().ABORT
                 else:
                     for host in main.hosts:
                         if host.name == args[ 0 ]:
                             self.hostA = host
                         elif host.name == args[ 1 ]:
                             self.hostB = host
                         if self.hostA != None and self.hostB != None:
                             break
                     if self.hostA == None:
                         main.log.warn( "Host %s does not exist: " % ( args[ 0 ] ) )
                         return EventStates().ABORT
                     if self.hostB == None:
                         main.log.warn( "Host %s does not exist: " % ( args[ 1 ] ) )
                         return EventStates().ABORT
                 index = int( args[ 2 ] )
                 if index < 1 or index > int( main.numCtrls ):
                     main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
                     return EventStates().ABORT
                 if not main.controllers[ index - 1 ].isUp():
                     main.log.warn( self.typeString + " - invalid argument: onos %s is down" % ( controller.index ) )
                     return EventStates().ABORT
                 self.CLIIndex = index
                 return self.startHostIntentEvent()
             except Exception:
                 main.log.warn( "Caught exception, aborting event" )
                 return EventStates().ABORT
Esempio n. 5
0
 def startEvent(self, args):
     """
     args are the names of the device, e.g. 's1'
     """
     with self.eventLock:
         main.log.info("%s - starting event" % (self.typeString))
         if len(args) < 1:
             main.log.warn("%s - Not enough arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         elif len(args) > 1:
             main.log.warn("%s - Too many arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         if args[0] == 'random':
             import random
             if self.typeIndex == EventType().NETWORK_DEVICE_DOWN:
                 with main.variableLock:
                     graphHelper = GraphHelper()
                     availableDevices = graphHelper.getNonCutVertices()
                     if len(availableDevices) == 0:
                         main.log.warn(
                             "All devices are cut vertices, aborting event")
                         return EventStates().ABORT
                     deviceList = random.sample(availableDevices, 1)
                     self.device = deviceList[0]
             elif self.typeIndex == EventType().NETWORK_DEVICE_UP:
                 with main.variableLock:
                     removedDevices = []
                     for device in main.devices:
                         if device.isRemoved():
                             removedDevices.append(device)
                     if len(removedDevices) == 0:
                         main.log.warn(
                             "None of the devices are removed, aborting event"
                         )
                         return EventStates().ABORT
                     deviceList = random.sample(removedDevices, 1)
                     self.device = deviceList[0]
         else:
             for device in main.devices:
                 if device.name == args[0]:
                     self.device = device
             if self.device == None:
                 main.log.warn("Device %s does not exist: " % (args[0]))
                 return EventStates().ABORT
         main.log.debug("%s - %s" % (self.typeString, self.device))
         return self.startDeviceEvent()
    def CASE40(self, main):
        """
        Randomly bring down one ONOS node
        """
        import time
        import random
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report("Randomly bring down one ONOS node")
        main.log.report("__________________________________________________")
        main.case("Randomly bring down one ONOS node")
        main.step("Randomly bring down one ONOS node")
        main.caseResult = main.TRUE
        availableControllers = []
        for controller in main.controllers:
            if controller.isUp():
                availableControllers.append(controller.index)
        if len(availableControllers) == 0:
            main.log.warn("No available controllers")
            main.caseResult = main.FALSE
        else:
            index = random.sample(availableControllers, 1)
            main.eventGenerator.triggerEvent(EventType().ONOS_ONOS_DOWN,
                                             EventScheduleMethod().RUN_BLOCK,
                                             index[0])
            with main.eventScheduler.idleCondition:
                while not main.eventScheduler.isIdle():
                    main.eventScheduler.idleCondition.wait()
        utilities.assert_equals(expect=main.TRUE,
                                actual=main.caseResult,
                                onpass="******",
                                onfail="Randomly bring down ONOS test failed")
        time.sleep(main.caseSleep)
    def CASE21(self, main):
        """
        Bring down/up a group of links and check topology and ping
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report(
            "Bring down/up a group of links and check topology and ping")
        main.log.report("__________________________________________________")
        main.case("Bring down/up a group of links and check topology and ping")
        main.step("Bring down/up a group of links and check topology and ping")
        main.caseResult = main.TRUE
        linkGroupSize = int(main.params['CASE21']['linkGroupSize'])
        linkDownDownInterval = int(
            main.params['CASE21']['linkDownDownInterval'])
        linkDownUpInterval = int(main.params['CASE21']['linkDownUpInterval'])
        main.eventGenerator.triggerEvent(
            EventType().NETWORK_LINK_GROUP_RANDOM_TOGGLE,
            EventScheduleMethod().RUN_BLOCK, linkGroupSize,
            linkDownDownInterval, linkDownUpInterval)
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals(expect=main.TRUE,
                                actual=main.caseResult,
                                onpass="******",
                                onfail="Toggle network link group test failed")
        time.sleep(main.caseSleep)
    def CASE41(self, main):
        """
        Randomly bring up one ONOS node that is down
        """
        import time
        import random
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report("Randomly bring up one ONOS node that is down")
        main.log.report("__________________________________________________")
        main.case("Randomly bring up one ONOS node that is down")
        main.step("Randomly bring up one ONOS node that is down")
        main.caseResult = main.TRUE
        targetControllers = []
        for controller in main.controllers:
            if not controller.isUp():
                targetControllers.append(controller.index)
        if len(targetControllers) == 0:
            main.log.warn("All controllers are up")
            main.caseResult = main.FALSE
        else:
            index = random.sample(targetControllers, 1)
            main.eventGenerator.triggerEvent(EventType().ONOS_ONOS_UP,
                                             EventScheduleMethod().RUN_BLOCK,
                                             index[0])
            with main.eventScheduler.idleCondition:
                while not main.eventScheduler.isIdle():
                    main.eventScheduler.idleCondition.wait()
        utilities.assert_equals(expect=main.TRUE,
                                actual=main.caseResult,
                                onpass="******",
                                onfail="Randomly bring up ONOS test failed")
        time.sleep(int(main.params['CASE41']['sleepSec']))
    def CASE90(self, main):
        """
        Sleep for some time
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report("Sleep for some time")
        main.log.report("__________________________________________________")
        main.case("Sleep for some time")
        main.step("Sleep for some time")
        main.caseResult = main.TRUE
        sleepSec = int(main.params['CASE90']['sleepSec'])
        main.eventGenerator.triggerEvent(EventType().TEST_SLEEP,
                                         EventScheduleMethod().RUN_BLOCK,
                                         sleepSec)
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals(expect=main.TRUE,
                                actual=main.caseResult,
                                onpass="******",
                                onfail="Sleep test failed")
        time.sleep(main.caseSleep)
Esempio n. 10
0
 def scheduleEvent( self, typeIndex, scheduleMethod, args=None, index=-1 ):
     """
     Insert an event to pendingEvents
     param:
         index: the position to insert into pendingEvents, default value -1 implies the tail of pendingEvents
     """
     if typeIndex not in main.enabledEvents.keys():
         main.log.warn( "Event Scheduler - event type %s not enabled" % ( typeIndex ) )
         return
     if main.enabledEvents[ typeIndex ] in main.params[ 'EVENT' ].keys():
         if 'rerunInterval' in main.params[ 'EVENT' ][ main.enabledEvents[ typeIndex ] ].keys():
             rerunInterval = int( main.params[ 'EVENT' ][ main.enabledEvents[ typeIndex ] ][ 'rerunInterval' ] )
             maxRerunNum = int( main.params[ 'EVENT' ][ main.enabledEvents[ typeIndex ] ][ 'maxRerunNum' ] )
         else:
             rerunInterval = int( main.params[ 'EVENT' ][ 'Event' ][ 'rerunInterval' ] )
             maxRerunNum = int( main.params[ 'EVENT' ][ 'Event' ][ 'maxRerunNum' ] )
     eventTuple = EventTuple( main.eventID, main.enabledEvents[ typeIndex ], EventType().map[ typeIndex ], typeIndex, scheduleMethod, args, rerunInterval, maxRerunNum )
     with main.variableLock:
         main.eventID += 1
     main.log.debug( "Event Scheduler - Event added: %s, %s, %s" % ( typeIndex,
                                                                     scheduleMethod,
                                                                     args ) )
     with self.pendingEventsCondition:
         if index == -1:
             self.pendingEvents.append( eventTuple )
         elif index > -1 and index <= len( self.pendingEvents ):
             self.pendingEvents.insert( index, eventTuple )
         else:
             main.log.warn( "Event Scheduler - invalid index when isnerting event: %s" % ( index ) )
         self.pendingEventsCondition.notify()
Esempio n. 11
0
 def startEvent(self, args):
     """
     args are the names of the device, e.g. 's1'
     """
     with self.eventLock:
         # main.log.info( "%s - starting event" % ( self.typeString ) )
         if len(args) < 1:
             main.log.warn("%s - Not enough arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         elif len(args) > 1:
             main.log.warn("%s - Too many arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         if args[0] == 'random':
             import random
             if self.typeIndex == EventType().NETWORK_DEVICE_DOWN:
                 with main.networkLock:
                     switchRandom = main.Network.getSwitchRandom(
                         excludeNodes=main.excludeNodes,
                         skipSwitches=main.skipSwitches)
                 if switchRandom is None:
                     main.log.warn("No switch available, aborting event")
                     return EventStates().ABORT
                 args[0] = switchRandom
             elif self.typeIndex == EventType().NETWORK_DEVICE_UP:
                 with main.variableLock:
                     removedDevices = []
                     for device in main.devices:
                         if device.isRemoved():
                             removedDevices.append(device)
                     if len(removedDevices) == 0:
                         main.log.warn(
                             "None of the devices are removed, aborting event"
                         )
                         return EventStates().ABORT
                     deviceList = random.sample(removedDevices, 1)
                     self.device = deviceList[0]
         if self.device is None:
             for device in main.devices:
                 if device.name == args[0]:
                     self.device = device
             if self.device is None:
                 main.log.warn("Device %s does not exist: " % (args[0]))
                 return EventStates().ABORT
         main.log.debug("%s - %s" % (self.typeString, self.device))
         return self.startDeviceEvent()
Esempio n. 12
0
 def insertAllChecks( self, args=None ):
     """
     Acquire eventGeneratorLock before calling this funtion
     """
     for eventType in main.enabledEvents.keys():
         if eventType < 100 and EventType().map[ eventType ].startswith( 'CHECK' ):
             main.eventScheduler.scheduleEvent( eventType,
                                                EventScheduleMethod().RUN_NON_BLOCK,
                                                args )
Esempio n. 13
0
 def startEvent(self, args):
     with self.eventLock:
         main.log.info("%s - starting event" % (self.typeString))
         if self.typeIndex == EventType(
         ).APP_INTENT_HOST_ADD or self.typeIndex == EventType(
         ).APP_INTENT_HOST_DEL:
             if len(args) < 3:
                 main.log.warn("%s - Not enough arguments: %s" %
                               (self.typeString, args))
                 return EventStates().ABORT
             elif len(args) > 3:
                 main.log.warn("%s - Too many arguments: %s" %
                               (self.typeString, args))
                 return EventStates().ABORT
             else:
                 if args[0] == args[1]:
                     main.log.warn("%s - invalid argument: %s" %
                                   (self.typeString, index))
                     return EventStates().ABORT
                 for host in main.hosts:
                     if host.name == args[0]:
                         self.hostA = host
                     elif host.name == args[1]:
                         self.hostB = host
                     if self.hostA != None and self.hostB != None:
                         break
                 if self.hostA == None:
                     main.log.warn("Host %s does not exist: " % (args[0]))
                     return EventStates().ABORT
                 if self.hostB == None:
                     main.log.warn("Host %s does not exist: " % (args[1]))
                     return EventStates().ABORT
                 index = int(args[2])
                 if index < 1 or index > int(main.numCtrls):
                     main.log.warn("%s - invalid argument: %s" %
                                   (self.typeString, index))
                     return EventStates().ABORT
                 if not main.controllers[index - 1].isUp():
                     main.log.warn(self.typeString +
                                   " - invalid argument: onos %s is down" %
                                   (controller.index))
                     return EventStates().ABORT
                 self.CLIIndex = index
                 return self.startHostIntentEvent()
Esempio n. 14
0
    def installAllHostIntents(self, scheduleMethod, args=None):
        """
        This function installs host intents for all host pairs
        After all intent events are inserted, this funciton also insert intent and traffic checks
        """
        import itertools

        with self.eventGeneratorLock:
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent(
                    EventType().NULL,
                    EventScheduleMethod().RUN_BLOCK)
            availableControllers = []
            for controller in main.controllers:
                if controller.isUp():
                    availableControllers.append(controller.index)
            if len(availableControllers) == 0:
                main.log.warn("Event Generator - No available controllers")
                return
            hostCombos = list(itertools.combinations(main.hosts, 2))
            for i in xrange(0, len(hostCombos), len(availableControllers)):
                for CLIIndex in availableControllers:
                    if i >= len(hostCombos):
                        break
                    main.eventScheduler.scheduleEvent(
                        EventType().APP_INTENT_HOST_ADD,
                        EventScheduleMethod().RUN_NON_BLOCK, [
                            hostCombos[i][0].name, hostCombos[i][1].name,
                            CLIIndex
                        ])
                    i += 1
            # Pending checks after installing all intents
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent(
                    EventType().NULL,
                    EventScheduleMethod().RUN_BLOCK)
            sleepTime = int(main.params['EVENT']['installAllHostIntents']
                            ['sleepBeforeCheck'])
            main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                              EventScheduleMethod().RUN_BLOCK,
                                              [sleepTime])
            main.eventScheduler.scheduleEvent(
                EventType().CHECK_INTENT,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventScheduler.scheduleEvent(
                EventType().CHECK_FLOW,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventScheduler.scheduleEvent(
                EventType().CHECK_TRAFFIC,
                EventScheduleMethod().RUN_NON_BLOCK)
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent(
                    EventType().NULL,
                    EventScheduleMethod().RUN_BLOCK)
Esempio n. 15
0
 def startEvent( self, args ):
     with self.eventLock:
         main.log.info( "%s - starting event" % ( self.typeString ) )
         result = EventStates().PASS
         if self.typeIndex == EventType().ONOS_ONOS_DOWN or self.typeIndex == EventType().ONOS_ONOS_UP:
             if len( args ) < 1:
                 main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
                 result = EventStates().ABORT
             elif len( args ) > 1:
                 main.log.warn( "%s - Too many arguments: %s" % ( self.typeString, args ) )
                 result = EventStates().ABORT
             else:
                 index = int( args[ 0 ] )
                 if index < 1 or index > int( main.numCtrls ):
                     main.log.warn( "%s - invalid argument: %s" % ( self.typeString, index ) )
                     result = EventStates().ABORT
                 else:
                     self.ONOSIndex = index
                     result = self.startONOSEvent()
         return result
Esempio n. 16
0
 def triggerEvent( self, typeIndex, scheduleMethod, *args ):
     """
     This function triggers an event from inside of CHOTestMonkey
     """
     import time
     if typeIndex not in EventType().map.keys():
         main.log.warn( "Event Generator - Unknown event type: " + str( typeIndex ) )
         return
     if scheduleMethod not in EventScheduleMethod().map.keys():
         main.log.warn( "Event Generator - Unknown event schedule method: " + str( scheduleMethod ) )
         return
     while not main.eventScheduler.isAvailable():
         time.sleep( int( main.params[ 'GENERATOR' ][ 'insertEventRetryInterval' ] ) )
     self.insertEvent( typeIndex, scheduleMethod, list( args ) )
Esempio n. 17
0
    def randomDeviceToggle(self, scheduleMethod, args=[5], blocking=True):
        """
        The function randomly removes a device and then adds it back
        After each individual device event, all checks are inserted into the scheduler
        param:
            args[0] is the average interval between device down and device up events
            blocking means blocking other events from being scheduled between device down and device up
        """
        import random
        import time

        if len(args) < 1:
            main.log.warn(
                "Event Generator - Not enough arguments for randomDeviceToggle: %s"
                % (args))
        elif len(args) > 1:
            main.log.warn(
                "Event Generator - Too many arguments for randomDeviceToggle: %s"
                % (args))
        else:
            downUpAvgInterval = int(args[0])
        self.eventGeneratorLock.acquire()
        main.eventScheduler.scheduleEvent(EventType().NETWORK_DEVICE_DOWN,
                                          scheduleMethod, ['random'])
        sleepTime = int(
            main.params['EVENT']['randomLinkToggle']['sleepBeforeCheck'])
        main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                          EventScheduleMethod().RUN_BLOCK,
                                          [sleepTime])
        self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
        if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
            # Insert a NULL BLOCK event
            main.eventScheduler.scheduleEvent(EventType().NULL,
                                              EventScheduleMethod().RUN_BLOCK)
        downUpInterval = abs(random.gauss(downUpAvgInterval, 1))
        if not blocking:
            self.eventGeneratorLock.release()
            time.sleep(downUpInterval)
            self.eventGeneratorLock.acquire()
        else:
            time.sleep(downUpInterval)
        main.eventScheduler.scheduleEvent(EventType().NETWORK_DEVICE_UP,
                                          scheduleMethod, ['random'])
        main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                          EventScheduleMethod().RUN_BLOCK,
                                          [sleepTime])
        self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
        if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
            main.eventScheduler.scheduleEvent(EventType().NULL,
                                              EventScheduleMethod().RUN_BLOCK)
        self.eventGeneratorLock.release()
Esempio n. 18
0
 def handleConnection(self, conn):
     """
     Handle connections from event triggers
     """
     request = conn.recv()
     if isinstance(
             request,
             list) and (request[0] == MessageType().EVENT_REQUEST
                        or request[0] == MessageType().EVENT_REQUEST_DEBUG):
         if len(request) < 3:
             response = MessageType().NOT_ENOUGH_ARGUMENT
         elif request[0] == MessageType(
         ).EVENT_REQUEST and not main.eventScheduler.isAvailable():
             response = MessageType().EVENT_DENIED
         else:
             typeString = str(request[1])
             scheduleMethodString = str(request[2])
             if len(request) > 3:
                 args = request[3:]
             else:
                 args = None
             for key, value in EventType().map.items():
                 if value == typeString:
                     typeIndex = key
                     break
             if not value == typeString:
                 response = MessageType().UNKNOWN_EVENT_TYPE
             else:
                 for key, value in EventScheduleMethod().map.items():
                     if value == scheduleMethodString:
                         scheduleMethod = key
                         break
                 if not value == scheduleMethodString:
                     response = MessageType().UNKNOWN_SCHEDULE_METHOD
                 else:
                     self.insertEvent(typeIndex, scheduleMethod, args)
                     response = MessageType().EVENT_INSERTED
     else:
         response = MessageType().UNKNOWN_MESSAGE
     conn.send(response)
     conn.close()
Esempio n. 19
0
    def CASE33( self, main ):
        """
        Uninstall point intents and check intent states and ping
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report( "Uninstall point intents and check intent states and ping" )
        main.log.report( "__________________________________________________" )
        main.case( "Uninstall point intents and check intent states and ping" )
        main.step( "Uninstall point intents and check intent states and ping" )
        main.caseResult = main.TRUE
        main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_DEL_ALL, EventScheduleMethod().RUN_BLOCK )
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals( expect=main.TRUE,
                                 actual=main.caseResult,
                                 onpass="******",
                                 onfail="Uninstall point intents test failed" )
        time.sleep( main.caseSleep )
Esempio n. 20
0
    def CASE51( self, main ):
        """
        Set FlowObjective to False
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report( "Set FlowObjective to False" )
        main.log.report( "__________________________________________________" )
        main.case( "Set FlowObjective to False" )
        main.step( "Set FlowObjective to False" )
        main.caseResult = main.TRUE
        main.eventGenerator.triggerEvent( EventType().ONOS_SET_FLOWOBJ, EventScheduleMethod().RUN_BLOCK, 'false' )
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals( expect=main.TRUE,
                                 actual=main.caseResult,
                                 onpass="******",
                                 onfail="Set FlowObjective test failed" )
        time.sleep( main.caseSleep )
Esempio n. 21
0
    def CASE60( self, main ):
        """
        Balance device masters
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report( "Balance device masters" )
        main.log.report( "__________________________________________________" )
        main.case( "Balance device masters" )
        main.step( "Balance device masters" )
        main.caseResult = main.TRUE
        main.eventGenerator.triggerEvent( EventType().ONOS_BALANCE_MASTERS, EventScheduleMethod().RUN_BLOCK )
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals( expect=main.TRUE,
                                 actual=main.caseResult,
                                 onpass="******",
                                 onfail="Balance masters test failed" )
        time.sleep( main.caseSleep )
Esempio n. 22
0
    def CASE10( self, main ):
        """
        Run all enabled checks
        """
        import time
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report( "Run all enabled checks" )
        main.log.report( "__________________________________________________" )
        main.case( "Run all enabled checks" )
        main.step( "Run all enabled checks" )
        main.caseResult = main.TRUE
        main.eventGenerator.triggerEvent( EventType().CHECK_ALL, EventScheduleMethod().RUN_BLOCK )
        # Wait for the scheduler to become idle before going to the next testcase
        with main.eventScheduler.idleCondition:
            while not main.eventScheduler.isIdle():
                main.eventScheduler.idleCondition.wait()
        utilities.assert_equals( expect=main.TRUE,
                                 actual=main.caseResult,
                                 onpass="******",
                                 onfail="Not all enabled checks passed" )
        time.sleep( main.caseSleep )
Esempio n. 23
0
    def randomDeviceGroupToggle(self,
                                scheduleMethod,
                                args=None,
                                blocking=True):
        """
        The function randomly adds a group of device down-up events into the scheduler
        After each device down or up, all checks are inserted into the scheduler
        param:
            args[0] is the number of devices that are to be brought down
            args[1] is the average interval between device down events
            args[2] is the average interval between device group down and group up events
            blocking means blocking other events from being scheduled between device events
        """
        import random
        import time

        if len(args) < 3:
            main.log.warn(
                "Event Generator - Not enough arguments for randomDeviceGroupToggle: %s"
                % (args))
        elif len(args) > 3:
            main.log.warn(
                "Event Generator - Too many arguments for randomDeviceGroupToggle: %s"
                % (args))
        else:
            deviceGroupSize = int(args[0])
            downDownAvgInterval = int(args[1])
            downUpAvgInterval = int(args[2])
        downDevices = []
        for i in range(0, deviceGroupSize):
            with main.variableLock:
                graphHelper = GraphHelper()
                availableDevices = graphHelper.getNonCutVertices()
                if len(availableDevices) == 0:
                    main.log.warn(
                        "All devices are cut vertices, aborting event")
                    continue
                device = random.sample(availableDevices, 1)
            if i == 0:
                self.eventGeneratorLock.acquire()
            main.eventScheduler.scheduleEvent(EventType().NETWORK_DEVICE_DOWN,
                                              scheduleMethod, [device[0].name])
            with main.variableLock:
                device[0].setPendingDown()
            downDevices.append(device[0])
            sleepTime = int(main.params['EVENT']['randomLinkGroupToggle']
                            ['sleepBeforeCheck'])
            main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                              EventScheduleMethod().RUN_BLOCK,
                                              [sleepTime])
            self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                # Insert a NULL BLOCK event
                main.eventScheduler.scheduleEvent(
                    EventType().NULL,
                    EventScheduleMethod().RUN_BLOCK)
            downDownInterval = abs(random.gauss(downDownAvgInterval, 1))
            if not blocking:
                self.eventGeneratorLock.release()
                time.sleep(downDownInterval)
                self.eventGeneratorLock.acquire()
            else:
                time.sleep(downDownInterval)

        downUpInterval = abs(random.gauss(downUpAvgInterval, 1))
        if not blocking:
            self.eventGeneratorLock.release()
            time.sleep(downUpInterval)
            self.eventGeneratorLock.acquire()
        else:
            time.sleep(downUpInterval)

        for device in downDevices:
            main.eventScheduler.scheduleEvent(EventType().NETWORK_DEVICE_UP,
                                              scheduleMethod, [device.name])
            main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                              EventScheduleMethod().RUN_BLOCK,
                                              [sleepTime])
            self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent(
                    EventType().NULL,
                    EventScheduleMethod().RUN_BLOCK)
            upUpInterval = abs(random.gauss(downDownAvgInterval, 1))
            if not blocking:
                self.eventGeneratorLock.release()
                time.sleep(upUpInterval)
                self.eventGeneratorLock.acquire()
            else:
                time.sleep(upUpInterval)
        self.eventGeneratorLock.release()
Esempio n. 24
0
    def randomLinkToggle(self, scheduleMethod, args=[5], blocking=True):
        """
        The function randomly adds a link down-up event pair into the scheduler
        After each individual link event, all checks are inserted into the scheduler
        param:
            args[0] is the average interval between link down and link up events
            blocking means blocking other events from being scheduled between link down and link up
        """
        import random
        import time

        if len(args) < 1:
            main.log.warn(
                "Event Generator - Not enough arguments for randomLinkToggle: %s"
                % (args))
        elif len(args) > 1:
            main.log.warn(
                "Event Generator - Too many arguments for randomLinkToggle: %s"
                % (args))
        else:
            downUpAvgInterval = int(args[0])
        with main.variableLock:
            graphHelper = GraphHelper()
            availableLinks = graphHelper.getNonCutEdges()
            if len(availableLinks) == 0:
                main.log.warn("All links are cut edges, aborting event")
                return
            link = random.sample(availableLinks, 1)

        self.eventGeneratorLock.acquire()
        main.eventScheduler.scheduleEvent(
            EventType().NETWORK_LINK_DOWN, scheduleMethod,
            [link[0].deviceA.name, link[0].deviceB.name])
        with main.variableLock:
            link[0].setPendingDown()
            link[0].backwardLink.setPendingDown()
        sleepTime = int(
            main.params['EVENT']['randomLinkToggle']['sleepBeforeCheck'])
        main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                          EventScheduleMethod().RUN_BLOCK,
                                          [sleepTime])
        self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
        if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
            # Insert a NULL BLOCK event
            main.eventScheduler.scheduleEvent(EventType().NULL,
                                              EventScheduleMethod().RUN_BLOCK)
        downUpInterval = abs(random.gauss(downUpAvgInterval, 1))
        if not blocking:
            self.eventGeneratorLock.release()
            time.sleep(downUpInterval)
            self.eventGeneratorLock.acquire()
        else:
            time.sleep(downUpInterval)
        main.eventScheduler.scheduleEvent(
            EventType().NETWORK_LINK_UP, scheduleMethod,
            [link[0].deviceA.name, link[0].deviceB.name])
        main.eventScheduler.scheduleEvent(EventType().TEST_SLEEP,
                                          EventScheduleMethod().RUN_BLOCK,
                                          [sleepTime])
        self.insertAllChecks(EventScheduleMethod().RUN_NON_BLOCK)
        if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
            main.eventScheduler.scheduleEvent(EventType().NULL,
                                              EventScheduleMethod().RUN_BLOCK)
        self.eventGeneratorLock.release()
Esempio n. 25
0
 def startEvent(self, args):
     """
     args are the device name and port number, e.g. [ 's1', '5' ]
     """
     with self.eventLock:
         # main.log.info( "%s - starting event" % ( self.typeString ) )
         if len(args) < 2:
             main.log.warn("%s - Not enough arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         elif len(args) > 2:
             main.log.warn("%s - Too many arguments: %s" %
                           (self.typeString, args))
             return EventStates().ABORT
         if args[0] == 'random' or args[1] == 'random':
             if self.typeIndex == EventType().NETWORK_PORT_DOWN:
                 with main.networkLock:
                     linkRandom = main.Network.getLinkRandom(
                         excludeNodes=main.excludeNodes,
                         skipLinks=main.skipLinks)
                 if linkRandom is None:
                     main.log.warn("No link available, aborting event")
                     return EventStates().ABORT
                 for link in main.links:
                     if link.deviceA.name == linkRandom[
                             0] and link.deviceB.name == linkRandom[1]:
                         self.device = link.deviceA
                         self.port = int(link.portA)
                 if not self.device:
                     main.log.warn(
                         "Failed to get a radnom device port, aborting event"
                     )
                     return EventStates().ABORT
             elif self.typeIndex == EventType().NETWORK_PORT_UP:
                 import random
                 with main.variableLock:
                     downPorts = {}
                     for link in main.links:
                         if link.isDown():
                             if int(link.portA) in link.deviceA.downPorts:
                                 downPorts[link.deviceA] = link.portA
                     if len(downPorts) == 0:
                         main.log.warn(
                             "None of the links are in 'down' state, aborting event"
                         )
                         return EventStates().ABORT
                     deviceList = random.sample(downPorts, 1)
                     self.device = deviceList[0]
                     self.port = int(downPorts[self.device])
         if self.device is None:
             for device in main.devices:
                 if device.name == args[0]:
                     self.device = device
             if self.device is None:
                 main.log.warn("Device %s does not exist: " % (args[0]))
                 return EventStates().ABORT
         if self.port is None:
             try:
                 self.port = int(args[1])
             except Exception:
                 main.log.warn("Device port is not a number: {}".format(
                     args[1]))
                 return EventStates().ABORT
         if self.link is None:
             for link in main.links:
                 if link.deviceA.name == self.device.name and int(
                         link.portA) == self.port:
                     self.link = link
             if self.link is None:
                 main.log.warn(
                     "There's no link on device {} port {}".format(
                         self.device.name, self.port))
                 return EventStates().ABORT
         main.log.debug("%s - %s:%s" %
                        (self.typeString, self.device, self.port))
         return self.startPortEvent()
    def CASE70(self, main):
        """
        Randomly generate events
        """
        import time
        import random
        from tests.CHOTestMonkey.dependencies.events.Event import EventType
        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod

        main.log.report("Randomly generate events")
        main.log.report("__________________________________________________")
        main.case("Randomly generate events")
        main.step("Randomly generate events")
        main.caseResult = main.TRUE
        sleepSec = int(main.params['CASE70']['sleepSec'])
        hostIntentNum = 0
        pointIntentNum = 0
        downDeviceNum = 0
        downLinkNum = 0
        flowObj = False
        upControllers = [1, 2, 3]
        while True:
            events = []
            for i in range(int(main.params['CASE70']['toggleFlowObj'])):
                events.append('toggle-flowobj')
            for i in range(int(main.params['CASE70']['addHostIntentWeight'])):
                events.append('add-host-intent')
            for i in range(int(main.params['CASE70']['addPointIntentWeight'])):
                events.append('add-point-intent')
            for i in range(int(main.params['CASE70']['linkDownWeight'])):
                events.append('link-down')
            for i in range(int(main.params['CASE70']['deviceDownWeight'])):
                events.append('device-down')
            for i in range(int(pow(hostIntentNum, 1.5) / 100)):
                events.append('del-host-intent')
            for i in range(int(pow(pointIntentNum, 1.5) / 100)):
                events.append('del-point-intent')
            for i in range(pow(2, downLinkNum) - 1):
                events.append('link-up')
            for i in range(pow(5, downDeviceNum) - 1):
                events.append('device-up')
            main.log.debug(events)
            event = random.sample(events, 1)[0]
            if event == 'add-host-intent':
                n = random.randint(5, 50)
                for i in range(n):
                    cliIndex = random.sample(upControllers, 1)[0]
                    main.eventGenerator.triggerEvent(
                        EventType().APP_INTENT_HOST_ADD,
                        EventScheduleMethod().RUN_BLOCK, 'random', 'random',
                        cliIndex)
                    hostIntentNum += 1
            elif event == 'del-host-intent':
                n = random.randint(5, hostIntentNum)
                for i in range(n):
                    cliIndex = random.sample(upControllers, 1)[0]
                    main.eventGenerator.triggerEvent(
                        EventType().APP_INTENT_HOST_DEL,
                        EventScheduleMethod().RUN_BLOCK, 'random', 'random',
                        cliIndex)
                    hostIntentNum -= 1
            elif event == 'add-point-intent':
                n = random.randint(5, 50)
                for i in range(n):
                    cliIndex = random.sample(upControllers, 1)[0]
                    main.eventGenerator.triggerEvent(
                        EventType().APP_INTENT_POINT_ADD,
                        EventScheduleMethod().RUN_BLOCK, 'random', 'random',
                        cliIndex, 'bidirectional')
                    pointIntentNum += 2
            elif event == 'del-point-intent':
                n = random.randint(5, pointIntentNum / 2)
                for i in range(n):
                    cliIndex = random.sample(upControllers, 1)[0]
                    main.eventGenerator.triggerEvent(
                        EventType().APP_INTENT_POINT_DEL,
                        EventScheduleMethod().RUN_BLOCK, 'random', 'random',
                        cliIndex, 'bidirectional')
                    pointIntentNum -= 2
            elif event == 'link-down':
                main.eventGenerator.triggerEvent(
                    EventType().NETWORK_LINK_DOWN,
                    EventScheduleMethod().RUN_BLOCK, 'random', 'random')
                downLinkNum += 1
            elif event == 'link-up':
                main.eventGenerator.triggerEvent(
                    EventType().NETWORK_LINK_UP,
                    EventScheduleMethod().RUN_BLOCK, 'random', 'random')
                downLinkNum -= 1
            elif event == 'device-down':
                main.eventGenerator.triggerEvent(
                    EventType().NETWORK_DEVICE_DOWN,
                    EventScheduleMethod().RUN_BLOCK, 'random')
                downDeviceNum += 1
            elif event == 'device-up':
                main.eventGenerator.triggerEvent(
                    EventType().NETWORK_DEVICE_UP,
                    EventScheduleMethod().RUN_BLOCK, 'random')
                downDeviceNum -= 1
            elif event == 'toggle-flowobj':
                if not flowObj:
                    main.eventGenerator.triggerEvent(
                        EventType().ONOS_SET_FLOWOBJ,
                        EventScheduleMethod().RUN_BLOCK, 'true')
                else:
                    main.eventGenerator.triggerEvent(
                        EventType().ONOS_SET_FLOWOBJ,
                        EventScheduleMethod().RUN_BLOCK, 'false')
                flowObj = not flowObj
            else:
                pass
            main.eventGenerator.triggerEvent(
                EventType().CHECK_TOPO,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventGenerator.triggerEvent(
                EventType().CHECK_ONOS,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventGenerator.triggerEvent(
                EventType().CHECK_TRAFFIC,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventGenerator.triggerEvent(
                EventType().CHECK_FLOW,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventGenerator.triggerEvent(
                EventType().CHECK_INTENT,
                EventScheduleMethod().RUN_NON_BLOCK)
            main.eventGenerator.triggerEvent(
                EventType().CHECK_RAFT_LOG_SIZE,
                EventScheduleMethod().RUN_NON_BLOCK)
            with main.eventScheduler.idleCondition:
                while not main.eventScheduler.isIdle():
                    main.eventScheduler.idleCondition.wait()
            time.sleep(sleepSec)
        utilities.assert_equals(expect=main.TRUE,
                                actual=main.caseResult,
                                onpass="******",
                                onfail="Randomly generate events test failed")
        time.sleep(main.caseSleep)
Esempio n. 27
0
    def randomLinkGroupToggle( self, scheduleMethod, args=None, blocking=True ):
        """
        The function randomly adds a group of link down-up events into the scheduler
        After each link down or up, all checks are inserted into the scheduler
        param:
            args[ 0 ] is the number of links that are to be brought down
            args[ 1 ] is the average interval between link down events
            args[ 2 ] is the average interval between link group down and group up events
            blocking means blocking other events from being scheduled between link events
        """
        import random
        import time

        if len( args ) < 3:
            main.log.warn( "Event Generator - Not enough arguments for randomLinkGroupToggle: %s" % ( args ) )
        elif len( args ) > 3:
            main.log.warn( "Event Generator - Too many arguments for randomLinkGroupToggle: %s" % ( args ) )
        else:
            linkGroupSize = int( args[ 0 ] )
            downDownAvgInterval = int( args[ 1 ] )
            downUpAvgInterval = int( args[ 2 ] )
        for i in range( 0, linkGroupSize ):
            if i == 0:
                self.eventGeneratorLock.acquire()
            main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_DOWN,
                                               scheduleMethod,
                                               [ 'random', 'random' ] )
            sleepTime = int( main.params[ 'EVENT' ][ 'randomLinkGroupToggle' ][ 'sleepBeforeCheck' ] )
            main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
            self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                # Insert a NULL BLOCK event
                main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
            downDownInterval = abs( random.gauss( downDownAvgInterval, 1 ) )
            if not blocking:
                self.eventGeneratorLock.release()
                time.sleep( downDownInterval )
                self.eventGeneratorLock.acquire()
            else:
                time.sleep( downDownInterval )

        downUpInterval = abs( random.gauss( downUpAvgInterval, 1 ) )
        if not blocking:
            self.eventGeneratorLock.release()
            time.sleep( downUpInterval )
            self.eventGeneratorLock.acquire()
        else:
            time.sleep( downUpInterval )

        for i in range( 0, linkGroupSize ):
            main.eventScheduler.scheduleEvent( EventType().NETWORK_LINK_UP,
                                               scheduleMethod,
                                               [ 'random', 'random' ] )
            main.eventScheduler.scheduleEvent( EventType().TEST_SLEEP, EventScheduleMethod().RUN_BLOCK, [ sleepTime ] )
            self.insertAllChecks( EventScheduleMethod().RUN_NON_BLOCK )
            if scheduleMethod == EventScheduleMethod().RUN_BLOCK:
                main.eventScheduler.scheduleEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
            upUpInterval = abs( random.gauss( downDownAvgInterval, 1 ) )
            if not blocking:
                self.eventGeneratorLock.release()
                time.sleep( upUpInterval )
                self.eventGeneratorLock.acquire()
            else:
                time.sleep( upUpInterval )
        self.eventGeneratorLock.release()
Esempio n. 28
0
 def startEvent(self, args):
     with self.eventLock:
         # main.log.info( "%s - starting event" % ( self.typeString ) )
         if self.typeIndex == EventType(
         ).APP_INTENT_POINT_ADD or self.typeIndex == EventType(
         ).APP_INTENT_POINT_DEL:
             if len(args) < 3:
                 main.log.warn("%s - Not enough arguments: %s" %
                               (self.typeString, args))
                 return EventStates().ABORT
             elif len(args) > 4:
                 main.log.warn("%s - Too many arguments: %s" %
                               (self.typeString, args))
                 return EventStates().ABORT
             try:
                 if args[0] == 'random' or args[1] == 'random':
                     if self.typeIndex == EventType().APP_INTENT_POINT_ADD:
                         hostPairRandom = self.getRandomHostPair(
                             connected=False)
                         if hostPairRandom is None:
                             main.log.warn(
                                 "All host pairs are connected, aborting event"
                             )
                             return EventStates().ABORT
                         self.deviceA = hostPairRandom[0].device
                         self.deviceB = hostPairRandom[1].device
                     elif self.typeIndex == EventType(
                     ).APP_INTENT_POINT_DEL:
                         intent = self.getRandomIntentByType('INTENT_POINT')
                         if intent is None:
                             main.log.warn(
                                 "No point intent for deletion, aborting event"
                             )
                             return EventStates().ABORT
                         self.deviceA = intent.deviceA
                         self.deviceB = intent.deviceB
                 elif args[0] == args[1]:
                     main.log.warn("%s - invalid argument: %s" %
                                   (self.typeString, args[0], args[1]))
                     return EventStates().ABORT
                 else:
                     for device in main.devices:
                         if device.name == args[0]:
                             self.deviceA = device
                         elif device.name == args[1]:
                             self.deviceB = device
                         if self.deviceA is not None and self.deviceB is not None:
                             break
                     if self.deviceA is None:
                         main.log.warn("Device %s does not exist: " %
                                       (args[0]))
                         return EventStates().ABORT
                     if self.deviceB is None:
                         main.log.warn("Device %s does not exist: " %
                                       (args[1]))
                         return EventStates().ABORT
                 index = int(args[2])
                 if index < 1 or index > int(main.Cluster.numCtrls):
                     main.log.warn("%s - invalid argument: %s" %
                                   (self.typeString, index))
                     return EventStates().ABORT
                 if not main.controllers[index - 1].isUp():
                     main.log.warn(self.typeString +
                                   " - invalid argument: onos %s is down" %
                                   (controller.index))
                     return EventStates().ABORT
                 self.CLIIndex = index
                 if len(args) == 4 and args[3] == 'bidirectional':
                     # Install point intents for both directions
                     resultA = self.startPointIntentEvent()
                     [self.deviceA,
                      self.deviceB] = [self.deviceB, self.deviceA]
                     resultB = self.startPointIntentEvent()
                     if resultA == EventStates(
                     ).PASS and resultB == EventStates().PASS:
                         return EventStates().PASS
                     else:
                         return EventStates().FAIL
                 else:
                     return self.startPointIntentEvent()
             except Exception:
                 main.log.warn("Caught exception, aborting event")
                 return EventStates().ABORT