Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest
diff --git a/README.md b/README.md
index 8224da6..bd2fa6f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
TestON, a testing infastructure by Paxterra
=======================================
-TestON is the testing platform that all the ONOS tests are being run on curretly.
+TestON is the testing platform that all the ONOS tests are being run on currently.
Setup
diff --git a/TestON/dependancies/pyintents.py b/TestON/dependancies/pyintents.py
new file mode 100755
index 0000000..b593845
--- /dev/null
+++ b/TestON/dependancies/pyintents.py
@@ -0,0 +1,46 @@
+#! /usr/bin/env python
+'''
+This file creates the ONOS intents for the sanity 4 nodes tests. These intents will be translated into flows by ONOS and pushed to the switches.
+'''
+
+import json
+import requests
+
+url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
+headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
+
+
+'''response
+[{'intent_id':'5','status':'CREATED','log':['created, time:73268214932534']}]
+'''
+
+
+
+for i in range(6,16):
+ #intent = [{'intent_id': '%d' %i,'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':'8249','srcPort':1,'srcMac':'00:00:00:00:00:01','dstSwitch':'4103','dstPort':1,'dstMac':'00:00:00:00:00:02'}]
+ srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
+ dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
+ srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
+ dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
+ srcPort = 1
+ dstPort = 1
+
+ intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
+
+
+ print json.dumps(intent, sort_keys = True)
+
+
+ #r = requests.post(url, data=json.dumps(iid, sort_keys=True)+json.dumps(intent, sort_keys=True), headers = headers)
+ r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
+ print r
+ print r.content
+
+
+
+ intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
+ print json.dumps(intent, sort_keys = True)
+ r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
+ print r
+ print r.content
+
diff --git a/TestON/dependancies/rmpyintents.py b/TestON/dependancies/rmpyintents.py
new file mode 100755
index 0000000..10bb5d4
--- /dev/null
+++ b/TestON/dependancies/rmpyintents.py
@@ -0,0 +1,49 @@
+#! /usr/bin/env python
+
+'''
+This file removes the ONOS intents for the sanity 4 nodes tests. The flows associated with these intents should be deleted from the switches.
+'''
+
+import json
+import requests
+
+
+
+url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
+headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
+
+
+'''response
+[{'intent_id':'5','status':'CREATED','log':['created, time:73268214932534']}]
+'''
+
+
+
+for i in range(6,16):
+ #intent = [{'intent_id': '%d' %i,'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':'8249','srcPort':1,'srcMac':'00:00:00:00:00:01','dstSwitch':'4103','dstPort':1,'dstMac':'00:00:00:00:00:02'}]
+ srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
+ dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
+ srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
+ dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
+ srcPort = 1
+ dstPort = 1
+
+ intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
+
+
+ print json.dumps(intent, sort_keys = True)
+
+
+ #r = requests.post(url, data=json.dumps(iid, sort_keys=True)+json.dumps(intent, sort_keys=True), headers = headers)
+ r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
+ print r
+ print r.content
+
+
+
+ intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
+ print json.dumps(intent, sort_keys = True)
+ r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
+ print r
+ print r.content
+
diff --git a/TestON/dependancies/topo-onos4node.py b/TestON/dependancies/topo-onos4node.py
new file mode 100644
index 0000000..4fc036c
--- /dev/null
+++ b/TestON/dependancies/topo-onos4node.py
@@ -0,0 +1,63 @@
+"""Custom topology example
+
+Two directly connected switches plus a host for each switch:
+
+ host --- switch --- switch --- host
+
+Adding the 'topos' dict with a key/value pair to generate our newly defined
+topology enables one to pass in '--topo=mytopo' from the command line.
+"""
+
+from mininet.topo import Topo
+
+class MyTopo( Topo ):
+ "Simple topology example."
+
+ def __init__( self ):
+ "Create custom topo."
+ # Initialize topology
+ Topo.__init__( self )
+
+ # Make the middle triangle
+ leftSwitch = self.addSwitch( 's1' , dpid = '1000'.zfill(16))
+ rightSwitch = self.addSwitch( 's2' , dpid = '2000'.zfill(16))
+ topSwitch = self.addSwitch( 's3' , dpid = '3000'.zfill(16))
+ lefthost = self.addHost( 'h1' )
+ righthost = self.addHost( 'h2' )
+ tophost = self.addHost( 'h3' )
+ self.addLink( leftSwitch, lefthost )
+ self.addLink( rightSwitch, righthost )
+ self.addLink( topSwitch, tophost )
+
+ self.addLink( leftSwitch, rightSwitch )
+ self.addLink( leftSwitch, topSwitch )
+ self.addLink( topSwitch, rightSwitch )
+
+ # Make aggregation switches
+ agg1Switch = self.addSwitch( 's4', dpid = '1004'.zfill(16) )
+ agg2Switch = self.addSwitch( 's5', dpid = '2005'.zfill(16) )
+ agg1Host = self.addHost( 'h4' )
+ agg2Host = self.addHost( 'h5' )
+
+ self.addLink( agg1Switch, agg1Host, port1=1, port2=1 )
+ self.addLink( agg2Switch, agg2Host, port1=1, port2=1 )
+
+ self.addLink( agg2Switch, rightSwitch )
+ self.addLink( agg1Switch, leftSwitch )
+
+ # Make two aggregation fans
+ for i in range(10):
+ num=str(i+6)
+ switch = self.addSwitch( 's' + num, dpid = ('10' + num.zfill(2) ).zfill(16))
+ host = self.addHost( 'h' + num )
+ self.addLink( switch, host, port1=1, port2=1 )
+ self.addLink( switch, agg1Switch )
+
+ for i in range(10):
+ num=str(i+31)
+ switch = self.addSwitch( 's' + num, dpid = ('20' + num.zfill(2)).zfill(16) )
+ host = self.addHost( 'h' + num )
+ self.addLink( switch, host, port1=1, port2=1 )
+ self.addLink( switch, agg2Switch )
+
+topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependancies/topo-onos4node.py.old b/TestON/dependancies/topo-onos4node.py.old
new file mode 100644
index 0000000..3328a5d
--- /dev/null
+++ b/TestON/dependancies/topo-onos4node.py.old
@@ -0,0 +1,61 @@
+"""Custom topology example
+
+Two directly connected switches plus a host for each switch:
+
+ host --- switch --- switch --- host
+
+Adding the 'topos' dict with a key/value pair to generate our newly defined
+topology enables one to pass in '--topo=mytopo' from the command line.
+"""
+
+from mininet.topo import Topo
+
+class MyTopo( Topo ):
+ "Simple topology example."
+
+ def __init__( self ):
+ "Create custom topo."
+ # Initialize topology
+ Topo.__init__( self )
+
+ # Make the middle triangle
+ leftSwitch = self.addSwitch( 's1' )
+ rightSwitch = self.addSwitch( 's2' )
+ topSwitch = self.addSwitch( 's3' )
+ lefthost = self.addHost( 'h1' )
+ righthost = self.addHost( 'h2' )
+ tophost = self.addHost( 'h3' )
+ self.addLink( leftSwitch, lefthost )
+ self.addLink( rightSwitch, righthost )
+ self.addLink( topSwitch, tophost )
+
+ self.addLink( leftSwitch, rightSwitch )
+ self.addLink( leftSwitch, topSwitch )
+ self.addLink( topSwitch, rightSwitch )
+
+ # Make aggregation switches
+ agg1Switch = self.addSwitch( 's4' )
+ agg2Switch = self.addSwitch( 's5' )
+ agg1Host = self.addHost( 'h4' )
+ agg2Host = self.addHost( 'h5' )
+
+ self.addLink( agg1Switch, agg1Host )
+ self.addLink( agg2Switch, agg2Host )
+
+ self.addLink( agg1Switch, rightSwitch )
+ self.addLink( agg2Switch, leftSwitch )
+
+ # Make two aggregation fans
+ for i in range(10):
+ switch = self.addSwitch( 's%d' % (i+6) )
+ host = self.addHost( 'h%d' % (i+6) )
+ self.addLink( switch, host )
+ self.addLink( switch, agg1Switch )
+
+ for i in range(10):
+ switch = self.addSwitch( 's%d' % (i+31) )
+ host = self.addHost( 'h%d' % (i+31) )
+ self.addLink( switch, host )
+ self.addLink( switch, agg2Switch )
+
+topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index ac5d464..f2d1f69 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -155,9 +155,20 @@
'''
args = utilities.parse_args(["SRC","TARGET"],**pingParams)
#command = args["SRC"] + " ping -" + args["CONTROLLER"] + " " +args ["TARGET"]
- command = args["SRC"] + " ping "+args ["TARGET"]+" -c 1 -i 1"
+ command = args["SRC"] + " ping "+args ["TARGET"]+" -c 1 -i .2 -W 8"
try:
- response = self.execute(cmd=command,prompt="mininet",timeout=10 )
+ main.log.warn("Sending: " + command)
+ #response = self.execute(cmd=command,prompt="mininet",timeout=10 )
+ self.handle.sendline(command)
+ i = self.handle.expect([command,pexpect.TIMEOUT])
+ if i == 1:
+ main.log.error(self.name + ": timeout when waiting for response from mininet")
+ main.log.error("response: " + str(self.handle.before))
+ i = self.handle.expect(["mininet>",pexpect.TIMEOUT])
+ if i == 1:
+ main.log.error(self.name + ": timeout when waiting for response from mininet")
+ main.log.error("response: " + str(self.handle.before))
+ response = self.handle.before
except pexpect.EOF:
main.log.error(self.name + ": EOF exception found")
main.log.error(self.name + ": " + self.handle.before)
@@ -166,7 +177,7 @@
main.log.info(self.name+": Ping Response: "+ response )
#if utilities.assert_matches(expect=',\s0\%\spacket\sloss',actual=response,onpass="No Packet loss",onfail="Host is not reachable"):
if re.search(',\s0\%\spacket\sloss',response):
- main.log.info(self.name+": NO PACKET LOSS, HOST IS REACHABLE")
+ main.log.info(self.name+": no packets lost, host is reachable")
main.last_result = main.TRUE
return main.TRUE
else :
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 54cc5f6..87df2fe 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -582,8 +582,8 @@
main.exit()
-# http://localhost:8080/wm/onos/ng/switches/json
-# http://localhost:8080/wm/onos/ng/links/json
+# http://localhost:8080/wm/onos/topology/switches/json
+# http://localhost:8080/wm/onos/topology/links/json
# http://localhost:8080/wm/onos/registry/controllers/json
# http://localhost:8080/wm/onos/registry/switches/json"
@@ -623,7 +623,7 @@
try:
buf = ""
retcode = 0
- url="http://%s:%s/wm/onos/ng/switches/json" % (RestIP, RestPort)
+ url="http://%s:%s/wm/onos/topology/switches/json" % (RestIP, RestPort)
parsedResult = self.get_json(url)
if parsedResult == "":
retcode = 1
@@ -673,7 +673,7 @@
buf = ""
retcode = 0
- url = "http://%s:%s/wm/onos/ng/links/json" % (RestIP, RestPort)
+ url = "http://%s:%s/wm/onos/topology/links/json" % (RestIP, RestPort)
parsedResult = self.get_json(url)
if parsedResult == "":
@@ -978,7 +978,7 @@
retmac = []
foundIP = []
try:
- ##### device rest API is: 'host:8080/wm/onos/ng/switches/json' ###
+ ##### device rest API is: 'host:8080/wm/onos/topology/switches/json' ###
url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
try: