Exemplo n.º 1
0
    def __init__(self,
                 name,
                 inNamespace=True,
                 server='',
                 sargs='',
                 sdir='/tmp/bcn',
                 client='',
                 cargs='{command}',
                 cdir=None,
                 ip="127.0.0.1",
                 port='',
                 **params):
        # Server params
        self.server = server
        self.sargs = sargs
        self.sdir = sdir
        # Client params
        self.client = client
        self.cargs = cargs
        self.cdir = cdir

        self.ip = ip
        self.port = port
        CPULimitedHost.__init__(self,
                                name,
                                inNamespace=inNamespace,
                                ip=ip,
                                **params)
Exemplo n.º 2
0
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        self.nfd = Nfd(self)
        self.nfd.start()

        self.peerList = {}
Exemplo n.º 3
0
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        # Create home directory for a node
        self.homeFolder = "%s/%s" % (self.params['workdir'], self.name)
        self.cmd("mkdir -p %s" % self.homeFolder)
        self.cmd("cd %s" % self.homeFolder)

        self.nfd = None

        self.peerList = {}
Exemplo n.º 4
0
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        # Create home directory for a node
        self.homeFolder = "%s/%s" % (self.params['workdir'], self.name)
        self.cmd("mkdir -p %s" % self.homeFolder)
        self.cmd("cd %s" % self.homeFolder)

        self.nfd = Nfd(self)
        self.nfd.start()

        self.peerList = {}
Exemplo n.º 5
0
    def config(self, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
Exemplo n.º 6
0
    def config(self, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
Exemplo n.º 7
0
    def config(self, fib=None, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', fib=fib)   #????? shoud it be app=app
        self.setParam(r, 'fib', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
Exemplo n.º 8
0
 def startRamcloud( self, cpu=.6 ):
     """Start Ramcloud
        cpu: CPU usage limit (in seconds/s)"""
     # Create a cgroup so Ramcloud doesn't eat all of our CPU
     ramcloud = CPULimitedHost( 'ramcloud', inNamespace=False, period_us=5000 )
     ramcloud.setCPUFrac( cpu / numCores() )
     info( '\n' )
     ramcloud.cmd( 'export PATH=%s:$PATH' % self.onosDir )
     ramcloud.cmd( 'export ONOS_LOGDIR=%s' % self.logDir )
     for daemon in 'coord', 'server':
         ramcloud.cmd( 'onos.sh rc-%s start' % daemon )
         pid = self.waitStart( 'Ramcloud %s' % daemon, 'obj.master/' + daemon )
         self.waitNetstat( pid )
         status = self.cmd( 'onos.sh rc-%s.sh status' % daemon )
         if 'running' not in status:
             raise Exception( 'Ramcloud %s startup failed: ' % daemon + status )
     self.ramcloud = ramcloud
Exemplo n.º 9
0
 def startRamcloud(self, cpu=.6):
     """Start Ramcloud
        cpu: CPU usage limit (in seconds/s)"""
     # Create a cgroup so Ramcloud doesn't eat all of our CPU
     ramcloud = CPULimitedHost('ramcloud',
                               inNamespace=False,
                               period_us=5000)
     ramcloud.setCPUFrac(cpu / numCores())
     info('\n')
     ramcloud.cmd('export PATH=%s:$PATH' % self.onosDir)
     ramcloud.cmd('export ONOS_LOGDIR=%s' % self.logDir)
     for daemon in 'coord', 'server':
         ramcloud.cmd('onos.sh rc-%s start' % daemon)
         pid = self.waitStart('Ramcloud %s' % daemon,
                              'obj.master/' + daemon)
         self.waitNetstat(pid)
         status = self.cmd('onos.sh rc-%s.sh status' % daemon)
         if 'running' not in status:
             raise Exception('Ramcloud %s startup failed: ' % daemon +
                             status)
     self.ramcloud = ramcloud
Exemplo n.º 10
0
 def __init__( self, name, **kwargs ):
     # First N (=pairs) hosts are clients, in root NS
     kwargs.pop('inNamespace', True)
     isServer = int( name[ 1: ] ) > pairs
     CPULimitedHost.__init__( self, name, inNamespace=isServer, **kwargs )
 def __init__(self, name, inNamespace=True, **params):
     CPULimitedHost.__init__(self, name, inNamespace=inNamespace, **params)
Exemplo n.º 12
0
 def __init__(self, name, **params):
     CPULimitedHost.__init__(self, name, **params)
     self.status = "INIT"
Exemplo n.º 13
0
 def terminate(self):
     "Stop node."
     if self.nfd is not None:
         self.nfd.stop()
     CPULimitedHost.terminate(self)