Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Python by NOC ( 10 years ago )
##----------------------------------------------------------------------
## Vendor: Eltex
## OS: LTE
##----------------------------------------------------------------------
## Copyright (C) 2007-2014 The NOC Project
## See LICENSE for details
##----------------------------------------------------------------------
## Python modules
## NOC modules
from noc.sa.profiles import Profile as NOCProfile
from noc.sa.script import script
class Profile(NOCProfile):
name = "Eltex.LTE"
supported_schemes = [NOCProfile.TELNET, NOCProfile.SSH]
pattern_username = r"^Login:"
pattern_password = r"^Password:"
pattern_more = [
(r"^More: <space>, Quit: q, One line: <return>$", " "),
(r"\[Yes/press any key for no\]", "Y")
]
pattern_unpriveleged_prompt = r"^\S+>"
pattern_syntax_error = r"^(Command not found. Use '?' to view available commands|Incomplete command\s+|Invalid argument\s+)"
# command_disable_pager = "terminal datadump"
command_super = "enable"
# command_enter_c
command_leave_c
command_enter_c
command_leave_c
command_save_c
pattern_prompt = r"^\S+#"
c
class switch(object):
"""Switch context manager to use with "with" statement"""
def __init__(self, script):
self.script = script
def __enter__(self):
"""Enter switch context"""
self.script.cli("switch")
def __exit__(self, exc_type, exc_val, exc_tb):
"""Leave switch context"""
if exc_type is None:
self.script.cli("exit")
Revise this Paste