Merge pull request #99 from opennetworkinglab/multiToSinglePointIntent
Modified multitosinglepoint intent driver function to accept any number ...
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index dd4f05e..419da23 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1164,11 +1164,9 @@
def addMultipointToSinglepointIntent(
self,
- ingressDevice1,
- ingressDevice2,
+ ingressDeviceList,
egressDevice,
- portIngress1="",
- portIngress2="",
+ portIngressList=None,
portEgress="",
ethType="",
ethSrc="",
@@ -1184,12 +1182,13 @@
setEthDst="" ):
"""
Note:
- This function assumes that there would be 2 ingress devices and
- one egress device. For more number of ingress devices, this
- function needs to be modified
+ This function assumes the format of all ingress devices
+ is same. That is, all ingress devices include port nos
+ with a "/" or all ingress devices could specify device
+ ids and port nos seperately.
Required:
- * ingressDevice1: device id of ingress device1
- * ingressDevice2: device id of ingress device2
+ * ingressDeviceList: List of device ids of ingress device
+ ( Atleast 2 ingress devices required in the list )
* egressDevice: device id of egress device
Optional:
* ethType: specify ethType
@@ -1247,6 +1246,7 @@
cmd += " --tcpSrc " + str( tcpSrc )
if tcpDst:
cmd += " --tcpDst " + str( tcpDst )
+ function needs to be modified
if setEthSrc:
cmd += " --setEthSrc " + str( setEthSrc )
if setEthDst:
@@ -1254,31 +1254,22 @@
# Check whether the user appended the port
# or provided it as an input
- if "/" in ingressDevice1:
- cmd += " " + str( ingressDevice1 )
+
+ if portIngressList is None:
+ for ingressDevice in ingressDeviceList:
+ if "/" in ingressDevice:
+ cmd += " " + str( ingressDevice )
+ else:
+ main.log.error( "You must specify " +
+ "the ingress port" )
+ # TODO: perhaps more meaningful return
+ return main.FALSE
else:
- if not portIngress1:
- main.log.error( "You must specify " +
- "the ingress port1" )
- # TODO: perhaps more meaningful return
- return None
-
- cmd += " " + \
- str( ingressDevice1 ) + "/" +\
- str( portIngress1 ) + " "
-
- if "/" in ingressDevice2:
- cmd += " " + str( ingressDevice2 )
- else:
- if not portIngress2:
- main.log.error( "You must specify " +
- "the ingress port2" )
- # TODO: perhaps more meaningful return
- return None
-
- cmd += " " + \
- str( ingressDevice2 ) + "/" +\
- str( portIngress2 ) + " "
+ if len( ingressDeviceList ) == len( portIngressList )
+ for ingressDevice,portIngress in zip( ingressDeviceList,portIngressList ):
+ cmd += " " + \
+ str( ingressDevice ) + "/" +\
+ str( portIngress ) + " "
if "/" in egressDevice:
cmd += " " + str( egressDevice )
@@ -1291,6 +1282,7 @@
cmd += " " +\
str( egressDevice ) + "/" +\
str( portEgress )
+
print "cmd= ", cmd
handle = self.sendline( cmd )
# If error, return error message
@@ -1301,15 +1293,14 @@
else:
# TODO: print out all the options in this message?
main.log.info( "Multipoint-to-singlepoint intent installed" +
- " between " + str( ingressDevice1 ) + ", " +
- str( ingressDevice2 ) + " and " +
- str( egressDevice ) )
- match = re.search('id=0x([\da-f]+),', handle)
- if match:
- return match.group()[3:-1]
- else:
- main.log.error( "Error, intent ID not found" )
- return None
+ " failed " )
+ return None
+ #match = re.search('id=0x([\da-f]+),', handle)
+ #if match:
+ #return match.group()[3:-1]
+ #else:
+ #main.log.error( "Error, intent ID not found" )
+ #return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
return None