1 from ryu.services.protocols.bgp.operator.command import Command
2 from ryu.services.protocols.bgp.operator.command import CommandsResponse
3 from ryu.services.protocols.bgp.operator.command import STATUS_OK
4 from ryu.services.protocols.bgp.operator.command import STATUS_ERROR
5 from ryu.services.protocols.bgp.operator.commands.show import count
6 from ryu.services.protocols.bgp.operator.commands.show import importmap
7 from ryu.services.protocols.bgp.operator.commands.show import memory
8 from ryu.services.protocols.bgp.operator.commands.show import neighbor
9 from ryu.services.protocols.bgp.operator.commands.show import rib
10 from ryu.services.protocols.bgp.operator.commands.show import vrf
13 class ShowCmd(Command):
14 help_msg = 'shows runtime state information'
17 def __init__(self, *args, **kwargs):
18 super(ShowCmd, self).__init__(*args, **kwargs)
21 'logging': self.Logging,
24 'memory': self.Memory,
25 'neighbor': self.Neighbor,
26 'importmap': self.Importmap
29 def action(self, params):
30 return CommandsResponse(STATUS_ERROR, 'Command incomplete')
32 class Count(count.Count):
41 class Importmap(importmap.Importmap):
44 class Memory(memory.Memory):
47 class Neighbor(neighbor.Neighbor):
50 class Logging(Command):
52 help_msg = 'shows if logging is on/off and current logging level.'
54 def action(self, params):
55 if self.api.check_logging():
56 ret = {'logging': self.api.check_logging(),
57 'level': self.api.check_logging_level()}
59 ret = {'logging': self.api.check_logging(),
61 return CommandsResponse(STATUS_OK, ret)