diff --git a/config/__init__.py b/config/__init__.py index 360fc43..63115d5 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -76,6 +76,7 @@ class Validator: The purpose is to ensure that the YAML file is both syntactically correct, which is ensured by Yamale, and semantically correct, which is ensured by a set of built-in validators, and user-added validators (see the add_validator() method).""" + def __init__(self, schema): self.logger = logging.getLogger("vppcfg.config") self.logger.addHandler(logging.NullHandler()) diff --git a/tests.py b/tests.py index 8cbd007..31e3ccb 100755 --- a/tests.py +++ b/tests.py @@ -39,6 +39,7 @@ def example_validator(_yaml): class YAMLTest(unittest.TestCase): """This test suite takes a YAML configuration file and holds it against the syntax (Yamale) and semantic validators, returning errors in case of validation failures.""" + def __init__(self, testName, yaml_filename, yaml_schema): # calling the super class init varies for different python versions. This works for 2.7 super().__init__(testName) @@ -46,7 +47,7 @@ class YAMLTest(unittest.TestCase): self.yaml_schema = yaml_schema def test_yaml(self): - """ The test executor """ + """The test executor""" test = None cfg = None ncount = 0 diff --git a/vpp/applier.py b/vpp/applier.py index 2483f76..3683fd4 100644 --- a/vpp/applier.py +++ b/vpp/applier.py @@ -45,7 +45,9 @@ class Applier(VPPApi): """Delete a sub-int identified by name (ie GigabitEthernet3/0/0.100)""" pass - def set_interface_l2_tag_rewrite(self, ifname, vtr_op, vtr_push_dot1q, vtr_tag1, vtr_tag2): + def set_interface_l2_tag_rewrite( + self, ifname, vtr_op, vtr_push_dot1q, vtr_tag1, vtr_tag2 + ): """Set l2 tag rewrite on an interface identified by name (ie GigabitEthernet3/0/0.100) into a certain operational mode. TODO(pim) clarify the vtr_* arguments.""" ## somewhere in interface.api see vtr_* fields @@ -141,7 +143,7 @@ class Applier(VPPApi): pass def set_interface_l2_bridge(self, bd_id, ifname): - """Set an interface given by name (ie 'GigabitEthernet3/0/0') into a bridge + """Set an interface given by name (ie 'GigabitEthernet3/0/0') into a bridge domain identified by bd_id (ie 100)""" pass diff --git a/vpp/dumper.py b/vpp/dumper.py index 1bd3809..13ced60 100644 --- a/vpp/dumper.py +++ b/vpp/dumper.py @@ -30,11 +30,12 @@ class Dumper(VPPApi): Note that not all running VPP configs are "valid" in vppcfg's eyes. It is not guaranteed that the output of the Dumper() will stand validation.""" + def __init__(self, address="/run/vpp/api.sock", clientname="vppcfg"): VPPApi.__init__(self, address, clientname) def write(self, outfile): - """ Emit the configuration to either stdout (outfile=='-') or a filename """ + """Emit the configuration to either stdout (outfile=='-') or a filename""" if outfile and outfile == "-": file = sys.stdout outfile = "(stdout)" @@ -50,7 +51,7 @@ class Dumper(VPPApi): self.logger.info(f"Wrote YAML config to {outfile}") def cache_to_config(self): - """ Convert the VPP configuration cache (previously read by readconfig() into + """Convert the VPP configuration cache (previously read by readconfig() into a YAML representation.""" config = { "loopbacks": {}, diff --git a/vpp/vppapi.py b/vpp/vppapi.py index decc18d..40dbd32 100644 --- a/vpp/vppapi.py +++ b/vpp/vppapi.py @@ -27,6 +27,7 @@ from vpp_papi import VPPApiClient class VPPApi: """The VPPApi class is a base class that abstracts the vpp_papi.""" + def __init__(self, address="/run/vpp/api.sock", clientname="vppcfg"): self.logger = logging.getLogger("vppcfg.vppapi") self.logger.addHandler(logging.NullHandler()) @@ -40,7 +41,7 @@ class VPPApi: self.lcp_enabled = False def connect(self): - """ Connect to the VPP Dataplane, if we're not already connected """ + """Connect to the VPP Dataplane, if we're not already connected""" if self.connected: return True @@ -81,7 +82,7 @@ class VPPApi: return True def cache_clear(self): - """ Remove the cached VPP configuration elements and return an empty dictionary""" + """Remove the cached VPP configuration elements and return an empty dictionary""" self.cache_read = False return { "lcps": {}, diff --git a/vppcfg b/vppcfg index 479d411..7ce9fe6 100755 --- a/vppcfg +++ b/vppcfg @@ -30,7 +30,7 @@ except ImportError: def main(): - """ The main vppcfg program """ + """The main vppcfg program""" parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) parser.add_argument( "-d",