Add user guide for 'vppcfg dump' command

This commit is contained in:
Pim van Pelt
2022-04-03 13:01:31 +00:00
parent eee47c02b1
commit dfd8c8b8a9
3 changed files with 12 additions and 2 deletions

View File

@ -108,6 +108,14 @@ fully valid!
### vppcfg dump ### vppcfg dump
The purpose of the **dump** module is to connect to the VPP dataplane, and retrieve its
state, printing most information found in the INFO logs. Although it does contact VPP, it
will perform *readonly* operations and never manipulate state in the dataplane, so it
should be safe to run.
There are no flags to the dump command. It will return 0 if the connection to VPP was
established and its state successfully dumped to the logs, and non-zero otherwise.
### vppcfg plan ### vppcfg plan
### vppcfg apply ### vppcfg apply

View File

@ -270,7 +270,6 @@ class VPPApi():
class VPPApiDumper(VPPApi): class VPPApiDumper(VPPApi):
def __init__(self, address='/run/vpp/api.sock', clientname='vppcfg'): def __init__(self, address='/run/vpp/api.sock', clientname='vppcfg'):
VPPApi.__init__(self, address, clientname) VPPApi.__init__(self, address, clientname)
self.readconfig()
def dump(self): def dump(self):
self.dump_phys() self.dump_phys()
@ -328,7 +327,7 @@ class VPPApiDumper(VPPApi):
lcp = self.cache['lcps'][iface.sw_if_index] lcp = self.cache['lcps'][iface.sw_if_index]
tap_name = self.cache['interfaces'][lcp.host_sw_if_index].interface_name tap_name = self.cache['interfaces'][lcp.host_sw_if_index].interface_name
tap_idx = lcp.host_sw_if_index tap_idx = lcp.host_sw_if_index
self.logger.info(" TAP: %s (tap=%s idx=%d)" % (lcp.host_if_name, tap_name, tap_idx)) self.logger.info(" LCP: %s (tap=%s idx=%d netns=%s)" % (lcp.host_if_name, tap_name, tap_idx, lcp.namespace))
if len(self.cache['interface_addresses'][iface.sw_if_index])>0: if len(self.cache['interface_addresses'][iface.sw_if_index])>0:
self.logger.info(" L3: %s" % ' '.join(self.cache['interface_addresses'][iface.sw_if_index])) self.logger.info(" L3: %s" % ' '.join(self.cache['interface_addresses'][iface.sw_if_index]))

3
vppcfg
View File

@ -65,6 +65,9 @@ def main():
if args.command=="dump": if args.command=="dump":
d = VPPApiDumper() d = VPPApiDumper()
if not d.readconfig():
logging.error("Could not retrieve config from VPP")
sys.exit(-7)
d.dump() d.dump()
sys.exit(0) sys.exit(0)