Added new functions for Pacjket optical and SDN-IP related intents
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 92ec312..17c25a0 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -298,10 +298,11 @@
'''
if self.handle:
try:
- cmd = host+" ifconfig "+intf+" "+newIP+" "+newNetMask
+ cmd = host+" ifconfig "+intf+" "+newIP+" "+'netmask'+" "+newNetmask
self.handle.sendline(cmd)
self.handle.expect("mininet>")
response = self.handle.before
+ main.log.info("response = "+response)
main.log.info("Ip of host "+host+" changed to new IP "+newIP)
return main.TRUE
except pexpect.EOF:
@@ -320,13 +321,52 @@
self.handle.sendline(cmd)
self.handle.expect("mininet>")
response = self.handle.before
+ main.log.info("response = "+response)
main.log.info("Default gateway of host "+host+" changed to "+newGW)
return main.TRUE
except pexpect.EOF:
main.log.error(self.name + ": EOF exception found")
main.log.error(self.name + ": " + self.handle.before)
return main.FALSE
-
+
+ def addStaticMACAddress(self,host,GW,macaddr):
+ '''
+ Changes the mac address of a geateway host
+ '''
+ if self.handle:
+ try:
+ #h1 arp -s 10.0.1.254 00:00:00:00:11:11
+ cmd = host+" arp -s "+GW+" "+macaddr
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info("response = "+response)
+ main.log.info("Mac adrress of gateway "+GW+" changed to "+macaddr)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+ def verifyStaticGWandMAC(self,host):
+ '''
+ Verify if the static gateway and mac address assignment
+ '''
+ if self.handle:
+ try:
+ #h1 arp -an
+ cmd = host+" arp -an "
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info(host+" arp -an = "+response)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+
def getMacAddress(self,host):
'''
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 2391d3a..a6cf341 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1043,6 +1043,146 @@
main.cleanup()
main.exit()
+
+ def add_multipoint_to_singlepoint_intent(self, ingress_device1, ingress_device2,egress_device,
+ port_ingress="", port_egress="", ethType="", ethSrc="",
+ ethDst="", bandwidth="", lambda_alloc=False,
+ ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", 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
+ Required:
+ * ingress_device1: device id of ingress device1
+ * ingress_device2: device id of ingress device2
+ * egress_device: device id of egress device
+ Optional:
+ * ethType: specify ethType
+ * ethSrc: specify ethSrc (i.e. src mac addr)
+ * ethDst: specify ethDst (i.e. dst mac addr)
+ * bandwidth: specify bandwidth capacity of link
+ * lambda_alloc: if True, intent will allocate lambda
+ for the specified intent
+ * ipProto: specify ip protocol
+ * ipSrc: specify ip source address
+ * ipDst: specify ip destination address
+ * tcpSrc: specify tcp source port
+ * tcpDst: specify tcp destination port
+ * setEthSrc: action to Rewrite Source MAC Address
+ * setEthDst: action to Rewrite Destination MAC Address
+ Description:
+ Adds a multipoint-to-singlepoint intent (uni-directional) by
+ specifying device id's and optional fields
+
+ NOTE: This function may change depending on the
+ options developers provide for multipointpoint-to-singlepoint
+ intent via cli
+ '''
+ try:
+ cmd = ""
+
+ #If there are no optional arguments
+ if not ethType and not ethSrc and not ethDst\
+ and not bandwidth and not lambda_alloc \
+ and not ipProto and not ipSrc and not ipDst \
+ and not tcpSrc and not tcpDst and not setEthSrc and not setEthDst:
+ cmd = "add-multi-to-single-intent"
+
+
+ else:
+ cmd = "add-multi-to-single-intent"
+
+ if ethType:
+ cmd += " --ethType " + str(ethType)
+ if ethSrc:
+ cmd += " --ethSrc " + str(ethSrc)
+ if ethDst:
+ cmd += " --ethDst " + str(ethDst)
+ if bandwidth:
+ cmd += " --bandwidth " + str(bandwidth)
+ if lambda_alloc:
+ cmd += " --lambda "
+ if ipProto:
+ cmd += " --ipProto " + str(ipProto)
+ if ipSrc:
+ cmd += " --ipSrc " + str(ipSrc)
+ if ipDst:
+ cmd += " --ipDst " + str(ipDst)
+ if tcpSrc:
+ cmd += " --tcpSrc " + str(tcpSrc)
+ if tcpDst:
+ cmd += " --tcpDst " + str(tcpDst)
+ if setEthSrc:
+ cmd += " --setEthSrc "+ str(setEthSrc)
+ if setEthDst:
+ cmd += " --setEthDst "+ str(setEthDst)
+
+ #Check whether the user appended the port
+ #or provided it as an input
+ if "/" in ingress_device1:
+ cmd += " "+str(ingress_device1)
+ else:
+ if not port_ingress1:
+ main.log.error("You must specify "+
+ "the ingress port1")
+ #TODO: perhaps more meaningful return
+ return main.FALSE
+
+ cmd += " "+ \
+ str(ingress_device1) + "/" +\
+ str(port_ingress1) + " "
+
+ if "/" in ingress_device2:
+ cmd += " "+str(ingress_device2)
+ else:
+ if not port_ingress2:
+ main.log.error("You must specify "+
+ "the ingress port2")
+ #TODO: perhaps more meaningful return
+ return main.FALSE
+
+ cmd += " "+ \
+ str(ingress_device2) + "/" +\
+ str(port_ingress2) + " "
+
+ if "/" in egress_device:
+ cmd += " "+str(egress_device)
+ else:
+ if not port_egress:
+ main.log.error("You must specify "+
+ "the egress port")
+ return main.FALSE
+
+ cmd += " "+\
+ str(egress_device) + "/" +\
+ str(port_egress)
+ print "cmd= ",cmd
+ self.handle.sendline(cmd)
+
+ main.log.info(cmd + " sent")
+ i = self.handle.expect([
+ "Error",
+ "onos>"])
+
+ if i == 0:
+ main.log.error("Error in adding point-to-point intent")
+ return self.handle
+ else:
+ return main.TRUE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+
def remove_intent(self, intent_id):
'''
Remove intent for specified intent id
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 71b397f..418554d 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1202,7 +1202,7 @@
cmd = "./onos-topo-cfg " +instance_name +" " +json_file
print "cmd = ", cmd
self.handle.sendline(cmd)
- self.handle.expect("$")
+ self.handle.expect("\$")
self.handle.sendline("cd ~")
self.handle.expect("\$")
return main.TRUE