diff --git a/docs/user-guide.md b/docs/user-guide.md index 026fe7b..3ca6170 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -253,7 +253,7 @@ $ vppcfg plan -c example.yaml -o example.exec [INFO ] vppcfg.config.valid_config: Configuration validated successfully [INFO ] root.main: Configuration is valid [INFO ] vppcfg.vppapi.connect: VPP version is 22.06-rc0~320-g8f60318ac -[INFO ] vppcfg.reconciler.write: Wrote 78 lines to example.exec +[INFO ] vppcfg.planner.write: Wrote 78 lines to example.exec [INFO ] root.main: Planning succeeded $ vppctl exec ~/src/vppcfg/example.exec @@ -263,7 +263,7 @@ $ vppcfg plan -c example.yaml [INFO ] vppcfg.config.valid_config: Configuration validated successfully [INFO ] root.main: Configuration is valid [INFO ] vppcfg.vppapi.connect: VPP version is 22.06-rc0~320-g8f60318ac -[INFO ] vppcfg.reconciler.write: Wrote 0 lines to (stdout) +[INFO ] vppcfg.planner.write: Wrote 0 lines to (stdout) [INFO ] root.main: Planning succeeded ``` diff --git a/vppcfg/vpp/reconciler.py b/vppcfg/vpp/planner.py similarity index 99% rename from vppcfg/vpp/reconciler.py rename to vppcfg/vpp/planner.py index 55b60e7..23c9076 100644 --- a/vppcfg/vpp/reconciler.py +++ b/vppcfg/vpp/planner.py @@ -29,8 +29,8 @@ from vppcfg.config import tap from .vppapi import VPPApi -class Reconciler: - """The Reconciler class first reads the running configuration of a VPP Dataplane, +class Planner: + """The Planner class first reads the running configuration of a VPP Dataplane, and based on an intended target YAML configuration file, plans a path to make the dataplane safely reflect the target config. It first prunes (removes) objects that are not meant to be in the dataplane, or are in the dataplane but are not of the @@ -44,7 +44,7 @@ class Reconciler: vpp_api_socket="/run/vpp/api.sock", vpp_json_dir=None, ): - self.logger = logging.getLogger("vppcfg.reconciler") + self.logger = logging.getLogger("vppcfg.planner") self.logger.addHandler(logging.NullHandler()) self.vpp = VPPApi(vpp_api_socket, vpp_json_dir) @@ -88,7 +88,7 @@ class Reconciler: def prune(self): """Remove all objects from VPP that do not occur in the config. For an indepth explanation of how and why this particular pruning order is chosen, see README.md section on - Reconciling.""" + Planning.""" ret = True if not self.__prune_admin_state(): self.logger.warning("Could not set interfaces down in VPP") @@ -752,8 +752,8 @@ class Reconciler: def create(self): """Create all objects in VPP that occur in the config but not in VPP. For an indepth - explanation of how and why this particular pruning order is chosen, see README.md - section on Reconciling.""" + explanation of how and why this particular creation order is chosen, see README.md + section on Planning.""" ret = True if not self.__create_loopbacks(): self.logger.warning("Could not create Loopbacks in VPP") diff --git a/vppcfg/vppcfg.py b/vppcfg/vppcfg.py index 4afa73d..08883fb 100755 --- a/vppcfg/vppcfg.py +++ b/vppcfg/vppcfg.py @@ -29,7 +29,7 @@ except ModuleNotFoundError: sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from vppcfg.config import Validator from vppcfg._version import __version__ -from vppcfg.vpp.reconciler import Reconciler +from vppcfg.vpp.planner import Planner from vppcfg.vpp.dumper import Dumper try: @@ -246,44 +246,44 @@ def main(): if args.command == "check": sys.exit(0) - reconciler = Reconciler(cfg, **opt_kwargs) + planner = Planner(cfg, **opt_kwargs) if args.command == "plan" and args.novpp: - if not reconciler.vpp.mockconfig(cfg): + if not planner.vpp.mockconfig(cfg): sys.exit(-7) else: - if not reconciler.vpp.readconfig(): + if not planner.vpp.readconfig(): sys.exit(-3) - if not reconciler.phys_exist_in_vpp(): + if not planner.phys_exist_in_vpp(): logging.error("Not all PHYs in the config exist in VPP") sys.exit(-4) - if not reconciler.phys_exist_in_config(): + if not planner.phys_exist_in_config(): logging.error("Not all PHYs in VPP exist in the config") sys.exit(-5) - if not reconciler.lcps_exist_with_lcp_enabled(): + if not planner.lcps_exist_with_lcp_enabled(): logging.error( "Linux Control Plane is needed, but linux-cp API is not available" ) sys.exit(-6) failed = False - if not reconciler.prune(): + if not planner.prune(): if not args.force: logging.error("Planning prune failure") sys.exit(-10) failed = True logging.warning("Planning prune failure, continuing due to --force") - if not reconciler.create(): + if not planner.create(): if not args.force: logging.error("Planning create failure") sys.exit(-20) failed = True logging.warning("Planning create failure, continuing due to --force") - if not reconciler.sync(): + if not planner.sync(): if not args.force: logging.error("Planning sync failure") sys.exit(-30) @@ -291,7 +291,7 @@ def main(): logging.warning("Planning sync failure, continuing due to --force") if args.command == "plan": - reconciler.write(args.outfile, emit_ok=not failed) + planner.write(args.outfile, emit_ok=not failed) if failed: logging.error("Planning failed")