Adds icmp type and code to Cisco object-group output#300
Open
abates wants to merge 1 commit intogoogle:masterfrom
Open
Adds icmp type and code to Cisco object-group output#300abates wants to merge 1 commit intogoogle:masterfrom
abates wants to merge 1 commit intogoogle:masterfrom
Conversation
icmp-type and icmp-code were not being rendered in the ACL when using the object-group feature of the Cisco renderer. This commit adds icmp type and code to the output.
abhindes
suggested changes
Mar 25, 2022
Contributor
abhindes
left a comment
There was a problem hiding this comment.
Thanks for sending this PR!
| if self.platform == 'cisconx': | ||
| if self.af == 6: | ||
| proto = 'icmp' if proto == 'icmpv6' else proto | ||
| for icmp_type in icmp_types: |
Contributor
There was a problem hiding this comment.
Rather than looping here, making an explicit decision that this is for "icmp" handling only would make this correct, and readable.
In the case of icmp/icmpv6, this would handle it with the way you have, with self._TermletToStr(_ACTION_TABLE.get(str(
self.term.action[0])), proto, saddr, sport, daddr, dport, icmp_type, icmp_code)
Else, it would handle it the way it originally was.
self._TermletToStr(_ACTION_TABLE.get(str(
self.term.action[0])), proto, saddr, sport, daddr, dport))
abhindes
reviewed
Mar 25, 2022
| mock.call('SOME_HOST')]) | ||
| self.naming.GetServiceByProto.assert_called_once_with('HTTP', 'tcp') | ||
|
|
||
| def testObjectGroupIcmp(self): |
Contributor
There was a problem hiding this comment.
Could you also please add a testcase for icmpv6 here, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
icmp-type and icmp-code were not being rendered in the
ACL when using the object-group feature of the Cisco
renderer. This commit adds icmp type and code to the
output.
Fixes #298