Commit e84afa8c authored by Martín Ferrari's avatar Martín Ferrari

get_nodes

parent 27b0be38
......@@ -5,6 +5,10 @@ import os, socket, sys, traceback, unshare
import netns.protocol
class Node(object):
_nodes = []
@classmethod
def get_nodes(cls):
return set(cls._nodes)
def __init__(self, debug = False):
"""Create a new node in the emulation. Implemented as a separate
process in a new network name space. Requires root privileges to run.
......@@ -15,7 +19,7 @@ class Node(object):
fd, pid = _start_child(debug)
self._pid = pid
self._slave = netns.protocol.Client(fd, debug)
self._valid = True
Node._nodes.append(self)
@property
def pid(self):
return self._pid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment