]> git.proxmox.com Git - mirror_frr.git/blobdiff - python/clidef.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / python / clidef.py
index 101c9a5ae376d0aea64c3ad196f7e19ff1de417e..244a8205bf2d407123b2c292b8421118f126ff8b 100644 (file)
@@ -1,20 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
 # FRR CLI preprocessor (DEFPY)
 #
 # Copyright (C) 2017  David Lamparter for NetDEF, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; see the file COPYING; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 import clippy, traceback, sys, os
 from collections import OrderedDict
@@ -64,6 +51,12 @@ _fail = (_end == argv[_i]->arg) || (*_end != '\\0');"""
     )
 
 
+class AsDotHandler(RenderHandler):
+    argtype = "as_t"
+    decl = Template("as_t $varname = 0;")
+    code = Template("_fail = !asn_str2asn(argv[_i]->arg, &$varname);")
+
+
 # A.B.C.D/M (prefix_ipv4) and
 # X:X::X:X/M (prefix_ipv6) are "compatible" and can merge into a
 # struct prefix:
@@ -165,6 +158,7 @@ handlers = {
     "IPV6_PREFIX_TKN": Prefix6Handler,
     "MAC_TKN": PrefixEthHandler,
     "MAC_PREFIX_TKN": PrefixEthHandler,
+    "ASNUM_TKN": AsDotHandler,
 }
 
 # core template invoked for each occurence of DEFPY.