powersupply: Import sublcass module only if used

This way we avoid unconditionally importing all subclass dependencies,
and make them optional based on whether the setup has devices of that
type or not.

Change-Id: I0d2f8b26364b45f0d837cc51078784d1d0fa7ea1
diff --git a/src/osmo_gsm_tester/obj/powersupply.py b/src/osmo_gsm_tester/obj/powersupply.py
index 90e84ef..d0d315c 100644
--- a/src/osmo_gsm_tester/obj/powersupply.py
+++ b/src/osmo_gsm_tester/obj/powersupply.py
@@ -50,23 +50,17 @@
         MainLoop.sleep(self, sleep)
         self.power_set(True)
 
-
-from . import powersupply_sispm, powersupply_intellinet
-
-KNOWN_PWSUPPLY_TYPES = {
-        'sispm' : powersupply_sispm.PowerSupplySispm,
-        'intellinet' : powersupply_intellinet.PowerSupplyIntellinet,
-}
-
-def register_type(name, clazz):
-    """Register a new PoerSupply child class at runtime."""
-    KNOWN_PWSUPPLY_TYPES[name] = clazz
-
 def get_instance_by_type(pwsupply_type, pwsupply_opt):
     """Allocate a PowerSupply child class based on type. Opts are passed to the newly created object."""
-    obj = KNOWN_PWSUPPLY_TYPES.get(pwsupply_type, None)
-    if not obj:
+    if pwsupply_type == 'sispm':
+        from powersupply_sispm import PowerSupplySispm
+        obj = PowerSupplySispm
+    elif pwsupply_type == 'intellinet':
+        from powersupply_intellinet import PowerSupplyIntellinet
+        obj = PowerSupplyIntellinet
+    else:
         raise log.Error('PowerSupply type not supported:', pwsupply_type)
+
     return obj(pwsupply_opt)