summaryrefslogtreecommitdiff
path: root/python/clidef.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/clidef.py')
-rw-r--r--python/clidef.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/python/clidef.py b/python/clidef.py
index 101c9a5ae3..244a8205bf 100644
--- a/python/clidef.py
+++ b/python/clidef.py
@@ -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.