From dfd8c8b8a95b4b90158e95275c8647aadb867bcf Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 3 Apr 2022 13:01:31 +0000 Subject: [PATCH] Add user guide for 'vppcfg dump' command --- docs/user-guide.md | 8 ++++++++ vpp/vppapi.py | 3 +-- vppcfg | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/user-guide.md b/docs/user-guide.md index e95ed38..17a1d8d 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -108,6 +108,14 @@ fully valid! ### 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 apply diff --git a/vpp/vppapi.py b/vpp/vppapi.py index 4c9e5f9..729c329 100644 --- a/vpp/vppapi.py +++ b/vpp/vppapi.py @@ -270,7 +270,6 @@ class VPPApi(): class VPPApiDumper(VPPApi): def __init__(self, address='/run/vpp/api.sock', clientname='vppcfg'): VPPApi.__init__(self, address, clientname) - self.readconfig() def dump(self): self.dump_phys() @@ -328,7 +327,7 @@ class VPPApiDumper(VPPApi): lcp = self.cache['lcps'][iface.sw_if_index] tap_name = self.cache['interfaces'][lcp.host_sw_if_index].interface_name 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: self.logger.info(" L3: %s" % ' '.join(self.cache['interface_addresses'][iface.sw_if_index])) diff --git a/vppcfg b/vppcfg index 8228413..5e2226e 100755 --- a/vppcfg +++ b/vppcfg @@ -65,6 +65,9 @@ def main(): if args.command=="dump": d = VPPApiDumper() + if not d.readconfig(): + logging.error("Could not retrieve config from VPP") + sys.exit(-7) d.dump() sys.exit(0)