Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/748.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Parsing ADVA AOS device configs for compliance. FSP150F2 and FSP150F3 map to discrete Netmiko drivers and support different hardware generations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Parsing ADVA AOS device configs for compliance. FSP150F2 and FSP150F3 map to discrete Netmiko drivers and support different hardware generations.
Added parsing for FSP150F2 and FSP150F3 ADVA AOS device configs.

2 changes: 2 additions & 0 deletions docs/dev/include_parser_list.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
| OS Name | Parser Class |
| ---------- | ------ |
| adva_fsp150f2 | netutils.config.parser.ADVAFSP150F2ConfigParser |
| adva_fsp150f3 | netutils.config.parser.ADVAFSP150F3ConfigParser |
| arista_eos | netutils.config.parser.EOSConfigParser |
| aruba_aoscx | netutils.config.parser.ArubaConfigCXParser |
| aruba_os | netutils.config.parser.ArubaConfigOSParser |
Expand Down
2 changes: 2 additions & 0 deletions docs/user/lib_mapper/netutilsparser.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
| NETUTILSPARSER | | NORMALIZED |
| ---------- | -- | ------ |
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| arista_eos | → | arista_eos |
| aruba_aoscx | → | aruba_aoscx |
| aruba_os | → | aruba_os |
Expand Down
2 changes: 2 additions & 0 deletions docs/user/lib_mapper/netutilsparser_reverse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
| NORMALIZED | | NETUTILSPARSER |
| ---------- | -- | ------ |
| adva_fsp150f2 | → | adva_fsp150f2 |
| adva_fsp150f3 | → | adva_fsp150f3 |
| arista_eos | → | arista_eos |
| aruba_aoscx | → | aruba_aoscx |
| aruba_os | → | aruba_os |
Expand Down
2 changes: 2 additions & 0 deletions netutils/config/compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from . import parser # pylint: disable=relative-beyond-top-level

parser_map: t.Dict[str, t.Type[parser.BaseConfigParser]] = {
"adva_fsp150f2": parser.ADVAFSP150F2ConfigParser,
"adva_fsp150f3": parser.ADVAFSP150F3ConfigParser,
"arista_eos": parser.EOSConfigParser,
"aruba_aoscx": parser.ArubaConfigCXParser,
"aruba_os": parser.ArubaConfigOSParser,
Expand Down
45 changes: 45 additions & 0 deletions netutils/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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..."]
6 changes: 6 additions & 0 deletions netutils/lib_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@

# Netutils Parser | Normalized
NETUTILSPARSER_LIB_MAPPER: t.Dict[str, str] = {
"adva_fsp150f2": "adva_fsp150f2",
"adva_fsp150f3": "adva_fsp150f3",
"arista_eos": "arista_eos",
"aruba_aoscx": "aruba_aoscx",
"aruba_os": "aruba_os",
Expand Down Expand Up @@ -594,6 +596,8 @@

# Normalized | Netutils Parser
NETUTILSPARSER_LIB_MAPPER_REVERSE: t.Dict[str, str] = {
"adva_fsp150f2": "adva_fsp150f2",
"adva_fsp150f3": "adva_fsp150f3",
"arista_eos": "arista_eos",
"aruba_aoscx": "aruba_aoscx",
"aruba_os": "aruba_os",
Expand Down Expand Up @@ -656,6 +660,8 @@
# Deep copy the reverse, where there is no actual translation happening with special
# consideration for OS's not in netmiko.
_MAIN_LIB_MAPPER = copy.deepcopy(NETMIKO_LIB_MAPPER)
_MAIN_LIB_MAPPER["adva_fsp150f2"] = "adva_fsp150f2"
_MAIN_LIB_MAPPER["adva_fsp150f3"] = "adva_fsp150f3"
_MAIN_LIB_MAPPER["aruba_aoscx"] = "aruba_aoscx"
_MAIN_LIB_MAPPER["cisco_aireos"] = "cisco_aireos"
_MAIN_LIB_MAPPER["cisco_dnac"] = "cisco_dnac"
Expand Down
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 = [
{"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
}
}
Loading