daemon/core/emane/emane.py
def checkdistributed(self):
        ''' Check for EMANE nodes that exist on multiple emulation servers and
            coordinate the NEM id and port number space.
            If we are the master EMANE node, return False so initialization will
            proceed as normal; otherwise slaves return True here and
            initialization is deferred.
        '''
        # check with the session if we are the "master" Emane object?
        master = False
        self._objslock.acquire()
        if len(self._objs) > 0:
            master = self.session.master
            self.info("Setup EMANE with master=%s." % master)
        self._objslock.release()

        # we are not the master Emane object, wait for nem id and ports
        if not master:
            return True

        cfgval = self.getconfig(None, self.emane_config._name,
                                self.emane_config.getdefaultvalues())[1]
        values = list(cfgval)

        nemcount = 0
        self._objslock.acquire()
        for n in self._objs:
            emanenode = self._objs[n]
            nemcount += emanenode.numnetif()
        nemid = int(self.emane_config.valueof("nem_id_start", values))
        nemid += nemcount
        platformid = int(self.emane_config.valueof("platform_id_start", values))
        names = list(self.emane_config.getnames())

        # build an ordered list of servers so platform ID is deterministic
        servers = []
        for n in sorted(self._objs):
            for s in self.session.broker.getserversbynode(n):
                if s not in servers:
                    servers.append(s)
        self._objslock.release()

        for server in servers:
            if server == "localhost":
                continue
            (host, port, sock) = self.session.broker.getserver(server)
            if sock is None:
                continue
            platformid += 1
            typeflags = coreapi.CONF_TYPE_FLAGS_UPDATE
            values[names.index("platform_id_start")] = str(platformid)
            values[names.index("nem_id_start")] = str(nemid)
            msg = EmaneGlobalModel.toconfmsg(flags=0, nodenum=None,
                                             typeflags=typeflags, values=values)
            sock.send(msg)
            # increment nemid for next server by number of interfaces
            self._ifccountslock.acquire()
            if server in self._ifccounts:
                nemid += self._ifccounts[server]
            self._ifccountslock.release()

        return False
 Check for EMANE nodes that exist on multiple emulation servers and
            coordinate the NEM id and port number space.
            If we are the master EMANE node, return False so initialization will
            proceed as normal; otherwise slaves return True here and
            initialization is deferred.
        
Check for EMANE nodes that exist on multiple emulation servers and
coordinate the NEM id and port number space.
If we are the master EMANE node, return False so initialization will
proceed as normal; otherwise slaves return True here and
initialization is deferred.
Check for EMANE nodes that exist on multiple emulation servers and coordinate the NEM id and port number space . If we are the master EMANE node return False so initialization will proceed as normal ; otherwise slaves return True here and initialization is deferred .
def checkdistributed(self):
        master = False
        self._objslock.acquire()
        if len(self._objs) > 0:
            master = self.session.master
            self.info("Setup EMANE with master=%s." % master)
        self._objslock.release()
        if not master:
            return True
        cfgval = self.getconfig(None, self.emane_config._name,
                                self.emane_config.getdefaultvalues())[1]
        values = list(cfgval)
        nemcount = 0
        self._objslock.acquire()
        for n in self._objs:
            emanenode = self._objs[n]
            nemcount += emanenode.numnetif()
        nemid = int(self.emane_config.valueof("nem_id_start", values))
        nemid += nemcount
        platformid = int(self.emane_config.valueof("platform_id_start", values))
        names = list(self.emane_config.getnames())
        servers = []
        for n in sorted(self._objs):
            for s in self.session.broker.getserversbynode(n):
                if s not in servers:
                    servers.append(s)
        self._objslock.release()
        for server in servers:
            if server == "localhost":
                continue
            (host, port, sock) = self.session.broker.getserver(server)
            if sock is None:
                continue
            platformid += 1
            typeflags = coreapi.CONF_TYPE_FLAGS_UPDATE
            values[names.index("platform_id_start")] = str(platformid)
            values[names.index("nem_id_start")] = str(nemid)
            msg = EmaneGlobalModel.toconfmsg(flags=0, nodenum=None,
                                             typeflags=typeflags, values=values)
            sock.send(msg)
            self._ifccountslock.acquire()
            if server in self._ifccounts:
                nemid += self._ifccounts[server]
            self._ifccountslock.release()
        return False
def checkdistributed ( self ) : master = False self . _objslock . acquire ( ) if len ( self . _objs ) > 0 : master = self . session . master self . info ( "Setup EMANE with master=%s." % master ) self . _objslock . release ( ) if not master : return True cfgval = self . getconfig ( None , self . emane_config . _name , self . emane_config . getdefaultvalues ( ) ) [ 1 ] values = list ( cfgval ) nemcount = 0 self . _objslock . acquire ( ) for n in self . _objs : emanenode = self . _objs [ n ] nemcount += emanenode . numnetif ( ) nemid = int ( self . emane_config . valueof ( "nem_id_start" , values ) ) nemid += nemcount platformid = int ( self . emane_config . valueof ( "platform_id_start" , values ) ) names = list ( self . emane_config . getnames ( ) ) servers = [ ] for n in sorted ( self . _objs ) : for s in self . session . broker . getserversbynode ( n ) : if s not in servers : servers . append ( s ) self . _objslock . release ( ) for server in servers : if server == "localhost" : continue ( host , port , sock ) = self . session . broker . getserver ( server ) if sock is None : continue platformid += 1 typeflags = coreapi . CONF_TYPE_FLAGS_UPDATE values [ names . index ( "platform_id_start" ) ] = str ( platformid ) values [ names . index ( "nem_id_start" ) ] = str ( nemid ) msg = EmaneGlobalModel . toconfmsg ( flags = 0 , nodenum = None , typeflags = typeflags , values = values ) sock . send ( msg ) self . _ifccountslock . acquire ( ) if server in self . _ifccounts : nemid += self . _ifccounts [ server ] self . _ifccountslock . release ( ) return False
Check for EMANE nodes that exist on multiple emulation servers and
coordinate the NEM id and port number space.
Check for EMANE nodes that exist on multiple emulation servers and coordinate the NEM id and port number space .
''' Check for EMANE nodes that exist on multiple emulation servers and
            coordinate the NEM id and port number space.
            If we are the master EMANE node, return False so initialization will
            proceed as normal; otherwise slaves return True here and
            initialization is deferred.
        ''' # check with the session if we are the "master" Emane object? # we are not the master Emane object, wait for nem id and ports # build an ordered list of servers so platform ID is deterministic # increment nemid for next server by number of interfaces
self