Signed-off-by: ISHIDA Wataru <[email protected]>
---
 .../bgp/operator/commands/show/neighbor.py         |   31 +++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/ryu/services/protocols/bgp/operator/commands/show/neighbor.py 
b/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
index 9f3f5ed..3b48f35 100644
--- a/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
+++ b/ryu/services/protocols/bgp/operator/commands/show/neighbor.py
@@ -125,13 +125,42 @@ class ReceivedRoutes(SentRoutes):
         return paths


+class Filter(Command):
+    help_msg = 'show neighbor filter information'
+    command = 'filter'
+    param_help_msg = '<ip_addr> <filter_family>{in, out, all}'
+
+    def action(self, params):
+        if len(params) != 2:
+            return WrongParamResp()
+
+        ip_addr, filter_family = params
+
+        if filter_family not in ['in', 'out', 'all']:
+            return WrongParamResp('wrong filter_family name')
+
+        core = self.api.get_core_service()
+        peer = core.peer_manager.get_by_addr(ip_addr)
+        if not peer:
+            return WrongParamResp('no peer found')
+
+        ret = {}
+        if filter_family != 'in':
+            ret['out'] = peer.out_filters
+        if filter_family != 'out':
+            ret['in'] = peer.in_filters
+
+        return CommandsResponse(STATUS_OK, ret)
+
+
 class Neighbor(Command):
     help_msg = 'show neighbor information'
     command = 'neighbor'
     subcommands = {
         'summary': NeighborSummary,
         'sent-routes': SentRoutes,
-        'received-routes': ReceivedRoutes
+        'received-routes': ReceivedRoutes,
+        'filter': Filter
     }

     fmtstr = ' {0:<12s} {1:<12s} {2:<}\n'
-- 
1.7.10.4




------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to