updated emane model phy/mac parsing to account for values that support multiple values into a param list
This commit is contained in:
parent
405614bbd8
commit
4d01a49ec2
1 changed files with 18 additions and 19 deletions
|
@ -178,10 +178,16 @@ class EmaneModel(WirelessModel):
|
||||||
mac_element.setAttribute("library", self.mac_library)
|
mac_element.setAttribute("library", self.mac_library)
|
||||||
|
|
||||||
for name in mac_names:
|
for name in mac_names:
|
||||||
|
# ignore custom configurations
|
||||||
if name in self.config_ignore:
|
if name in self.config_ignore:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# check if value is a multi param
|
||||||
value = self.valueof(name, values)
|
value = self.valueof(name, values)
|
||||||
param = emane_manager.xmlparam(mac_document, name, value)
|
param = value_to_params(mac_document, name, value)
|
||||||
|
if not param:
|
||||||
|
param = emane_manager.xmlparam(mac_document, name, value)
|
||||||
|
|
||||||
mac_element.appendChild(param)
|
mac_element.appendChild(param)
|
||||||
|
|
||||||
return mac_document
|
return mac_document
|
||||||
|
@ -205,26 +211,19 @@ class EmaneModel(WirelessModel):
|
||||||
if self.phy_library:
|
if self.phy_library:
|
||||||
phy_element.setAttribute("library", self.phy_library)
|
phy_element.setAttribute("library", self.phy_library)
|
||||||
|
|
||||||
# hack to account for config that can contain more than 1 value
|
# append all phy options
|
||||||
frequencies = None
|
|
||||||
name = "frequencyofinterest"
|
|
||||||
try:
|
|
||||||
value = self.valueof(name, values)
|
|
||||||
frequencies = value_to_params(phy_document, name, value)
|
|
||||||
if frequencies:
|
|
||||||
phy_names = list(phy_names)
|
|
||||||
phy_names.remove("frequencyofinterest")
|
|
||||||
except ValueError:
|
|
||||||
logger.info("%s is not present in the phy names", name)
|
|
||||||
|
|
||||||
# append all PHY options to phydoc
|
|
||||||
for name in phy_names:
|
for name in phy_names:
|
||||||
value = self.valueof(name, values)
|
# ignore custom configurations
|
||||||
param = emane_manager.xmlparam(phy_document, name, value)
|
if name in self.config_ignore:
|
||||||
phy_element.appendChild(param)
|
continue
|
||||||
|
|
||||||
if frequencies:
|
# check if value is a multi param
|
||||||
phy_element.appendChild(frequencies)
|
value = self.valueof(name, values)
|
||||||
|
param = value_to_params(phy_document, name, value)
|
||||||
|
if not param:
|
||||||
|
param = emane_manager.xmlparam(phy_document, name, value)
|
||||||
|
|
||||||
|
phy_element.appendChild(param)
|
||||||
|
|
||||||
return phy_document
|
return phy_document
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue