adding TestON
diff --git a/TestON/drivers/common/cli/remotetestbed/__init__.py b/TestON/drivers/common/cli/remotetestbed/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/__init__.py
diff --git a/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py b/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py
new file mode 100644
index 0000000..8b25b2f
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+'''
+Created on 12-Feb-2013
+
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+
+FloodLightCliDriver is the basic driver which will handle the Mininet functions
+'''
+
+import pexpect
+import struct
+import fcntl
+import os
+import signal
+import re
+import sys
+import time
+
+sys.path.append("../")
+
+from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver
+
+class FloodLightCliDriver(RemoteTestBedDriver):
+ '''
+ FloodLightCliDriver is the basic driver which will handle the Mininet functions
+ '''
+ def __init__(self):
+ super(RemoteTestBedDriver, self).__init__()
+
+ def connect(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ self.name = self.options['name']
+
+ self.handle = super(FloodLightCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+ if self.handle :
+ main.log.info("Connected "+self.name)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ self.execute(cmd="cd /home/openflow/floodlight/",prompt="floodlight\$",timeout=3)
+ self.execute(cmd="java -jar target/floodlight.jar &",prompt="\$",timeout=3)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ return self.handle
+ else :
+ return main.FALSE
diff --git a/TestON/drivers/common/cli/remotetestbed/flowvisorclidriver.py b/TestON/drivers/common/cli/remotetestbed/flowvisorclidriver.py
new file mode 100644
index 0000000..936ce9d
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/flowvisorclidriver.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+'''
+Created on 12-Feb-2013
+
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+
+FlowVisorCliDriver is the basic driver which will handle the Mininet functions
+'''
+
+import pexpect
+import struct
+import fcntl
+import os
+import signal
+import re
+import sys
+import time
+
+sys.path.append("../")
+
+from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver
+
+class FlowVisorCliDriver(RemoteTestBedDriver):
+ '''
+ FlowVisorCliDriver is the basic driver which will handle the Mininet functions
+ '''
+ def __init__(self):
+ super(RemoteTestBedDriver, self).__init__()
+
+ def connect(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ self.name = self.options['name']
+
+ self.handle = super(FlowVisorCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+ if self.handle :
+ main.log.info(self.name+" connected successfully")
+ return self.handle
+ else :
+ main.log.error("Failed to connect "+self.name)
+ return main.FALSE
+
+ def removeFlowSpace(self,id):
+ if id == "all":
+ flow_space = self.listFlowSpace()
+ flow_ids = re.findall("\,id=\[(\d+)\]", flow_space)
+ for id in flow_ids :
+ self.removeFlowSpace(id)
+ else :
+ self.execute(cmd="clear",prompt="\$",timeout=10)
+ self.execute(cmd="fvctl removeFlowSpace "+id,prompt="passwd:",timeout=10)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ main.log.info("Removed flowSpace which is having id :"+id)
+
+ return main.TRUE
+
+ def addFlowSpace(self,flow_space):
+ self.execute(cmd="clear",prompt="\$",timeout=10)
+ self.execute(cmd="fvctl addFlowSpace "+flow_space,prompt="passwd:",timeout=10)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ sucess_match = re.search("success\:\s+(\d+)", main.last_response)
+ if sucess_match :
+ main.log.info("Added flow Space and id is "+sucess_match.group(1))
+ return main.TRUE
+ else :
+ return main.FALSE
+
+ def listFlowSpace(self):
+ self.execute(cmd="clear",prompt="\$",timeout=10)
+ self.execute(cmd="fvctl listFlowSpace ",prompt="passwd:",timeout=10)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ flow_space = main.last_response
+ flow_space = self.remove_contol_chars( flow_space)
+ flow_space = re.sub("rule\s(\d+)\:", "\nrule "+r'\1'+":",flow_space)
+ #main.log.info(flow_space)
+
+ return main.TRUE
+
+ def listDevices(self):
+ self.execute(cmd="clear",prompt="\$",timeout=10)
+ self.execute(cmd="fvctl listDevices ",prompt="passwd:",timeout=10)
+ self.execute(cmd="\r",prompt="\$",timeout=10)
+ devices_list = ''
+ last_response = re.findall("(Device\s\d+\:\s((\d|[a-z])(\d|[a-z])\:)+(\d|[a-z])(\d|[a-z]))", main.last_response)
+
+ for resp in last_response :
+ devices_match = re.search("(Device\s\d+\:\s((\d|[a-z])(\d|[a-z])\:)+(\d|[a-z])(\d|[a-z]))", str(resp))
+ if devices_match:
+ devices_list = devices_list+devices_match.group(0)+"\n"
+ main.log.info("List of Devices \n"+devices_list)
+ return main.TRUE
+
+
+
diff --git a/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py b/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py
new file mode 100644
index 0000000..24d9696
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py
@@ -0,0 +1,230 @@
+#!/usr/bin/env python
+'''
+Created on 24-June-2013
+
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+
+'''
+import time
+import pexpect
+import struct, fcntl, os, sys, signal
+import sys
+import re
+sys.path.append("../")
+from drivers.common.clidriver import CLI
+
+class HPSwitch(CLI):
+
+ def __init__(self):
+ super(CLI, self).__init__()
+
+ def connect(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ self.name = self.options['name']
+ self.handle = super(HPSwitch,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+
+ return main.TRUE
+
+ def configure(self):
+ self.execute(cmd='configure', prompt = '\(config\)',timeout = 3)
+ if re.search('\(config\)', main.last_response):
+ main.log.info("Configure mode enabled"+main.last_response)
+ else :
+ main.log.warn("Fail to enable configure mode"+main.last_response)
+
+
+ def set_up_vlan(self,**vlanargs):
+ '''
+ Configure vlan.
+ '''
+ for key in vlanargs:
+ vars(self)[key] = vlanargs[key]
+
+ self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("Configuring VLAN "+self.vlan_id)
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+
+ if self.vlan_name :
+ self.execute(cmd='name '+self.vlan_name, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("Configuring "+self.vlan_id)
+ return main.TRUE
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+ else :
+ main.log.error("Vlan Name not specified")
+ return main.FALSE
+
+ def vlan_tagged(self, **taggedargs):
+ for key in taggedargs:
+ vars(self)[key] = taggedargs[key]
+ if self.vlan_id :
+ self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("Configuring "+self.vlan_id)
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+ if self.tagged :
+ self.execute(cmd='tagged '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("VLAN tagged done "+self.tagged)
+ return main.TRUE
+ else :
+ main.log.warn("Fail to tagged Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+
+ def vlan_untagged(self, **untaggedargs):
+ for key in untaggedargs:
+ vars(self)[key] = untaggedargs[key]
+ if self.vlan_id :
+ self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("Configuring "+self.vlan_id)
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+ if self.tagged :
+ self.execute(cmd='untagged '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
+ main.log.info("VLAN untagged done "+self.tagged)
+ return main.TRUE
+ else :
+ main.log.warn("Fail to untagged Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+
+ def openflow_mode(self):
+ self.configure()
+ self.execute(cmd='openflow', prompt = '\(openflow\)',timeout = 3)
+ if re.search('\(openflow\)', main.last_response):
+ main.log.info("Openflow mode enabled"+main.last_response)
+ return main.TRUE
+ else :
+ main.log.warn("Fail to enable Openflow mode"+main.last_response)
+ return main.FALSE
+
+
+ def add_openflow_controller(self,**controllerargs):
+ for key in controllerargs:
+ vars(self)[key] = controllerargs[key]
+
+ if not self.openflow_mode():
+ return main.FALSE
+
+ contoller_details = 'controller-id '+ self.controller_id+'ip '+self.controller_ip + 'controller-interface vlan '+self.interface_vlan_id
+ self.execute(cmd=contoller_details, prompt = '\(openflow\)',timeout = 3)
+
+ if re.search('already\sconfigured', main.last_response):
+ main.log.warn("A controller is already configured with this ID."+main.last_response)
+ return main.FALSE
+ elif re.search('Incomplete\sinput',main.last_response ) :
+ main.log.warn("Incomplete\sinput"+main.last_response)
+ return main.FALSE
+ else:
+ main.log.info("Successfully added Openflow Controller")
+ return main.TRUE
+
+
+ def create_openflow_instance(self,**instanceargs):
+ for key in instanceargs:
+ vars(self)[key] = instanceargs[key]
+
+ if not self.openflow_mode():
+ return main.FALSE
+
+ if self.instance_name :
+ self.execute(cmd='instance '+self.instance_name, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
+
+ if re.search('\(of-inst-'+self.instance_name+'\)', main.last_response):
+ main.log.info("Configuring Openflow instance "+self.instance_name)
+ else :
+ main.log.warn("Fail to configure Openflow instance"+self.instance_name+"\n\n"+main.last_response)
+ return main.FALSE
+ if self.controller_id :
+ self.execute(cmd='controller-id '+self.controller_id, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
+ main.log.info(main.last_response)
+
+ if self.member :
+ self.execute(cmd='member vlan '+self.member_vlan_id, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
+ main.log.info(main.last_response)
+
+ if self.execute(cmd='enable', prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3):
+ return main.TRUE
+ else :
+ return main.FALSE
+
+ def pair_vlan_with_openflow_instance(self,vlan_id):
+ self.configure()
+ self.execute(cmd='vlan '+vlan_id, prompt = '\(vlan-'+vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+vlan_id+'\)', main.last_response):
+ main.log.info("Configuring VLAN "+vlan_id)
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+
+ self.execute(cmd='openflow enable', prompt = '\(vlan-'+vlan_id+'\)',timeout = 3)
+ if re.search('\(vlan-'+vlan_id+'\)', main.last_response):
+ main.log.info("Configuring VLAN "+vlan_id)
+ else :
+ main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
+ return main.FALSE
+
+ def show_openflow_instance(self,instance_name):
+
+ self.execute(cmd='show openflow instance '+instance_name, prompt = '#',timeout = 3)
+ return main.TRUE
+
+ def show(self, command):
+ self.execute(cmd=command, prompt = '#',timeout = 3)
+ return main.TRUE
+
+
+ def openflow_enable(self):
+ self.configure()
+ self.execute(cmd='openflow enable', prompt = '#',timeout = 3)
+ return main.TRUE
+
+ def openflow_disable(self):
+ self.configure()
+ self.execute(cmd='openflow enable', prompt = '#',timeout = 3)
+ return main.TRUE
+
+ def remove_controller(self,controller_id):
+ self.configure()
+ self.execute(cmd='no controller-id '+controller_id, prompt = '#',timeout = 3)
+ return main.TRUE
+
+ def remove_vlan(self,vlan_id):
+ self.configure()
+ if self.execute(cmd='no vlan '+vlan_id, prompt = '#',timeout = 3):
+ return main.TRUE
+ else :
+ self.execute(cmd=' '+vlan_id, prompt = '#',timeout = 3)
+ return main.TRUE
+
+ def remove_openflow_instance(self,instance_name):
+ self.configure()
+ self.execute(cmd='no openflow instance '+instance_name, prompt = '#',timeout = 3)
+ return main.TRUE
diff --git a/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py b/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py
new file mode 100644
index 0000000..f5e652a
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py
@@ -0,0 +1,545 @@
+class NEC:
+ def __init__( self ):
+ self.prompt = '(.*)'
+ self.timeout = 60
+
+ def show(self, *options, **def_args ):
+ '''Possible Options :[' access-filter ', ' accounting ', ' acknowledgments ', ' auto-config ', ' axrp ', ' cfm ', ' channel-group ', ' clock ', ' config-lock-status ', ' cpu ', ' dhcp ', ' dot1x ', ' dumpfile ', ' efmoam ', ' environment ', ' file ', ' flash ', ' gsrp ', ' history ', ' igmp-snooping ', ' interfaces ', ' ip ', ' ip-dual ', ' ipv6-dhcp ', ' license ', ' lldp ', ' logging ', ' loop-detection ', ' mac-address-table ', ' mc ', ' memory ', ' mld-snooping ', ' netconf ', ' netstat ', ' ntp ', ' oadp ', ' openflow ', ' port ', ' power ', ' processes ', ' qos ', ' qos-flow ', ' sessions ', ' sflow ', ' spanning-tree ', ' ssh ', ' system ', ' tcpdump ', ' tech-support ', ' track ', ' version ', ' vlan ', ' vrrpstatus ', ' whoami ']'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_ip(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show ip "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_mc(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show mc "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_cfm(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show cfm "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_ntp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show ntp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_ssh(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show ssh "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_qos(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show qos "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_cpu(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show cpu "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_vlan(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show vlan "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_lldp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show lldp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_dhcp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show dhcp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_axrp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show axrp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_oadp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show oadp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_gsrp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show gsrp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_port(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show port "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_file(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show file "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_power(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show power "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_clock(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show clock "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_dot1x(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show dot1x "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_sflow(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show sflow "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_track(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show track "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_flash(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show flash "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_system(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show system "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_whoami(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show whoami "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_efmoam(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show efmoam "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_memory(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show memory "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_tcpdump(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show tcpdump "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_history(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show history "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_logging(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show logging "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_license(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show license "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_netstat(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show netstat "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_version(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show version "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_netconf(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show netconf "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_ipdual(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show ip-dual "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_sessions(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show sessions "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_qosflow(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show qos-flow "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_openflow(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show openflow "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_dumpfile(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show dumpfile "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_ipv6dhcp(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show ipv6-dhcp "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_processes(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show processes "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_vrrpstatus(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show vrrpstatus "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_interfaces(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show interfaces "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_environment(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show environment "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_autoconfig(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show auto-config "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_techsupport(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show tech-support "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_mldsnooping(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show mld-snooping "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_igmpsnooping(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show igmp-snooping "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_channelgroup(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show channel-group "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_spanningtree(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show spanning-tree "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_loopdetection(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show loop-detection "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_acknowledgments(self, *options, **def_args ):
+ '''Possible Options :[' interface ']'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show acknowledgments "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_macaddresstable(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show mac-address-table "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_configlockstatus(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show config-lock-status "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
+ def show_acknowledgments_interface(self, *options, **def_args ):
+ '''Possible Options :[]'''
+ arguments= ''
+ for option in options:
+ arguments = arguments + option +' '
+ prompt = def_args.setdefault('prompt',self.prompt)
+ timeout = def_args.setdefault('timeout',self.timeout)
+ self.execute( cmd= "show acknowledgments interface "+ arguments, prompt = prompt, timeout = timeout )
+ return main.TRUE
+
diff --git a/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py b/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py
new file mode 100644
index 0000000..f0d2a16
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+'''
+Created on 12-Feb-2013
+
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+
+RemoteVMDriver is the basic driver which will handle the Mininet functions
+'''
+
+import pexpect
+import struct
+import fcntl
+import os
+import signal
+import re
+import sys
+import time
+
+sys.path.append("../")
+
+from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver
+
+class RemotePoxDriver(RemoteTestBedDriver):
+ '''
+ RemoteVMDriver is the basic driver which will handle the Mininet functions
+ '''
+ def __init__(self):
+ super(RemoteTestBedDriver, self).__init__()
+
+ def connect(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ self.name = self.options['name']
+
+ self.handle = super(RemotePoxDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+ if self.handle :
+ main.log.info(self.name+" connected successfully ")
+
+ self.execute(cmd="cd "+self.options['pox_lib_location'],prompt="/pox\$",timeout=120)
+ self.execute(cmd='./pox.py samples.of_tutorial',prompt="DEBUG:",timeout=120)
+ return self.handle
+ return main.TRUE
+
+ def disconnect(self,handle):
+ if self.handle:
+ self.execute(cmd="exit()",prompt="/pox\$",timeout=120)
+ else :
+ main.log.error("Connection failed to the host")
diff --git a/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py b/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py
new file mode 100644
index 0000000..4592e71
--- /dev/null
+++ b/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+'''
+Created on 12-Feb-2013
+
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+
+RemoteVMDriver is the basic driver which will handle the Mininet functions
+'''
+
+import pexpect
+import struct
+import fcntl
+import os
+import signal
+import re
+import sys
+import time
+
+sys.path.append("../")
+
+from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver
+
+class RemoteVMDriver(RemoteTestBedDriver):
+ '''
+ RemoteVMDriver is the basic driver which will handle the Mininet functions
+ '''
+ def __init__(self):
+ super(RemoteTestBedDriver, self).__init__()
+
+ def connect(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ self.name = self.options['name']
+
+ self.handle = super(RemoteVMDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+ if self.handle :
+ main.log.info(self.name+" connected successfully ")
+ return self.handle
+ return main.TRUE
+ def SSH(self,**connectargs):
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ '''
+ Connection will establish to the remote host using ssh.
+ It will take user_name ,ip_address and password as arguments<br>
+ and will return the handle.
+ '''
+ for key in connectargs:
+ vars(self)[key] = connectargs[key]
+
+ ssh_newkey = 'Are you sure you want to continue connecting'
+ refused = "ssh: connect to host "+self.ip_address+" port 22: Connection refused"
+ if self.port:
+ self.handle.sendline('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address)
+ else :
+ self.handle.sendline('ssh '+self.user_name+'@'+self.ip_address)
+ self.handle.sendline("\r")
+
+ i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused],120)
+
+ if i==0:
+ main.log.info("ssh key confirmation received, send yes")
+ self.handle.sendline('yes')
+ i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF])
+ if i==1:
+ main.log.info("ssh connection asked for password, gave password")
+ self.handle.sendline(self.pwd)
+ self.handle.expect('>|#|$')
+
+ elif i==2:
+ main.log.error("Connection timeout")
+ return main.FALSE
+ elif i==3: #timeout
+ main.log.error("No route to the Host "+self.user_name+"@"+self.ip_address)
+ return main.FALSE
+ elif i==4:
+ main.log.error("ssh: connect to host "+self.ip_address+" port 22: Connection refused")
+ return main.FALSE
+
+ self.handle.sendline("\r")
+ return main.TRUE