From 3eb0b3637104537d1846d49ab1dbd07669fc5220 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Fri, 13 Oct 2023 19:11:34 +0200 Subject: [PATCH] Allow protocol 'icmp6' for icmp-types (At least) in the Juniper generator protocol 'icmpv6' is rewritten to 'icmp6' so when calling the Term.__str__() method the 2nd time, NormalizeIcmpTypes() fails for protocol 'icmp6'. Signed-off-by: Maximilian Wilhelm --- capirca/lib/aclgenerator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/capirca/lib/aclgenerator.py b/capirca/lib/aclgenerator.py index c387a7fa..188430f4 100644 --- a/capirca/lib/aclgenerator.py +++ b/capirca/lib/aclgenerator.py @@ -173,9 +173,10 @@ def NormalizeIcmpTypes(self, icmp_types, protocols, af): if not icmp_types: return [''] # only protocols icmp or icmpv6 can be used with icmp-types - if protocols != ['icmp'] and protocols != ['icmpv6']: - raise UnsupportedFilterError('%s %s' % ( - 'icmp-types specified for non-icmp protocols in term: ', + if protocols != ['icmp'] and protocols != ['icmp6'] and protocols != ['icmpv6']: + raise UnsupportedFilterError( + 'icmp-types specified for non-icmp protocols %s in term: %s' % ( + protocols, self.term.name)) # make sure we have a numeric address family (4 or 6) af = self.NormalizeAddressFamily(af)