Skip to content

Commit

Permalink
Merge pull request #147 from mwallraf/master
Browse files Browse the repository at this point in the history
Add a new driver for Ciena SAOS Devices
  • Loading branch information
knipknap committed Aug 1, 2017
2 parents 39e9e05 + 7c9a134 commit bac5e02
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions Exscript/protocols/drivers/__init__.py
Expand Up @@ -51,6 +51,7 @@
from Exscript.protocols.drivers.ericsson_ban import EricssonBanDriver
from Exscript.protocols.drivers.rios import RIOSDriver
from Exscript.protocols.drivers.eos import EOSDriver
from Exscript.protocols.drivers.cienasaos import CienaSAOSDriver

driver_classes = []
drivers = []
Expand Down
32 changes: 32 additions & 0 deletions Exscript/protocols/drivers/cienasaos.py
@@ -0,0 +1,32 @@
"""
A driver for Ciena SAOS carrier ethernet devices
"""
import re
from Exscript.protocols.drivers.driver import Driver

_user_re = [re.compile(r'[^:]* login: ?$', re.I)]
_password_re = [re.compile(r'Password: ?$')]
_prompt_re = [re.compile(r'[\r\n][\-\w+\.:/]+[>#] ?$')]
_error_re = [re.compile(r'SHELL PARSER FAILURE'),
re.compile(r'invalid input', re.I),
re.compile(r'(?:incomplete|ambiguous) command', re.I),
re.compile(r'connection timed out', re.I),
re.compile(r'[^\r\n]+ not found', re.I)]


class CienaSAOSDriver(Driver):

def __init__(self):
Driver.__init__(self, 'cienasaos')
self.user_re = _user_re
self.password_re = _password_re
self.prompt_re = _prompt_re
self.error_re = _error_re

def check_head_for_os(self, string):
if 'SAOS is True Carrier Ethernet TM software' in string:
return 90
return 0

def init_terminal(self, conn):
conn.execute('system shell session set more off')
12 changes: 12 additions & 0 deletions tests/Exscript/protocols/banners/cienasaos.1
@@ -0,0 +1,12 @@

(Banner goes here)
SAOS is True Carrier Ethernet TM software.

testhost login: testuser
Password:


SAOS is True Carrier Ethernet TM software.
Welcome to the shell.
testhost>

0 comments on commit bac5e02

Please sign in to comment.