SHOW:
|
|
- or go back to the newest paste.
| 1 | - | ./noc shell |
| 1 | + | ## Python modules |
| 2 | - | from noc.sa.models import * |
| 2 | + | import re |
| 3 | - | mo = ManagedObject.objects.filter() |
| 3 | + | ## NOC modules |
| 4 | - | for m in mo: |
| 4 | + | from noc.sa.profiles import Profile as NOCProfile |
| 5 | - | print m.profile_name |
| 5 | + | |
| 6 | - | Orion.Alpha |
| 6 | + | |
| 7 | - | Orion.Alpha |
| 7 | + | class Profile(NOCProfile): |
| 8 | - | ... |
| 8 | + | name = "Orion.Alpha" |
| 9 | supported_schemes = [NOCProfile.TELNET, NOCProfile.SSH] | |
| 10 | pattern_more = [ | |
| 11 | (r"^ --More--", "\n"), | |
| 12 | (r"\?\s*\[confirm\]", "\n"), | |
| 13 | (r"^.*\[Y/N\][:\ ]?", "Y\n") | |
| 14 | ] | |
| 15 | pattern_unpriveleged_prompt = r"^\S+?>" | |
| 16 | pattern_syntax_error = r"% Invalid input detected at|% Ambiguous command:|% Incomplete command." | |
| 17 | command_disable_pager = "terminal length 0" | |
| 18 | command_super = "enable" | |
| 19 | command_enter_config = "configure terminal" | |
| 20 | command_leave_config = "end" | |
| 21 | command_exit = "exit" | |
| 22 | command_save_config = "write" | |
| 23 | pattern_prompt = r"(^(?P<hostname>[a-zA-Z0-9]\S{0,19})(?:[-_\d\w]+)?(?:\(config[^\)]*\))?#)|(close telnet connection!)"
| |
| 24 | requires_netmask_conversion = True | |
| 25 | convert_mac = NOCProfile.convert_mac_to_dashed | |
| 26 | command_exit = "exit" | |
| 27 | #config_volatile = ["^ntp clock-period .*?^"] | |
| 28 | ||
| 29 | #def shutdown_session(self, script): | |
| 30 | # script.cli("exit") |