summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-08-11 18:53:06 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-08-14 17:30:08 +0200
commit473196f613514b5bfb10ec8396b310911869e05b (patch)
tree9d8ed15a457959d70355551589c1e6a021e99dec
parentlib: add CLI token for 48-bit mac addresses (diff)
downloadfrr-473196f613514b5bfb10ec8396b310911869e05b.tar.xz
frr-473196f613514b5bfb10ec8396b310911869e05b.zip
lib, python: add M:A:C support for clippy
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--lib/command_py.c2
-rw-r--r--python/clidef.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/command_py.c b/lib/command_py.c
index 785d2ffa7..755cfb55c 100644
--- a/lib/command_py.c
+++ b/lib/command_py.c
@@ -199,6 +199,8 @@ static PyObject *graph_to_pyobj(struct wrap_graph *wgraph,
item(IPV4_PREFIX_TKN) // IPV4 network prefixes
item(IPV6_TKN) // IPV6 prefixes
item(IPV6_PREFIX_TKN) // IPV6 network prefixes
+ item(MAC_TKN) // MAC address
+ item(MAC_PREFIX_TKN) // MAC address with mask
/* plumbing types */
item(FORK_TKN) item(JOIN_TKN) item(START_TKN)
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.