Controller: print all agents info

Change-Id: I181da3b91a38aa64609fa7537d3f4d6d32b35f53
This commit is contained in:
changzhi1990 2016-03-08 14:41:07 +08:00
parent 283008d51f
commit 2bc7b90781
2 changed files with 29 additions and 0 deletions

View File

@ -265,3 +265,31 @@ class CheckVlanInterface(Lister):
return (('Destination', 'Packet Loss (%)'),
((k, v) for k, v in res['data'].items()))
return (['Error Mssage', ' '], [('message', res['message'])])
class PrintAgentsInfo(Lister):
"""Print all agents info."""
def get_parser(self, prog_name):
parser = super(PrintAgentsInfo, self).get_parser(prog_name)
return parser
def take_action(self, parsed_args):
try:
from steth.stethclient.constants import MGMT_AGENTS_INFOS
from steth.stethclient.constants import NET_AGENTS_INFOS
from steth.stethclient.constants import STORAGE_AGENTS_INFOS
except Exception as e:
Logger.log_fail("Import configure file fail. Because: %s!" % e)
sys.exit()
results = []
for agent in MGMT_AGENTS_INFOS.keys():
r = []
r.append(agent)
r.append(MGMT_AGENTS_INFOS[agent])
r.append(NET_AGENTS_INFOS[agent])
r.append(STORAGE_AGENTS_INFOS[agent])
results.append(r)
return (('Agent Name', 'Management IP', 'Network IP', 'Storage IP'),
results)

View File

@ -39,6 +39,7 @@ COMMAND_V1 = {
'check-vlan-interface': agent_api.CheckVlanInterface,
'check-iperf': iperf_api.CheckIperf,
'check-dhcp-on-comp': dhcp.CheckDHCPonComputeNodes,
'print-agents-info': agent_api.PrintAgentsInfo,
}
COMMANDS = {'0.1': COMMAND_V1}