def buildnemxmlfiles(self, e, ifc): ''' Build the necessary nem, mac, and phy XMLs in the given path. If an individual NEM has a nonstandard config, we need to build that file also. Otherwise the WLAN-wide nXXemane_rfpipenem.xml, nXXemane_rfpipemac.xml, nXXemane_rfpipephy.xml are used. ''' values = e.getifcconfig(self.objid, self._name, self.getdefaultvalues(), ifc) if values is None: return nemdoc = e.xmldoc("nem") nem = nemdoc.getElementsByTagName("nem").pop() nem.setAttribute("name", "RF-PIPE NEM") e.appendtransporttonem(nemdoc, nem, self.objid, ifc) mactag = nemdoc.createElement("mac") mactag.setAttribute("definition", self.macxmlname(ifc)) nem.appendChild(mactag) phytag = nemdoc.createElement("phy") phytag.setAttribute("definition", self.phyxmlname(ifc)) nem.appendChild(phytag) e.xmlwrite(nemdoc, self.nemxmlname(ifc)) names = list(self.getnames()) macnames = names[:len(self._confmatrix_mac)] phynames = names[len(self._confmatrix_mac):] macdoc = e.xmldoc("mac") mac = macdoc.getElementsByTagName("mac").pop() mac.setAttribute("name", "RF-PIPE MAC") mac.setAttribute("library", "rfpipemaclayer") if e.version < e.EMANE091 and \ self.valueof("transmissioncontrolmap", values) is "": macnames.remove("transmissioncontrolmap") # EMANE 0.7.4 support if e.version == e.EMANE074: # convert datarate from bps to kbps i = names.index('datarate') values = list(values) values[i] = self.emane074_fixup(values[i], 1000) # append MAC options to macdoc map(lambda n: mac.appendChild(e.xmlparam(macdoc, n, \ self.valueof(n, values))), macnames) e.xmlwrite(macdoc, self.macxmlname(ifc)) phydoc = EmaneUniversalModel.getphydoc(e, self, values, phynames) e.xmlwrite(phydoc, self.phyxmlname(ifc))
def buildnemxmlfiles(self, e, ifc): ''' Build the necessary nem, mac, and phy XMLs in the given path. If an individual NEM has a nonstandard config, we need to build that file also. Otherwise the WLAN-wide nXXemane_rfpipenem.xml, nXXemane_rfpipemac.xml, nXXemane_rfpipephy.xml are used. ''' values = e.getifcconfig(self.objid, self._name, self.getdefaultvalues(), ifc) if values is None: return nemdoc = e.xmldoc("nem") nem = nemdoc.getElementsByTagName("nem").pop() nem.setAttribute("name", "RF-PIPE NEM") e.appendtransporttonem(nemdoc, nem, self.objid, ifc) mactag = nemdoc.createElement("mac") mactag.setAttribute("definition", self.macxmlname(ifc)) nem.appendChild(mactag) phytag = nemdoc.createElement("phy") phytag.setAttribute("definition", self.phyxmlname(ifc)) nem.appendChild(phytag) e.xmlwrite(nemdoc, self.nemxmlname(ifc)) names = list(self.getnames()) macnames = names[:len(self._confmatrix_mac)] phynames = names[len(self._confmatrix_mac):] macdoc = e.xmldoc("mac") mac = macdoc.getElementsByTagName("mac").pop() mac.setAttribute("name", "RF-PIPE MAC") mac.setAttribute("library", "rfpipemaclayer") if e.version < e.EMANE091 and \ self.valueof("transmissioncontrolmap", values) is "": macnames.remove("transmissioncontrolmap") # EMANE 0.7.4 support if e.version == e.EMANE074: # convert datarate from bps to kbps i = names.index('datarate') values = list(values) values[i] = self.emane074_fixup(values[i], 1000) # append MAC options to macdoc map( lambda n: mac.appendChild(e.xmlparam(macdoc, n, \ self.valueof(n, values))), macnames) e.xmlwrite(macdoc, self.macxmlname(ifc)) phydoc = EmaneUniversalModel.getphydoc(e, self, values, phynames) e.xmlwrite(phydoc, self.phyxmlname(ifc))
def buildnemxmlfiles(self, e, ifc): ''' Build the necessary nem, mac, and phy XMLs in the given path. If an individual NEM has a nonstandard config, we need to build that file also. Otherwise the WLAN-wide nXXemane_ieee80211abgnem.xml, nXXemane_ieee80211abgemac.xml, nXXemane_ieee80211abgphy.xml are used. ''' values = e.getifcconfig(self.objid, self._name, self.getdefaultvalues(), ifc) if values is None: return nemdoc = e.xmldoc("nem") nem = nemdoc.getElementsByTagName("nem").pop() nem.setAttribute("name", "ieee80211abg NEM") e.appendtransporttonem(nemdoc, nem, self.objid, ifc) mactag = nemdoc.createElement("mac") mactag.setAttribute("definition", self.macxmlname(ifc)) nem.appendChild(mactag) phytag = nemdoc.createElement("phy") phytag.setAttribute("definition", self.phyxmlname(ifc)) nem.appendChild(phytag) e.xmlwrite(nemdoc, self.nemxmlname(ifc)) macdoc = e.xmldoc("mac") mac = macdoc.getElementsByTagName("mac").pop() mac.setAttribute("name", "ieee80211abg MAC") mac.setAttribute("library", "ieee80211abgmaclayer") names = self.getnames() macnames = names[:len(self._confmatrix_mac)] phynames = names[len(self._confmatrix_mac):] # append all MAC options to macdoc if Emane.version >= Emane.EMANE091: for macname in macnames: mac9xnvpairlist = self.get9xmacparamequivalent(macname, values) for nvpair in mac9xnvpairlist: mac.appendChild(e.xmlparam(macdoc, nvpair[0], nvpair[1])) else: map( lambda n: mac.appendChild(e.xmlparam(macdoc, n, \ self.valueof(n, values))), macnames) e.xmlwrite(macdoc, self.macxmlname(ifc)) phydoc = EmaneUniversalModel.getphydoc(e, self, values, phynames) e.xmlwrite(phydoc, self.phyxmlname(ifc))
def buildnemxmlfiles(self, e, ifc): ''' Build the necessary nem, mac, and phy XMLs in the given path. If an individual NEM has a nonstandard config, we need to build that file also. Otherwise the WLAN-wide nXXemane_tdmanem.xml, nXXemane_tdmamac.xml, nXXemane_tdmaphy.xml are used. ''' values = e.getifcconfig(self.objid, self._name, self.getdefaultvalues(), ifc) if values is None: return nemdoc = e.xmldoc("nem") nem = nemdoc.getElementsByTagName("nem").pop() nem.setAttribute("name", "TDMA NEM") e.appendtransporttonem(nemdoc, nem, self.objid, ifc) mactag = nemdoc.createElement("mac") mactag.setAttribute("definition", self.macxmlname(ifc)) nem.appendChild(mactag) phytag = nemdoc.createElement("phy") phytag.setAttribute("definition", self.phyxmlname(ifc)) nem.appendChild(phytag) e.xmlwrite(nemdoc, self.nemxmlname(ifc)) names = list(self.getnames()) macnames = names[:len(self._confmatrix_mac)] phynames = names[len(self._confmatrix_mac):] # make any changes to the mac/phy names here to e.g. exclude them from # the XML output macdoc = e.xmldoc("mac") mac = macdoc.getElementsByTagName("mac").pop() mac.setAttribute("name", "TDMA MAC") mac.setAttribute("library", "tdmaeventschedulerradiomodel") # append MAC options to macdoc map(lambda n: mac.appendChild(e.xmlparam(macdoc, n, \ self.valueof(n, values))), macnames) e.xmlwrite(macdoc, self.macxmlname(ifc)) phydoc = EmaneUniversalModel.getphydoc(e, self, values, phynames) e.xmlwrite(phydoc, self.phyxmlname(ifc))