Added point intent wrapper function
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 3c6f559..f6996bb 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -106,16 +106,73 @@
stepResult = main.TRUE
global itemName
itemName = item[ 'name' ]
- ingress = item[ 'ingress' ]
- egress = item[ 'egress' ]
+ h1Name = item[ 'host1' ][ 'name' ]
+ h2Name = item[ 'host2' ][ 'name' ]
+ ingressDevice = item[ 'ingressDevice' ]
+ egressDevice = item[ 'egressDevice' ]
option = item[ 'option' ]
sw1 = item[ 'link' ][ 'switch1' ]
sw2 = item[ 'link' ][ 'switch2' ]
expectLink = item[ 'link' ][ 'expect' ]
intentsId = []
+
+ # Assign options to variables
+ ingressPort = item.get( 'ingressPort' )
+ egressPort = item.get( 'egressPort' )
+ ethType = option.get( 'ethType' )
+ ethSrc = option.get( 'ethSrc' )
+ ethDst = option.get( 'ethDst' )
+ bandwidth = option.get( 'bandwidth' )
+ lambdaAlloc = option.get( 'lambdaAlloc' )
+ ipProto = option.get( 'ipProto' )
+ ipSrc = option.get( 'ipSrc' )
+ ipDst = option.get( 'ipDst' )
+ tcpSrc = option.get( 'tcpSrc' )
+ tcpDst = option.get( 'tcpDst' )
- print 'OPTIONS ', option
- return main.TRUE
+ if ingressPort == None:
+ ingressPort = ""
+ if egressPort == None:
+ egressPort = ""
+ if ethType == None:
+ ethType = ""
+ if ethSrc == None:
+ ethSrc = ""
+ if ethDst == None:
+ ethDst = ""
+ if bandwidth == None:
+ bandwidth = ""
+ if lambdaAlloc == None:
+ lambdaAlloc = False
+ if ipProto == None:
+ ipProto = ""
+ if ipSrc == None:
+ ipSrc = ""
+ if ipDst == None:
+ ipDst = ""
+ if tcpSrc == None:
+ tcpSrc = ""
+ if tcpDst == None:
+ tcpDst = ""
+
+ """
+ print 'ethType: ', ethType
+ print 'ethSrc: ', ethSrc
+ print 'ethDst: ', ethDst
+ print 'bandwidth', bandwidth
+ print 'lambdaAlloc: ', lambdaAlloc
+ print 'ipProto: ', ipProto
+ print 'ipSrc: ', ipSrc
+ print 'ipDst:', ipDst
+ print 'tcpSrc: ', tcpSrc
+ print 'tcpDst: ', tcpDst
+ """
+ addedOption = ""
+ for i in range( len( option ) ):
+ addedOption = addedOption + option.keys()[ i ] + " = " + \
+ option.values()[ i ] + "\n"
+ main.log.info( itemName + ": Printing added options...\n" + addedOption )
+
pingResult = main.TRUE
intentResult = main.TRUE
flowResult = main.TRUE
@@ -123,21 +180,39 @@
linkDownResult = main.TRUE
linkUpResult = main.TRUE
- # Discover hosts using arping
- main.log.info( itemName + ": Discover host using arping" )
- main.Mininet1.arping( host=h1Name )
- main.Mininet1.arping( host=h2Name )
- host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
- host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
-
- # Adding host intents
+ # Adding bidirectional point intents
main.log.info( itemName + ": Adding host intents" )
- intent1 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h1Id,
- hostIdTwo=h2Id )
+ intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=ingressDevice,
+ egressDevice=egressDevice,
+ portIngress=ingressPort,
+ portEgress=egressPort,
+ ethType=ethType,
+ ethSrc=ethSrc,
+ ethDst=ethDst,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ipSrc,
+ ipDst=ipDst,
+ tcpSrc=tcpSrc,
+ tcpDst=tcpDst )
+
intentsId.append( intent1 )
time.sleep( 5 )
- intent2 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h2Id,
- hostIdTwo=h1Id )
+ intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=egressDevice,
+ egressDevice=ingressDevice,
+ portIngress=egressPort,
+ portEgress=ingressPort,
+ ethType=ethType,
+ ethSrc=ethDst,
+ ethDst=ethSrc,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ipDst,
+ ipDst=ipSrc,
+ tcpSrc=tcpDst,
+ tcpDst=tcpSrc )
intentsId.append( intent2 )
# Check intents state
diff --git a/TestON/tests/FuncIntent/FuncIntent.params b/TestON/tests/FuncIntent/FuncIntent.params
index 8a1ce1d..14bda6d 100755
--- a/TestON/tests/FuncIntent/FuncIntent.params
+++ b/TestON/tests/FuncIntent/FuncIntent.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>10,11,12,1002</testcases>
+ <testcases>10,11,12,1001,1002</testcases>
<SCALE>1,3</SCALE>
<availableNodes>3</availableNodes>
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index c92f552..2ffb25f 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -346,7 +346,10 @@
import re
"""
Create your item(s) here
- item = { 'name':'', 'ingress':'' , 'egress':'',
+ item = { 'name':'', 'host1': { 'name': '' },
+ 'host2': { 'name': '' },
+ 'ingressDevice':'' , 'egressDevice':'',
+ 'ingressPort':'', 'egressPort':'',
'option':{ 'ethType':'', 'ethSrc':'', 'ethDst':'' } ,
'link': { 'switch1': '', 'switch2':'', 'expect':'' } }
@@ -360,20 +363,41 @@
assert main.numSwitch, "Placed the total number of switch topology in \
main.numSwitch"
-
- ipv4 = { 'name':'IPV4', 'ingress':'0000000000000005/1' ,
- 'egress':'0000000000000006/1', 'option':
+ ipv4 = { 'name':'IPV4', 'ingressDevice':'of:0000000000000005/1' ,
+ 'host1': { 'name': 'h1' }, 'host2': { 'name': 'h9' },
+ 'egressDevice':'of:0000000000000006/1', 'option':
{ 'ethType':'IPV4', 'ethSrc':'00:00:00:00:00:01',
'ethDst':'00:00:00:00:00:09' }, 'link': { 'switch1':'s5',
'switch2':'s2', 'expect':'18' } }
- dualStack1 = { 'name':'DUALSTACK1', 'ingress':'0000000000000005/3' ,
- 'egress':'0000000000000006/3', 'option':
- { 'ethType':'IPV4', 'ethSrc':'00:00:00:00:00:03',
- 'ethDst':'00:00:00:00:00:0B' }, 'link': { 'switch1':'s5',
- 'switch2':'s2', 'expect':'18' } }
+ """
+ ipv4 = { 'name':'IPV4', 'ingressDevice':'of:0000000000000005/1' ,
+ 'host1': { 'name': 'h1' }, 'host2': { 'name': 'h9' },
+ 'egressDevice':'of:0000000000000006/1', 'option':
+ { 'ethType':'IPV4', 'ethSrc':'00:00:00:00:00:01' },
+ 'link': { 'switch1':'s5', 'switch2':'s2', 'expect':'18' } }
+ """
+ dualStack1 = { 'name':'IPV4', 'ingressDevice':'0000000000000005/3' ,
+ 'host1': { 'name': 'h3' }, 'host2': { 'name': 'h11' },
+ 'egressDevice':'0000000000000006/3', 'option':
+ { 'ethType':'IPV4', 'ethSrc':'00:00:00:00:00:03',
+ 'ethDst':'00:00:00:00:00:0B' }, 'link': { 'switch1':'s5',
+ 'switch2':'s2', 'expect':'18' } }
- main.wrapper.addPointIntent( main, ipv4 )
+
+ main.case( "Add point intents between 2 devices" )
+
+ stepResult = main.TRUE
+ main.step( ipv4[ 'name' ] + ": Add point intents between " +
+ ipv4[ 'host1' ][ 'name' ] + " and " +
+ ipv4[ 'host2' ][ 'name' ] )
+ stepResult = main.wrapper.addPointIntent( main, ipv4 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass=ipv4[ 'name' ] +
+ ": Point intent successful",
+ onfail=ipv4[ 'name' ] +
+ ": Point intent failed" )
def CASE1003( self, main ):
"""