-
Notifications
You must be signed in to change notification settings - Fork 66
ADVA OS ConfigParser Support #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
8732ede
1e08e1b
3e2a1da
277bccb
b2880a9
da53212
c58011c
40807ef
cb1f648
2bdf884
04e55d9
5fe91d3
e5042af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added parsing for FSP150F2 and FSP150F3 ADVA AOS device configs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1891,3 +1891,48 @@ def config_lines_only(self) -> str: | |
| ) | ||
| self._config = "\n".join(config_lines) | ||
| return self._config | ||
|
|
||
|
|
||
| class ADVAConfigParser(BaseSpaceConfigParser): | ||
| """Base ADVA OS ConfigParser class.""" | ||
|
|
||
| banner_start: t.List[str] = ["security-banner"] | ||
|
|
||
| @property | ||
| def banner_end(self) -> str: | ||
| """Demarcate End of Banner char.""" | ||
| return '"' | ||
|
|
||
| def _build_banner(self, config_line: str) -> t.Optional[str]: | ||
| """Build banner specific to ADVA AOS devices. | ||
|
|
||
| Args: | ||
| config_line: The start of the banner config. | ||
|
|
||
| Returns: | ||
| The next configuration line in the configuration text or None. | ||
|
|
||
| Raises: | ||
| ValueError when parser is unable to identify the banner end. | ||
| """ | ||
| if config_line.endswith(self.banner_end): | ||
| self._update_config_lines(config_line) | ||
| self._current_parents = self._current_parents[:-1] | ||
| try: | ||
| return next(self.generator_config) | ||
| except StopIteration: | ||
| return None | ||
|
|
||
| raise ValueError("Unable to parse banner end.") | ||
|
|
||
|
|
||
| class ADVAFSP150F2ConfigParser(ADVAConfigParser): | ||
| """ADVA OS FSP-150 F2 ConfigParser.""" | ||
|
|
||
| comment_chars: t.List[str] = ["remark", "exit"] | ||
|
|
||
|
|
||
| class ADVAFSP150F3ConfigParser(ADVAConfigParser): | ||
| """ADVA OS FSP-150 F3 ConfigParser.""" | ||
|
|
||
| comment_chars: t.List[str] = ["#", "home", "Preparing configuration file..."] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| remark #################################################################### | ||
| remark # | ||
| remark # Database Version: 13.0 | ||
| remark # | ||
| remark #################################################################### | ||
| remark # | ||
| remark # System | ||
| remark # | ||
| configure system | ||
| sysname "x-dngr-rm-01" | ||
| cli-prompt "X-DNGR-RM-01" | ||
| contact "XNOC 888-555-1963" | ||
| location "1407 Graymalkin LN, North Salem, NY 10560" | ||
| ip-address 192.168.0.63 255.255.255.0 | ||
| security-prompt enable | ||
| serial enable | ||
| telnet disable | ||
| web enable | ||
| snmp-dying-gasp enable | ||
| temperature-monitoring enable | ||
| bwp-mode information-rate | ||
| clock timezone utc | ||
| sntpclient mode unicast | ||
| sntpclient dhcp-supplied disable | ||
| sntpclient server 198.51.100.251 | ||
| syslogclient dhcp-supplied disable | ||
| syslogclient server 198.51.100.252 | ||
| security-banner "Any changes to this system require a change ticket or trouble ticket. Do you really want to proceed?\\n\\nBe sure to notify the XNOC of work being performed BEFORE changes are made.\\n\\nXNOC - 888-555-1963" | ||
| pae authentication-control enable | ||
| exit | ||
|
|
||
| configure system | ||
| jumbo-frame enable | ||
| exit | ||
|
|
||
| remark # | ||
| remark # Scheduled Ping | ||
| remark # | ||
| configure sched ping | ||
| frequency 1 | ||
| severity minor | ||
| threshold 1 | ||
| exit | ||
|
|
||
| remark # | ||
| remark # Interface: e100-lan-3 | ||
| remark # | ||
| configure interface e100-lan-3 | ||
| portmode Connection-oriented | ||
| remark # | ||
| remark # Temporarily assign the interface while configuring it. | ||
| remark # Final value will be assignstate disable. | ||
| remark # | ||
| assignstate enable | ||
| media copper | ||
| speed 100full | ||
| description "P2P-Circuit-2-PORT-DISABLED" | ||
| frame-loss-ratio 1.00 | ||
| evc-mode tls | ||
| circuit-name "NO-CIRCUIT-NAME-ASSIGNED" | ||
| ingress-buffersize 1274 | ||
| ingress-cbs 32 | ||
| ingress-ebs 0 | ||
| egress-limiting enable | ||
| ingress-eir 0 | ||
| ingress-cir 1024000 | ||
| egress-buffersize 1274 | ||
| egress-cbs 32 | ||
| egress-ebs 64 | ||
| egress-eir 0 | ||
| egress-cir 1024000 | ||
| flowcontrol receive disable | ||
| flowcontrol send disable | ||
| tagged-frame enable | ||
| untagged-frame enable | ||
| ctag push 103-0 disable | ||
| stag none | ||
| wan-if e1000-wan-1 | ||
| no propagate-fault | ||
| qq-ethertype 0x8100 | ||
| efm-oam localmode passive | ||
| cpd-filter efm-oam discard | ||
| adminstate enable | ||
| port-policing enable | ||
|
|
||
| elmi | ||
| async-status enable | ||
| min-async-status-interval 1 | ||
| n393 4 | ||
| t392 15 | ||
| exit | ||
|
|
||
| exit | ||
|
|
||
| configure interface e100-lan-3 | ||
| remark # | ||
| remark # Temporarily disable the interface while configuring it. | ||
| remark # Final value will be adminstate enable. | ||
| remark # | ||
| adminstate disable | ||
| exit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| features = [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you test the banner feature explicitly here? |
||
| {"name": "system", "ordered": False, "section": ["configure system"]}, | ||
| {"name": "ping", "ordered": False, "section": ["configure sched ping"]}, | ||
| {"name": "interface", "ordered": False, "section": ["configure interface"]}, | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| remark #################################################################### | ||
| remark # | ||
| remark # Database Version: 13.0 | ||
| remark # | ||
| remark #################################################################### | ||
| remark # | ||
| remark # System | ||
| remark # | ||
| configure system | ||
| sysname "x-dngr-rm-01" | ||
| cli-prompt "X-DNGR-RM-01" | ||
| contact "XNOC 888-555-1963" | ||
| location "1407 Graymalkin LN, North Salem, NY 10560" | ||
| ip-address 192.168.0.75 255.255.255.0 | ||
| security-prompt enable | ||
| serial enable | ||
| telnet disable | ||
| web enable | ||
| snmp-dying-gasp enable | ||
| temperature-monitoring enable | ||
| bwp-mode information-rate | ||
| clock timezone utc | ||
| sntpclient mode unicast | ||
| sntpclient dhcp-supplied disable | ||
| sntpclient server 198.51.100.251 | ||
| syslogclient dhcp-supplied disable | ||
| syslogclient server 198.51.100.252 | ||
| security-banner "Any changes to this system require a change ticket or trouble ticket. Do you really want to proceed?\\n\\nBe sure to notify the XNOC of work being performed BEFORE changes are made.\\n\\nXNOC - 888-555-1963" | ||
| pae authentication-control enable | ||
| exit | ||
|
|
||
| configure system | ||
| jumbo-frame enable | ||
| exit | ||
|
|
||
| remark # | ||
| remark # Scheduled Ping | ||
| remark # | ||
| configure sched ping | ||
| frequency 3 | ||
| severity minor | ||
| threshold 5 | ||
| exit | ||
|
|
||
| remark # | ||
| remark # Interface: e100-lan-3 | ||
| remark # | ||
| configure interface e100-lan-3 | ||
| portmode Connection-oriented | ||
| remark # | ||
| remark # Temporarily assign the interface while configuring it. | ||
| remark # Final value will be assignstate disable. | ||
| remark # | ||
| assignstate enable | ||
| media copper | ||
| speed 100full | ||
| description "P2P-Circuit-2-PORT-DISABLED" | ||
| frame-loss-ratio 1.00 | ||
| evc-mode tls | ||
| circuit-name "NO-CIRCUIT-NAME-ASSIGNED" | ||
| ingress-buffersize 1274 | ||
| ingress-cbs 32 | ||
| ingress-ebs 0 | ||
| egress-limiting enable | ||
| ingress-eir 0 | ||
| ingress-cir 1024000 | ||
| egress-buffersize 1274 | ||
| egress-cbs 32 | ||
| egress-ebs 64 | ||
| egress-eir 0 | ||
| egress-cir 1024000 | ||
| flowcontrol receive enable | ||
| flowcontrol send enable | ||
| tagged-frame enable | ||
| untagged-frame enable | ||
| ctag push 103-0 disable | ||
| stag none | ||
| wan-if e1000-wan-1 | ||
| no propagate-fault | ||
| qq-ethertype 0x8100 | ||
| efm-oam localmode passive | ||
| cpd-filter efm-oam discard | ||
| adminstate enable | ||
| port-policing enable | ||
|
|
||
| elmi | ||
| async-status enable | ||
| min-async-status-interval 1 | ||
| n393 4 | ||
| t392 15 | ||
| exit | ||
|
|
||
| exit | ||
|
|
||
| configure interface e100-lan-3 | ||
| remark # | ||
| remark # Temporarily disable the interface while configuring it. | ||
| remark # Final value will be adminstate enable. | ||
| remark # | ||
| adminstate disable | ||
| exit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "interface": { | ||
| "actual": "configure interface e100-lan-3\n portmode Connection-oriented\n assignstate enable\n media copper\n speed 100full\n description \"P2P-Circuit-2-PORT-DISABLED\"\n frame-loss-ratio 1.00\n evc-mode tls\n circuit-name \"NO-CIRCUIT-NAME-ASSIGNED\"\n ingress-buffersize 1274\n ingress-cbs 32\n ingress-ebs 0\n egress-limiting enable\n ingress-eir 0\n ingress-cir 1024000\n egress-buffersize 1274\n egress-cbs 32\n egress-ebs 64\n egress-eir 0\n egress-cir 1024000\n flowcontrol receive disable\n flowcontrol send disable\n tagged-frame enable\n untagged-frame enable\n ctag push 103-0 disable\n stag none\n wan-if e1000-wan-1\n no propagate-fault\n qq-ethertype 0x8100\n efm-oam localmode passive\n cpd-filter efm-oam discard\n adminstate enable\n port-policing enable\n elmi\n async-status enable\n min-async-status-interval 1\n n393 4\n t392 15\nconfigure interface e100-lan-3\n adminstate disable", | ||
| "cannot_parse": true, | ||
| "compliant": false, | ||
| "extra": "configure interface e100-lan-3\n flowcontrol receive disable\n flowcontrol send disable", | ||
| "intended": "configure interface e100-lan-3\n portmode Connection-oriented\n assignstate enable\n media copper\n speed 100full\n description \"P2P-Circuit-2-PORT-DISABLED\"\n frame-loss-ratio 1.00\n evc-mode tls\n circuit-name \"NO-CIRCUIT-NAME-ASSIGNED\"\n ingress-buffersize 1274\n ingress-cbs 32\n ingress-ebs 0\n egress-limiting enable\n ingress-eir 0\n ingress-cir 1024000\n egress-buffersize 1274\n egress-cbs 32\n egress-ebs 64\n egress-eir 0\n egress-cir 1024000\n flowcontrol receive enable\n flowcontrol send enable\n tagged-frame enable\n untagged-frame enable\n ctag push 103-0 disable\n stag none\n wan-if e1000-wan-1\n no propagate-fault\n qq-ethertype 0x8100\n efm-oam localmode passive\n cpd-filter efm-oam discard\n adminstate enable\n port-policing enable\n elmi\n async-status enable\n min-async-status-interval 1\n n393 4\n t392 15\nconfigure interface e100-lan-3\n adminstate disable", | ||
| "missing": "configure interface e100-lan-3\n flowcontrol receive enable\n flowcontrol send enable", | ||
| "ordered_compliant": false, | ||
| "unordered_compliant": false | ||
| }, | ||
| "ping": { | ||
| "actual": "configure sched ping\n frequency 1\n severity minor\n threshold 1", | ||
| "cannot_parse": true, | ||
| "compliant": false, | ||
| "extra": "configure sched ping\n frequency 1\n threshold 1", | ||
| "intended": "configure sched ping\n frequency 3\n severity minor\n threshold 5", | ||
| "missing": "configure sched ping\n frequency 3\n threshold 5", | ||
| "ordered_compliant": false, | ||
| "unordered_compliant": false | ||
| }, | ||
| "system": { | ||
| "actual": "configure system\n sysname \"x-dngr-rm-01\"\n cli-prompt \"X-DNGR-RM-01\"\n contact \"XNOC 888-555-1963\"\n location \"1407 Graymalkin LN, North Salem, NY 10560\"\n ip-address 192.168.0.63 255.255.255.0\n security-prompt enable\n serial enable\n telnet disable\n web enable\n snmp-dying-gasp enable\n temperature-monitoring enable\n bwp-mode information-rate\n clock timezone utc\n sntpclient mode unicast\n sntpclient dhcp-supplied disable\n sntpclient server 198.51.100.251\n syslogclient dhcp-supplied disable\n syslogclient server 198.51.100.252\n security-banner \"Any changes to this system require a change ticket or trouble ticket. Do you really want to proceed?\\\\n\\\\nBe sure to notify the XNOC of work being performed BEFORE changes are made.\\\\n\\\\nXNOC - 888-555-1963\"\nconfigure system\n jumbo-frame enable", | ||
| "cannot_parse": true, | ||
| "compliant": false, | ||
| "extra": "configure system\n ip-address 192.168.0.63 255.255.255.0", | ||
| "intended": "configure system\n sysname \"x-dngr-rm-01\"\n cli-prompt \"X-DNGR-RM-01\"\n contact \"XNOC 888-555-1963\"\n location \"1407 Graymalkin LN, North Salem, NY 10560\"\n ip-address 192.168.0.75 255.255.255.0\n security-prompt enable\n serial enable\n telnet disable\n web enable\n snmp-dying-gasp enable\n temperature-monitoring enable\n bwp-mode information-rate\n clock timezone utc\n sntpclient mode unicast\n sntpclient dhcp-supplied disable\n sntpclient server 198.51.100.251\n syslogclient dhcp-supplied disable\n syslogclient server 198.51.100.252\n security-banner \"Any changes to this system require a change ticket or trouble ticket. Do you really want to proceed?\\\\n\\\\nBe sure to notify the XNOC of work being performed BEFORE changes are made.\\\\n\\\\nXNOC - 888-555-1963\"\nconfigure system\n jumbo-frame enable", | ||
| "missing": "configure system\n ip-address 192.168.0.75 255.255.255.0", | ||
| "ordered_compliant": false, | ||
| "unordered_compliant": false | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.