blob: 2a637e63229e821f363c8baaef7e28f2b0fd8204 [file] [log] [blame]
You Wangdb927a52016-02-26 11:03:28 -08001"""
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07002Copyright 2016 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
22"""
You Wangdb927a52016-02-26 11:03:28 -080023This file contains the Event class for CHOTestMonkey
24Author: you@onlab.us
25"""
26from threading import Lock
27
Jon Hall2bb3e212017-05-24 17:07:25 -070028
You Wangdb927a52016-02-26 11:03:28 -080029class EventType:
Jon Hall2bb3e212017-05-24 17:07:25 -070030
You Wangdb927a52016-02-26 11:03:28 -080031 def __init__( self ):
32 self.map = {}
Jon Hall2bb3e212017-05-24 17:07:25 -070033 # Group events ( >100 ) should be divided into individual events by the generator before going to the scheduler
You Wangdb927a52016-02-26 11:03:28 -080034 self.NULL = 0
35 for eventName in main.params[ 'EVENT' ].keys():
36 typeString = main.params[ 'EVENT' ][ eventName ][ 'typeString' ]
37 typeIndex = int( main.params[ 'EVENT' ][ eventName ][ 'typeIndex' ] )
38 setattr( self, typeString, typeIndex )
39 self.map[ typeIndex ] = typeString
40
Jon Hall2bb3e212017-05-24 17:07:25 -070041
You Wangdb927a52016-02-26 11:03:28 -080042class EventStates:
Jon Hall2bb3e212017-05-24 17:07:25 -070043
You Wangdb927a52016-02-26 11:03:28 -080044 def __init__( self ):
45 self.map = {}
46 self.FAIL = 0
47 self.map[ 0 ] = 'FAIL'
48 self.PASS = 1
49 self.map[ 1 ] = 'PASS'
50 self.ABORT = -1
51 self.map[ -1 ] = 'ABORT'
52
Jon Hall2bb3e212017-05-24 17:07:25 -070053
You Wangdb927a52016-02-26 11:03:28 -080054class Event:
Jon Hall2bb3e212017-05-24 17:07:25 -070055
You Wangdb927a52016-02-26 11:03:28 -080056 """
57 Event class for CHOTestMonkey
58 It is the super class for CheckEvent and NetworkEvent
59 """
60 def __init__( self ):
61 self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
62 self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
63 self.eventLock = Lock()
64 self.variableLock = Lock()
65
66 def startEvent( self, args=None ):
67 """
68 Start running the event
69 """
70 return EventStates().PASS