daemon/core/emane/emane.py
def buildplatformxml2(self, ctrlnet):
        ''' Build a platform.xml file now that all nodes are configured.
        '''
        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        nemid = int(self.emane_config.valueof("nem_id_start",  values))
        platformxmls = {}

        # assume self._objslock is already held here
        for n in sorted(self._objs.keys()):
            emanenode = self._objs[n]
            nems = emanenode.buildplatformxmlentry(self.xmldoc("platform"))
            for netif in sorted(nems, key=lambda n: n.node.objid):
                nementry = nems[netif]
                nementry.setAttribute("id", "%d" % nemid)
                k = netif.node.objid
                if netif.transport_type == "raw":
                    k = 'host'
                    otadev = ctrlnet.brname
                    eventdev = ctrlnet.brname
                else:
                    otadev = None
                    eventdev = None
                if k not in platformxmls:
                    platformxmls[k] = self.newplatformxmldoc(values, otadev,
                                                             eventdev)
                doc = platformxmls[k]
                plat = doc.getElementsByTagName("platform").pop()
                plat.appendChild(nementry)
                emanenode.setnemid(netif, nemid)
                macstr = self._hwaddr_prefix + ":00:00:"
                macstr += "%02X:%02X" % ((nemid >> 8) & 0xFF, nemid & 0xFF)
                netif.sethwaddr(MacAddr.fromstring(macstr))
                nemid += 1
        for k in sorted(platformxmls.keys()):
            if k == 'host':
                self.xmlwrite(platformxmls['host'], "platform.xml")
                continue
            self.xmlwrite(platformxmls[k], "platform%d.xml" % k)
 Build a platform.xml file now that all nodes are configured.
        
Build a platform.xml file now that all nodes are configured.
Build a platform . xml file now that all nodes are configured .
def buildplatformxml2(self, ctrlnet):
        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        nemid = int(self.emane_config.valueof("nem_id_start",  values))
        platformxmls = {}
        for n in sorted(self._objs.keys()):
            emanenode = self._objs[n]
            nems = emanenode.buildplatformxmlentry(self.xmldoc("platform"))
            for netif in sorted(nems, key=lambda n: n.node.objid):
                nementry = nems[netif]
                nementry.setAttribute("id", "%d" % nemid)
                k = netif.node.objid
                if netif.transport_type == "raw":
                    k = 'host'
                    otadev = ctrlnet.brname
                    eventdev = ctrlnet.brname
                else:
                    otadev = None
                    eventdev = None
                if k not in platformxmls:
                    platformxmls[k] = self.newplatformxmldoc(values, otadev,
                                                             eventdev)
                doc = platformxmls[k]
                plat = doc.getElementsByTagName("platform").pop()
                plat.appendChild(nementry)
                emanenode.setnemid(netif, nemid)
                macstr = self._hwaddr_prefix + ":00:00:"
                macstr += "%02X:%02X" % ((nemid >> 8) & 0xFF, nemid & 0xFF)
                netif.sethwaddr(MacAddr.fromstring(macstr))
                nemid += 1
        for k in sorted(platformxmls.keys()):
            if k == 'host':
                self.xmlwrite(platformxmls['host'], "platform.xml")
                continue
            self.xmlwrite(platformxmls[k], "platform%d.xml" % k)
def buildplatformxml2 ( self , ctrlnet ) : values = self . getconfig ( None , "emane" , self . emane_config . getdefaultvalues ( ) ) [ 1 ] nemid = int ( self . emane_config . valueof ( "nem_id_start" , values ) ) platformxmls = { } for n in sorted ( self . _objs . keys ( ) ) : emanenode = self . _objs [ n ] nems = emanenode . buildplatformxmlentry ( self . xmldoc ( "platform" ) ) for netif in sorted ( nems , key = lambda n : n . node . objid ) : nementry = nems [ netif ] nementry . setAttribute ( "id" , "%d" % nemid ) k = netif . node . objid if netif . transport_type == "raw" : k = 'host' otadev = ctrlnet . brname eventdev = ctrlnet . brname else : otadev = None eventdev = None if k not in platformxmls : platformxmls [ k ] = self . newplatformxmldoc ( values , otadev , eventdev ) doc = platformxmls [ k ] plat = doc . getElementsByTagName ( "platform" ) . pop ( ) plat . appendChild ( nementry ) emanenode . setnemid ( netif , nemid ) macstr = self . _hwaddr_prefix + ":00:00:" macstr += "%02X:%02X" % ( ( nemid >> 8 ) & 0xFF , nemid & 0xFF ) netif . sethwaddr ( MacAddr . fromstring ( macstr ) ) nemid += 1 for k in sorted ( platformxmls . keys ( ) ) : if k == 'host' : self . xmlwrite ( platformxmls [ 'host' ] , "platform.xml" ) continue self . xmlwrite ( platformxmls [ k ] , "platform%d.xml" % k )
Build a platform.xml file now that all nodes are configured.
Build a platform . xml file now that all nodes are configured .
''' Build a platform.xml file now that all nodes are configured.
        ''' # assume self._objslock is already held here
self
ctrlnet