Updates to scripts after refactor

- Run black to reformat all the scripts
- Update makefile test targets, pylint, and fix some of the issues found
- Update pxeconfig script for refactored nbhelper
- Add start of inventory script

Change-Id: I5f426ac2da840dc72f07f8a6844e199e47d49135
diff --git a/scripts/nbhelper/container.py b/scripts/nbhelper/container.py
index 397ee32..0e728a1 100644
--- a/scripts/nbhelper/container.py
+++ b/scripts/nbhelper/container.py
@@ -1,4 +1,5 @@
 import netaddr
+from .utils import logger
 
 
 class Singleton(type):
@@ -10,7 +11,7 @@
         return cls._instances[cls]
 
 
-class Container(object):
+class Container:
     def __init__(self):
         self.instances = dict()
 
@@ -36,16 +37,19 @@
         for instance in self.instances.values():
             if "dns" in list(map(str, instance.services)):
                 return instance
+        return None
 
     def getDHCPServer(self):
         for instance in self.instances.values():
             if "tftp" in list(map(str, instance.services)):
                 return instance
+        return None
 
     def getNTPServer(self):
         for instance in self.instances.values():
             if "ntp" in list(map(str, instance.services)):
                 return instance
+        return None
 
     def getRouters(self):
         """ Get a list of Devices/VMs which type is Router """
@@ -72,6 +76,7 @@
                         prefix.subnet
                     ):
                         return str(netaddr.IPNetwork(address).ip)
+        return None
 
 
 class DeviceContainer(AssignedObjectContainer, metaclass=Singleton):
@@ -87,9 +92,6 @@
 class PrefixContainer(Container, metaclass=Singleton):
     # PrefixContainer holds all prefixes fetch from Netbox, prefix(str) as key
 
-    def get(self, instance_id, name_segments=1):
-        return super().get(instance_id)
-
     def all(self):
         return self.instances.values()
 
@@ -221,7 +223,8 @@
                             #         "eno1": {
                             #             "mgmtOnly": False,
                             #             "macaddr": "ca:fe:ba:be:11:11",
-                            #             "ipaddr": [IPAddress("10.32.4.129"), IPAddress("10.32.4.130")]
+                            #             "ipaddr": [IPAddress("10.32.4.129"),
+                            #                        IPAddress("10.32.4.130")]
                             #         }
                             #    }
                             #  "mgmtswitch1": ...
@@ -242,14 +245,24 @@
                             ]
                             interfaceDict.setdefault("mgmtOnly", False)
 
-                            # Use interface["mac_address"] as the default value, but if the mac_address
-                            #  is None, that means we are dealing with a virtual interfaces
-                            #  so we can get the linked interface's mac_address instead
+                            # Use interface["mac_address"] as the default value, but if the
+                            # mac_address is None, that means we are dealing with a virtual
+                            # interfaces so we can get the linked interface's mac_address instead
 
-                            interfaceDict.setdefault(
-                                "mac_address", interface["mac_address"] or
-                                device.interfaces[interface["instance"].label]["mac_address"]
-                            )
+                            try:
+                                interfaceDict.setdefault(
+                                    "mac_address",
+                                    interface["mac_address"]
+                                    or device.interfaces[interface["instance"].label][
+                                        "mac_address"
+                                    ],
+                                )
+                            except KeyError:
+                                logger.error(
+                                    "Problem with MAC address on interface %s",
+                                    interface,
+                                )
+
                             interfaceDict.setdefault("ip_addresses", list())
                             interfaceDict["ip_addresses"].append(address)