Commit 02eb56f1 authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

Profile: pattern_unpriveleged_prompt replaced with pattern_unprivileged_prompt

--HG--
branch : feature/orientcli
parent 62fc029d
......@@ -2,17 +2,17 @@
# ---------------------------------------------------------------------
# SA Profile Base
# ---------------------------------------------------------------------
# Copyright (C) 2007-2015 The NOC Project
# Copyright (C) 2007-2017 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import re
import functools
# NOC modules
from noc.core.ip import IPv4
from noc.sa.interfaces.base import InterfaceTypeError
from noc.core.ecma48 import strip_control_sequences
import functools
class BaseProfile(object):
......@@ -47,7 +47,7 @@ class BaseProfile(object):
pattern_prompt = r"^\S*[>#]"
# Regular expression to catch unpriveleged mode command prompt
# (CLI Session)
pattern_unpriveleged_prompt = None
pattern_unprivileged_prompt = None
# Regular expression to catch pager
# (Used in command results)
# If pattern_more is string, send command_more
......@@ -307,7 +307,6 @@ class BaseProfile(object):
return int(match.group("number"))
return None
def generate_prefix_list(self, name, pl):
"""
Generate prefix list:
......
......@@ -470,9 +470,9 @@ class CLI(object):
}, self.profile.cli_timeout_super)
else:
# Do not raise privileges
# Use unpriveleged prompt as primary prompt
self.patterns["prompt"] = self.patterns["unpriveleged_prompt"]
yield self.on_prompt(data, match)
# Use unpriviledged prompt as primary prompt
self.patterns["prompt"] = self.patterns["unpriviledged_prompt"]
return self.on_prompt(data, match)
@tornado.gen.coroutine
def on_failure(self, data, match, error_cls=None):
......@@ -568,9 +568,9 @@ class CLI(object):
"prompt": re.compile(self.profile.pattern_prompt,
re.DOTALL | re.MULTILINE)
}
if self.profile.pattern_unpriveleged_prompt:
if self.profile.pattern_unpriviledged_prompt:
patterns["unprivileged_prompt"] = re.compile(
self.profile.pattern_unpriveleged_prompt,
self.profile.pattern_unpriviledged_prompt,
re.DOTALL | re.MULTILINE
)
if self.profile.pattern_super_password:
......
......@@ -16,5 +16,5 @@ class Profile(BaseProfile):
pattern_prompt = r"^\S+?#"
command_more = " \n"
command_submit = "\r"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
command_super = "enable"
......@@ -14,7 +14,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "AlliedTelesis.AT8000S"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
pattern_prompt = r"^\S+?#"
pattern_more = [
(r"^More: <space>, Quit: q, One line: <return>", " "),
......
......@@ -14,7 +14,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Alstec.24xx"
pattern_username = r"^User:"
pattern_unpriveleged_prompt = r"^(?P<hostname>[ \S]+) >"
pattern_unprivileged_prompt = r"^(?P<hostname>[ \S]+) >"
pattern_prompt = r"^(?P<hostname>[ \S]+) #"
pattern_more = r"^--More-- or \(q\)uit$"
pattern_syntax_error = r"ERROR: Wrong or incomplete command"
......
......@@ -15,7 +15,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Alstec.7200"
pattern_username = r"^User:"
pattern_unpriveleged_prompt = r"^\S+ >"
pattern_unprivileged_prompt = r"^\S+ >"
pattern_prompt = r"^\S+ #"
pattern_more = r"^--More-- or \(q\)uit$"
pattern_syntax_error = r"^(% Invalid input detected at|Command not found)"
......
......@@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Alstec.ALS"
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_prompt = r"^(?P<hostname>\S+)\s*#"
pattern_syntax_error = \
r"% Unrecognized command|% Wrong number of parameters"
......
......@@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Angtel.Topaz"
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_prompt = r"^(?P<hostname>\S+)\s*#"
pattern_syntax_error = r"% Unrecognized command|% Wrong number of parameters"
command_super = "enable"
......
......@@ -16,7 +16,7 @@ from noc.sa.interfaces.base import InterfaceTypeError
class Profile(BaseProfile):
name = "Arista.EOS"
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)>"
pattern_prompt = r"^(?P<hostname>\S+)#"
pattern_syntax_error = r"% Invalid input"
pattern_more = [
......
......@@ -15,7 +15,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Aruba.ArubaOS"
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)\s*>"
pattern_prompt = r"^(?P<hostname>\S+)\s*#"
pattern_syntax_error = r"% Parse error"
command_super = "enable"
......
......@@ -17,7 +17,7 @@ class Profile(BaseProfile):
(r"^ --More-- ", " "),
(r"\(y/n\) \[n\]", "y\n")
]
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)>"
pattern_prompt = r"^(?P<hostname>\S+)#"
pattern_syntax_error = r"^Unknown command"
command_disable_pager = ["terminal length 0", "terminal width 0"]
......
......@@ -19,7 +19,7 @@ class Profile(BaseProfile):
(r"^ --More-- ", " "),
(r"\(y/n\) \[n\]", "y\n")
]
pattern_unpriveleged_prompt = r"^(?P<hostname>\S+)>"
pattern_unprivileged_prompt = r"^(?P<hostname>\S+)>"
pattern_prompt = r"^(?P<hostname>\S+)#"
pattern_syntax_error = r"% Unknown command"
command_more = " "
......
......@@ -14,7 +14,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = 'Brocade.ADX'
pattern_more = '--More--'
pattern_unpriveleged_prompt = \
pattern_unprivileged_prompt = \
r"^\S+@(?P<hostname>[a-zA-Z0-9]\S{0,19})(?:[-_\d\w]+)?" \
r"(?:\(conf[^\)]*\))?>"
pattern_prompt = \
......
......@@ -15,7 +15,7 @@ class Profile(BaseProfile):
name = 'Brocade.CER-ADV'
pattern_more = '--More--'
pattern_prompt = '\\S+?(\\(\\S+\\))?#'
pattern_unpriveleged_prompt = '^\\S+?>'
pattern_unprivileged_prompt = '^\\S+?>'
pattern_syntax_error = 'Invalid input ->|Ambiguous input ->|Incomplete command.'
pattern_username = 'Login'
username_submit = '\r'
......
......@@ -15,7 +15,7 @@ class Profile(BaseProfile):
name = 'Brocade.CER'
pattern_more = '--More--'
pattern_prompt = '\\S+?(\\(\\S+\\))?#'
pattern_unpriveleged_prompt = '^\\S+?>'
pattern_unprivileged_prompt = '^\\S+?>'
pattern_syntax_error = 'Invalid input ->|Ambiguous input ->|Incomplete command.'
pattern_username = 'Login'
username_submit = '\r'
......
......@@ -14,7 +14,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Brocade.IronWare"
pattern_prompt = r"\S+?(\(\S+\))?#"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
pattern_username = r"User"
command_disable_pager = "terminal length 1000"
command_enter_config = "configure terminal"
......
......@@ -19,6 +19,6 @@ class Profile(BaseProfile):
("--More--$", " ")
]
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
command_super = "enable"
convert_mac = BaseProfile.convert_mac_to_cisco
......@@ -15,7 +15,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Cisco.ASA"
pattern_more = "^<--- More --->"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
pattern_syntax_error = r"% Invalid input detected at|% Ambiguous command:|% Incomplete command."
command_super = "enable"
command_enter_config = "configure terminal"
......
......@@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Cisco.CatOS"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
command_super = "enable"
pattern_prompt = r"^\S+?\s+\(enable\)\s+"
convert_mac = BaseProfile.convert_mac_to_dashed
......
......@@ -14,7 +14,7 @@ from noc.core.profile.base import BaseProfile
class Profile(BaseProfile):
name = "Cisco.FWSM"
pattern_more = "^<--- More --->"
pattern_unpriveleged_prompt = r"^\S+?>"
pattern_unprivileged_prompt = r"^\S+?>"
command_super = "enable"
pattern_prompt = r"^\S+?#"
command_more = " "
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment