diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-08-11 18:53:06 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-08-14 17:30:08 +0200 |
commit | 473196f613514b5bfb10ec8396b310911869e05b (patch) | |
tree | 9d8ed15a457959d70355551589c1e6a021e99dec /python | |
parent | lib: add CLI token for 48-bit mac addresses (diff) | |
download | frr-473196f613514b5bfb10ec8396b310911869e05b.tar.xz frr-473196f613514b5bfb10ec8396b310911869e05b.zip |
lib, python: add M:A:C support for clippy
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'python')
-rw-r--r-- | python/clidef.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/python/clidef.py b/python/clidef.py index 069d80fb7..8e3c7595b 100644 --- a/python/clidef.py +++ b/python/clidef.py @@ -59,7 +59,7 @@ class PrefixBase(RenderHandler): def combine(self, other): if type(self) == type(other): return other - if type(other) in [Prefix4Handler, Prefix6Handler, PrefixGenHandler]: + if isinstance(other, PrefixBase): return PrefixGenHandler(None) return StringHandler(None) deref = '&' @@ -71,6 +71,10 @@ class Prefix6Handler(PrefixBase): argtype = 'const struct prefix_ipv6 *' decl = Template('struct prefix_ipv6 $varname = { };') code = Template('_fail = !str2prefix_ipv6(argv[_i]->arg, &$varname);') +class PrefixEthHandler(PrefixBase): + argtype = 'struct prefix_eth *' + decl = Template('struct prefix_eth $varname = { };') + code = Template('_fail = !str2prefix_eth(argv[_i]->arg, &$varname);') class PrefixGenHandler(PrefixBase): argtype = 'const struct prefix *' decl = Template('struct prefix $varname = { };') @@ -121,6 +125,8 @@ handlers = { 'IPV4_PREFIX_TKN': Prefix4Handler, 'IPV6_TKN': IP6Handler, 'IPV6_PREFIX_TKN': Prefix6Handler, + 'MAC_TKN': PrefixEthHandler, + 'MAC_PREFIX_TKN': PrefixEthHandler, } # core template invoked for each occurence of DEFPY. |