Skip to content

Conversation

@jdrew82
Copy link
Contributor

@jdrew82 jdrew82 commented Jun 2, 2021

This is an initial attempt at a parser for ASAs to address #10.

@jdrew82 jdrew82 changed the title ASA Parser Add ASA Parser Jun 2, 2021
banner_start = []


class ASAConfigParser(CiscoConfigParser, BaseSpaceConfigParser):
Copy link
Contributor

Choose a reason for hiding this comment

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

CiscoConfigParser already inherits from BaseSpaceConfigParser, e.g. class CiscoConfigParser(BaseSpaceConfigParser):

This should suffice class ASAConfigParser(CiscoConfigParser):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is due to using IOSConfigParser as an example and it inherits from those two classes. I will correct it.

@itdependsnetworks
Copy link
Contributor

Can you add tests/mocked examples for all of the compliance functions? e.g. in folder https://github.com/networktocode/netutils/tree/develop/tests/unit/mock/config/compliance

@jdrew82
Copy link
Contributor Author

jdrew82 commented Jun 3, 2021

I'll work on getting those tests added today.

Copy link
Collaborator

@jeffkala jeffkala left a comment

Choose a reason for hiding this comment

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

Looks good to me.

... ]
True
"""
for line in self.generator_config:
Copy link
Contributor

Choose a reason for hiding this comment

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

@jmcgill298 Can you give this a quick review? I get lost a little bit what this is doing, but it seems like there is a logical reason to overwrite this method.

Please feel free to review entire PR as everything looks good to me and I am inclined to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was overwritten because the ASA does the banner differently. Instead of needing to parse it like it's a single line with a delimiter, you can just parse each line individually like normal since each line always starts with the banner keyword, ie:

banner motd <BANNER TEXT>
banner exec <BANNER TEXT>

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!! That makes sense.

@jdrew82 jdrew82 requested a review from itdependsnetworks June 8, 2021 15:46
@itdependsnetworks itdependsnetworks merged commit d6da791 into networktocode:develop Jun 9, 2021
@itdependsnetworks itdependsnetworks mentioned this pull request Jun 9, 2021
@jdrew82 jdrew82 deleted the asa-parser branch June 9, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants