1# 2# Copyright (C) 2014 Enno Groeper <groepeen@cms.hu-berlin.de> 3# The MIT License (MIT) 4# 5# Permission is hereby granted, free of charge, to any person obtaining 6# a copy of this software and associated documentation files 7# (the "Software"), to deal in the Software without restriction, 8# including without limitation the rights to use, copy, modify, merge, 9# publish, distribute, sublicense, and/or sell copies of the Software, 10# and to permit persons to whom the Software is furnished to do so, 11# subject to the following conditions: 12# 13# The above copyright notice and this permission notice shall be 14# included in all copies or substantial portions of the Software. 15# 16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23""" 24A driver for Enterasys/Extreme (HiPath) Wireless Controller devices. 25 26Created using a C5110 device. 27""" 28import re 29from Exscript.protocols.drivers.driver import Driver 30 31_user_re = [re.compile(r'[\r\n]Username: $')] 32_password_re = [re.compile(r'[\r\n]Password: $')] 33_prompt_re = [ 34 re.compile(r'[\r\n][a-zA-Z0-9-_ .]+# $'), # base prompt 35 re.compile(r'[\r\n][a-zA-Z0-9-_ .]+(?::[A-Za-z0-9_.-]+)*# $') 36] 37_hwc_re = re.compile(r'Enterasys Wireless Convergence OS', re.I) 38 39 40class EnterasysWCDriver(Driver): 41 42 def __init__(self): 43 Driver.__init__(self, 'enterasys_wc') 44 self.user_re = _user_re 45 self.password_re = _password_re 46 self.prompt_re = _prompt_re 47 48 def check_head_for_os(self, string): 49 if _hwc_re.search(string): 50 return 85 51 return 0 52 53 def init_terminal(self, conn): 54 pass 55