Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Add normalize_address normalize_prefix Jinja filters #64

Merged
merged 5 commits into from
Jun 18, 2017

Conversation

matejv
Copy link
Contributor

@matejv matejv commented Jun 12, 2017

It would be useful to be able to have all parsed IP addresses in the same textual format.

Especially important to be able to use diff functions with IPv6 since some platforms may not follow recommendations in Section 4 of RFC 5952 (looking at you Cisco).

@dbarrosop
Copy link
Member

Could you add unit tests for the jinja_filters? Something simple, like this:

https://github.com/napalm-automation/napalm-base/blob/develop/test/unit/TestHelpers.py#L268

Feel free to create the file test/unit/test_jinja_filters.py and put it there.

@matejv
Copy link
Contributor Author

matejv commented Jun 13, 2017

Something like this?

BTW: cidr_to_netmask filter returns the netmask as a netaddr.IPAddress object. Is this intentional or shall we convert to string before returning?

@matejv
Copy link
Contributor Author

matejv commented Jun 14, 2017

Added filter prefix_to_addrmask that will be used in translator for IOS

@dbarrosop
Copy link
Member

BTW: cidr_to_netmask filter returns the netmask as a netaddr.IPAddress object. Is this intentional or shall we convert to string before returning?

Yeah, we should convert to string for consistency with your additions. Would you mind fixing in this PR now that you are at it? :P

Thanks for adding tests to the already existing filters!

@matejv
Copy link
Contributor Author

matejv commented Jun 15, 2017

No problem, done! :)

@dbarrosop dbarrosop merged commit 771e1d3 into napalm-automation:develop Jun 18, 2017
@matejv matejv deleted the normalize-filter branch July 10, 2017 15:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants