daemon/core/emane/emane.py
def buildplatformxml(self):
        ''' Build a platform.xml file now that all nodes are configured.
        '''
        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        doc = self.xmldoc("platform")
        plat = doc.getElementsByTagName("platform").pop()
        if self.version < self.EMANE091:
            platformid = self.emane_config.valueof("platform_id_start", values)
            plat.setAttribute("name", "Platform %s" % platformid)
            plat.setAttribute("id", platformid)

        names = list(self.emane_config.getnames())
        platform_names = names[:len(self.emane_config._confmatrix_platform)]
        platform_names.remove('platform_id_start')

        # append all platform options (except starting id) to doc
        map( lambda n: plat.appendChild(self.xmlparam(doc, n, \
                        self.emane_config.valueof(n, values))), platform_names)

        nemid = int(self.emane_config.valueof("nem_id_start",  values))
        # assume self._objslock is already held here
        for n in sorted(self._objs.keys()):
            emanenode = self._objs[n]
            nems = emanenode.buildplatformxmlentry(doc)
            for netif in sorted(nems, key=lambda n: n.node.objid):
                # set ID, endpoints here
                nementry = nems[netif]
                nementry.setAttribute("id", "%d" % nemid)
                if self.version < self.EMANE092:
                    # insert nem options (except nem id) to doc
                    trans_addr = self.emane_config.valueof("transportendpoint", \
                                                           values)
                    nementry.insertBefore(self.xmlparam(doc, "transportendpoint", \
                                     "%s:%d" % (trans_addr, self.transformport)),
                                     nementry.firstChild)
                    platform_addr = self.emane_config.valueof("platformendpoint", \
                                                              values)
                    nementry.insertBefore(self.xmlparam(doc, "platformendpoint", \
                                     "%s:%d" % (platform_addr, self.platformport)),
                                     nementry.firstChild)
                plat.appendChild(nementry)
                emanenode.setnemid(netif, nemid)
                # NOTE: MAC address set before here is incorrect, including the one
                #  sent from the GUI via link message
                # MAC address determined by NEM ID: 02:02:00:00:nn:nn"
                macstr = self._hwaddr_prefix + ":00:00:"
                macstr += "%02X:%02X" % ((nemid >> 8) & 0xFF, nemid & 0xFF)
                netif.sethwaddr(MacAddr.fromstring(macstr))
                # increment counters used to manage IDs, endpoint port numbers
                nemid += 1
                self.platformport += 1
                self.transformport += 1
        self.xmlwrite(doc, "platform.xml")
 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 buildplatformxml(self):
        values = self.getconfig(None, "emane",
                                self.emane_config.getdefaultvalues())[1]
        doc = self.xmldoc("platform")
        plat = doc.getElementsByTagName("platform").pop()
        if self.version < self.EMANE091:
            platformid = self.emane_config.valueof("platform_id_start", values)
            plat.setAttribute("name", "Platform %s" % platformid)
            plat.setAttribute("id", platformid)
        names = list(self.emane_config.getnames())
        platform_names = names[:len(self.emane_config._confmatrix_platform)]
        platform_names.remove('platform_id_start')
        map( lambda n: plat.appendChild(self.xmlparam(doc, n, \
                        self.emane_config.valueof(n, values))), platform_names)
        nemid = int(self.emane_config.valueof("nem_id_start",  values))
        for n in sorted(self._objs.keys()):
            emanenode = self._objs[n]
            nems = emanenode.buildplatformxmlentry(doc)
            for netif in sorted(nems, key=lambda n: n.node.objid):
                nementry = nems[netif]
                nementry.setAttribute("id", "%d" % nemid)
                if self.version < self.EMANE092:
                    trans_addr = self.emane_config.valueof("transportendpoint", \
                                                           values)
                    nementry.insertBefore(self.xmlparam(doc, "transportendpoint", \
                                     "%s:%d" % (trans_addr, self.transformport)),
                                     nementry.firstChild)
                    platform_addr = self.emane_config.valueof("platformendpoint", \
                                                              values)
                    nementry.insertBefore(self.xmlparam(doc, "platformendpoint", \
                                     "%s:%d" % (platform_addr, self.platformport)),
                                     nementry.firstChild)
                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
                self.platformport += 1
                self.transformport += 1
        self.xmlwrite(doc, "platform.xml")
def buildplatformxml ( self ) : values = self . getconfig ( None , "emane" , self . emane_config . getdefaultvalues ( ) ) [ 1 ] doc = self . xmldoc ( "platform" ) plat = doc . getElementsByTagName ( "platform" ) . pop ( ) if self . version < self . EMANE091 : platformid = self . emane_config . valueof ( "platform_id_start" , values ) plat . setAttribute ( "name" , "Platform %s" % platformid ) plat . setAttribute ( "id" , platformid ) names = list ( self . emane_config . getnames ( ) ) platform_names = names [ : len ( self . emane_config . _confmatrix_platform ) ] platform_names . remove ( 'platform_id_start' ) map ( lambda n : plat . appendChild ( self . xmlparam ( doc , n , self . emane_config . valueof ( n , values ) ) ) , platform_names ) nemid = int ( self . emane_config . valueof ( "nem_id_start" , values ) ) for n in sorted ( self . _objs . keys ( ) ) : emanenode = self . _objs [ n ] nems = emanenode . buildplatformxmlentry ( doc ) for netif in sorted ( nems , key = lambda n : n . node . objid ) : nementry = nems [ netif ] nementry . setAttribute ( "id" , "%d" % nemid ) if self . version < self . EMANE092 : trans_addr = self . emane_config . valueof ( "transportendpoint" , values ) nementry . insertBefore ( self . xmlparam ( doc , "transportendpoint" , "%s:%d" % ( trans_addr , self . transformport ) ) , nementry . firstChild ) platform_addr = self . emane_config . valueof ( "platformendpoint" , values ) nementry . insertBefore ( self . xmlparam ( doc , "platformendpoint" , "%s:%d" % ( platform_addr , self . platformport ) ) , nementry . firstChild ) 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 self . platformport += 1 self . transformport += 1 self . xmlwrite ( doc , "platform.xml" )
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.
        ''' # append all platform options (except starting id) to doc # assume self._objslock is already held here # set ID, endpoints here # insert nem options (except nem id) to doc # NOTE: MAC address set before here is incorrect, including the one #  sent from the GUI via link message # MAC address determined by NEM ID: 02:02:00:00:nn:nn" # increment counters used to manage IDs, endpoint port numbers
self