[controller] ++ debug output

This commit is contained in:
Nico Schottelius 2019-02-23 18:25:53 +01:00
parent bd49e36544
commit 4e5f3c65a0

View file

@ -48,11 +48,15 @@ class L2Controller(object):
@staticmethod
def prefix_to_net(net, mask):
""" work around ipaddress bug """
return "{}0/{}".format(net, mask)
net = "{}0/{}".format(net, mask)
log.debug("net: {}".format(net))
return net
@staticmethod
def prefix_to_host(net, mask):
""" work around ipaddress bug """
host = "{}1/{}".format(net, mask)
log.debug("host: {}".format(host))
return "{}1/{}".format(net, mask)
@staticmethod
@ -151,6 +155,7 @@ class L2Controller(object):
def commandline(self):
parser = argparse.ArgumentParser(description='controller++')
parser.add_argument('--mode', help='Select mode / settings to use', choices=self.modes)
parser.add_argument('--debug', help='Enable debug logging', action='store_true')
args = parser.parse_args()
self.mode = args.mode
@ -171,5 +176,7 @@ if __name__ == "__main__":
controller = L2Controller(sw_name)
controller.commandline()
if controller.args.debug:
log.setLevel(logging.DEBUG)
controller.config()
controller.run_cpu_port_loop()