Commit 43cede22 authored by Tomas Hlavacek's avatar Tomas Hlavacek

Added new BIRD BGP show commands.

Added show route protocol ... command.
Added show route export ... command.
Refactored show protocols all ... command.
parent 8457de8b
......@@ -213,14 +213,25 @@ class BirdShowProtocolsCommand(ulgmodel.TextCommand):
return ulgmodel.TableDecorator(table,table_header).decorate()
class BirdShowProtocolsAllCommand(ulgmodel.TextCommand):
COMMAND_TEXT = 'show protocols all %s'
class BirdBGPPeerSelectCommand(ulgmodel.TextCommand):
""" Abstract class for all BIRD BGP peer-specific commands """
def __init__(self,peers,name=None):
peer_param = ulgmodel.SelectionParameter([tuple((p,p,)) for p in peers],
name=defaults.STRING_PEERID)
ulgmodel.TextCommand.__init__(self,self.COMMAND_TEXT,param_specs=[peer_param],name=name)
class BirdShowProtocolsAllCommand(BirdBGPPeerSelectCommand):
COMMAND_TEXT = 'show protocols all %s'
class BirdShowRouteExportCommand(BirdBGPPeerSelectCommand):
COMMAND_TEXT = 'show route export %s'
class BirdShowRouteProtocolCommand(BirdBGPPeerSelectCommand):
COMMAND_TEXT = 'show route protocol %s'
class BirdRouterLocal(ulgmodel.LocalRouter):
RESCAN_BGP_COMMAND = 'show protocols'
......@@ -239,6 +250,8 @@ class BirdRouterLocal(ulgmodel.LocalRouter):
def _getDefaultCommands(self):
return [BirdShowProtocolsCommand(),
BirdShowProtocolsAllCommand(self.getBGPPeers()),
BirdShowRouteProtocolCommand(self.getBGPPeers()),
BirdShowRouteExportCommand(self.getBGPPeers()),
]
def runRawCommand(self,command):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment