Framework of the new CHOtest
Change-Id: Ie5b58bfa2ed487386443692cbea0d469d7419c24
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py
new file mode 100644
index 0000000..2a18ac7
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/NetworkElement.py
@@ -0,0 +1,80 @@
+"""
+This file contains device, host and link class for CHOTestMonkey
+Author: you@onlab.us
+"""
+
+class NetworkElement:
+ def __init__( self, index ):
+ self.default = ''
+ self.index = index
+ self.status = 'up'
+
+ def isUp( self ):
+ return self.status == 'up'
+
+ def isDown( self ):
+ return self.status == 'down'
+
+ def isRemoved( self ):
+ return self.status == 'removed'
+
+ def setPendingDown( self ):
+ self.status = 'pending_down'
+
+ def setRemoved( self ):
+ self.status = 'removed'
+
+ def bringDown( self ):
+ self.status = 'down'
+
+ def bringUp( self ):
+ self.status = 'up'
+
+class Device( NetworkElement ):
+ def __init__( self, index, name, dpid ):
+ NetworkElement.__init__( self, index )
+ self.name = name
+ self.dpid = dpid
+ self.hosts = []
+ # For each bidirectional link, we only store one direction here
+ self.outgoingLinks = []
+
+ def __str__( self ):
+ return "name: " + self.name + ", dpid: " + self.dpid
+
+class Host( NetworkElement ):
+ def __init__( self, index, name, id, mac, device, devicePort, vlan, ipAddresses ):
+ NetworkElement.__init__( self, index )
+ self.name = name
+ self.id = id
+ self.mac = mac
+ self.device = device
+ self.devicePort = devicePort
+ self.vlan = vlan
+ self.ipAddresses = ipAddresses
+ self.correspondents = []
+ self.handle = None
+
+ def __str__( self ):
+ return "name: " + self.name + ", mac: " + self.mac + ", device: " + self.device.dpid + ", ipAddresses: " + str( self.ipAddresses )
+
+ def setHandle( self, handle ):
+ self.handle = handle
+
+class Link( NetworkElement ):
+ """
+ Unidirectional link
+ """
+ def __init__( self, index, deviceA, portA, deviceB, portB ):
+ NetworkElement.__init__( self, index )
+ self.backwardLink = None
+ self.deviceA = deviceA
+ self.portA = portA
+ self.deviceB = deviceB
+ self.portB = portB
+
+ def __str__( self ):
+ return self.deviceA.dpid + "/" + self.portA + " - " + self.deviceB.dpid + "/" + self.portB
+
+ def setBackwardLink( self, link ):
+ self.backwardLink = link
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
new file mode 100644
index 0000000..699a17d
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
@@ -0,0 +1,61 @@
+"""
+This file contains intent class for CHOTestMonkey
+Author: you@onlab.us
+"""
+from threading import Lock
+
+class Controller:
+ def __init__( self, index ):
+ self.default = ''
+ self.index = index
+ self.ip = main.onosIPs[ index - 1 ]
+ self.CLI = None
+ self.CLILock = Lock()
+ self.status = 'up'
+
+ def setCLI( self, CLI ):
+ self.CLI = CLI
+
+ def startCLI( self ):
+ return self.CLI.startOnosCli( self.ip )
+
+ def isUp( self ):
+ return self.status == 'up'
+
+ def bringDown( self ):
+ self.status = 'down'
+
+ def bringUp( self ):
+ self.status = 'up'
+
+class Intent:
+ def __init__( self, id ):
+ self.default = ''
+ self.type = 'INTENT'
+ self.id = id
+
+ def isHostIntent( self ):
+ return self.type == 'INTENT_HOST'
+
+ def isPointIntent( self ):
+ return self.type == 'INTENT_POINT'
+
+class HostIntent( Intent ):
+ def __init__( self, id, hostA, hostB ):
+ Intent.__init__( self, id )
+ self.type = 'INTENT_HOST'
+ self.hostA = hostA
+ self.hostB = hostB
+
+ def __str__( self ):
+ return "ID: " + self.id
+
+class PointIntent( Intent ):
+ def __init__( self, id, deviceA, deviceB ):
+ Intent.__init__( self, id )
+ self.type = 'INTENT_POINT'
+ self.deviceA = deviceA
+ self.deviceB = deviceB
+
+ def __str__( self ):
+ return "ID: " + self.id
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/__init__.py b/TestON/tests/CHOTestMonkey/dependencies/elements/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/__init__.py