From a93a759b72ff8198819b5350480c6d604988475a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 14 Nov 2018 14:11:03 -0500 Subject: [PATCH] Make /networking/macs data available through nodediscover This will help combine the data together more easily. --- confluent_client/bin/nodediscover | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index fab06fcf..b6bd07f0 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -42,6 +42,8 @@ columnmapping = { 'Bay': 'bay', 'Mac Address': 'macs', 'Mac': 'macs', + 'Switch': 'switch', + 'Port': 'port', } @@ -50,6 +52,13 @@ def print_disco(options, session, currmac, outhandler, columns): for tmpinfo in session.read('/discovery/by-mac/{0}'.format(currmac)): procinfo.update(tmpinfo) + if 'Switch' in columns or 'Port' in columns: + for tmpinfo in session.read( + '/networking/macs/by-mac/{0}'.format(currmac)): + if 'ports' in tmpinfo: + # The api sorts so that the most specific available value + # is last + procinfo.update(tmpinfo['ports'][-1]) record = [] for col in columns: rawcol = columnmapping[col]