Bug fixing Netns emulation
[nepi.git] / src / nepi / resources / netns / netnswrapper.py
index 34120af..74bd69a 100644 (file)
@@ -23,11 +23,6 @@ import os
 import sys
 import uuid
 
-try:
-    import netns
-except ImportError:
-    pass
-
 class NetNSWrapper(object):
     def __init__(self, loglevel = logging.INFO, enable_dump = False):
         super(NetNSWrapper, self).__init__()
@@ -58,6 +53,7 @@ class NetNSWrapper(object):
  
     def create(self, clazzname, *args):
         """ This method should be used to construct netns objects """
+        import netns
 
         if clazzname not in ['open'] and not hasattr(netns, clazzname):
             msg = "Type %s not supported" % (clazzname) 
@@ -168,9 +164,13 @@ class NetNSWrapper(object):
         self.debuger.dump_shutdown()
         ########
 
+        ### FLUSH PIPES
         sys.stdout.flush()
         sys.stderr.flush()
 
+        ### RELEASE OBJECTS
+        del self._objects 
+
         ### DEBUG
         self.logger.debug("SHUTDOWN")
         ########