def __init__(self, name, inMountNamespace=False, inPIDNamespace=False, inUTSNamespace=False, **params): """name: name of node inNamespace: in network namespace? inMountNamespace: has private mountspace? inPIDNamespace: has private PID namespace? params: Node parameters (see config() for details)""" # PID and Mount Namespace handling self.inPIDNamespace = inPIDNamespace self.inUTSNamespace = inUTSNamespace self.inMountNamespace = inMountNamespace # Private config monitoring self.hasPrivateLogs = False self.hasPrivateRun = False # Sanity check on namespace config if self.inPIDNamespace is True and self.inMountNamespace is False: raise Exception('PID namespaces require mount namespace for /proc') # Stash extended configuration information self.services = {} # dict of services and parameters for this node self.privateMounts = {} # dict of private mounts for this node # Network information self.loIntfs = {} # Request initialization of the BaseNode BaseNode.__init__(self, name, **params)
def __init__(self, name, image=None, port_map=None, fs_map=None, **kwargs): if image is None: raise UnboundLocalError('Docker image is not specified') img_id = subprocess.check_output(['docker', 'images', '-q', image]) if not img_id: raise ValueError('Docker image "%s" does not exist' % image) self.docker_image = image self.port_map = port_map self.fs_map = fs_map kwargs['inNamespace'] = True Node.__init__(self, name, **kwargs)
def __init__( self, name, sw_path = "dc_full", dpid=None, opts='', thrift_port = None, pcap_dump = False, verbose = False, **kwargs ): Node.__init__( self, name, **kwargs ) self.dpid = self.defaultDpid(dpid) self.opts = opts self.sw_path = sw_path self.verbose = verbose logfile = '/tmp/p4ns.%s.log' % self.name self.output = open(logfile, 'w') self.thrift_port = thrift_port self.pcap_dump = pcap_dump
def __init__(self, name, inNamespace=False, command='controller', cargs='-v ptcp:%d', cdir=None, ip="127.0.0.1", port=6653, protocol='tcp', **params): self.command = command self.cargs = cargs self.cdir = cdir self.ip = ip self.port = port self.protocol = protocol Node.__init__(self, name, inNamespace=inNamespace, ip=ip, **params)
def __init__(self, name, sw_path="dc_full", dpid=None, opts='', thrift_port=None, pcap_dump=False, verbose=False, **kwargs): Node.__init__(self, name, **kwargs) self.dpid = self.defaultDpid(dpid) self.opts = opts self.sw_path = sw_path self.verbose = verbose logfile = '/tmp/p4ns.%s.log' % self.name self.output = open(logfile, 'w') self.thrift_port = thrift_port self.pcap_dump = pcap_dump
def __init__(self, name, path=None, **kwargs): # double check if java is available (it is needed for RiseV2G) pathCheck('java') # set the path of RiseV2G if path is not None: self.RISE_PATH = path else: self.RISE_PATH = "/usr/share/.miniV2G/RiseV2G" # check if it exists if "No such file or directory" in popen('ls {}'.format( self.RISE_PATH)).read(): exit( "*** Fatal error: directory %s not found. Select the right folder which contains the needed jar files." ) # initialize the subprocess object self.proc = None Node.__init__(self, name, **kwargs) # setup a random prefix for folders (to better cleanup everything in the end) prefix_len = 4 self.FOLDER_PREFIX = ''.join( random.choice(string.ascii_lowercase) for i in range(prefix_len)) # initialize the folder for the RiseV2G copy self.folder = "" # cleanup of the generated folder def cleaner(): print('*** Cleaning up the mess') popen("rm -rd {}*".format(self.FOLDER_PREFIX)) # this will be called more than the needed times, so the output is supressed popen("rm -rd RISE-V2G-Certificates > /dev/null 2>&1 ") atexit.register(cleaner)
def __init__(self): Node.__init__(self)
def __init__(self, name, *args, **kwargs ): Node.__init__( self, name, inNamespace=False, *args, **kwargs ) self.brname = "br-dreamer" self.OF_V = "OpenFlow13"
def __init__(self, name, inNamespace=True, **params): Node.__init__(self, name, inNamespace, **params)