daemon: changes to support optional retainment of per-interface parameters for EMANE models when multiple EMANE models of the same type are used as interfaces for a node
This commit is contained in:
parent
c66914ec21
commit
b91b5125f2
3 changed files with 15 additions and 3 deletions
|
@ -232,6 +232,7 @@ class PyCoreNode(PyCoreObj):
|
||||||
if ifindex in self._netif:
|
if ifindex in self._netif:
|
||||||
raise ValueError, "ifindex %s already exists" % ifindex
|
raise ValueError, "ifindex %s already exists" % ifindex
|
||||||
self._netif[ifindex] = netif
|
self._netif[ifindex] = netif
|
||||||
|
netif.netindex = ifindex
|
||||||
|
|
||||||
def delnetif(self, ifindex):
|
def delnetif(self, ifindex):
|
||||||
if ifindex not in self._netif:
|
if ifindex not in self._netif:
|
||||||
|
|
|
@ -235,7 +235,14 @@ class Emane(ConfigurableManager):
|
||||||
# don't use default values when interface config is the same as net
|
# don't use default values when interface config is the same as net
|
||||||
# note here that using ifc.node.objid as key allows for only one type
|
# note here that using ifc.node.objid as key allows for only one type
|
||||||
# of each model per node; TODO: use both node and interface as key
|
# of each model per node; TODO: use both node and interface as key
|
||||||
values = self.getconfig(ifc.node.objid, conftype, None)[1]
|
|
||||||
|
# Adamson change: first check for iface config keyed by "node:ifc.name"
|
||||||
|
# (so that nodes w/ multiple interfaces of same conftype can have
|
||||||
|
# different configs for each separate interface)
|
||||||
|
key = 1000*ifc.node.objid + ifc.netindex
|
||||||
|
values = self.getconfig(key, conftype, None)[1]
|
||||||
|
if not values:
|
||||||
|
values = self.getconfig(ifc.node.objid, conftype, None)[1]
|
||||||
if not values and self.version > self.EMANE091:
|
if not values and self.version > self.EMANE091:
|
||||||
# with EMANE 0.9.2+, we need an extra NEM XML from
|
# with EMANE 0.9.2+, we need an extra NEM XML from
|
||||||
# model.buildnemxmlfiles(), so defaults are returned here
|
# model.buildnemxmlfiles(), so defaults are returned here
|
||||||
|
@ -1279,7 +1286,9 @@ class EmaneModel(WirelessModel):
|
||||||
name = "n%s" % self.objid
|
name = "n%s" % self.objid
|
||||||
if ifc is not None:
|
if ifc is not None:
|
||||||
nodenum = ifc.node.objid
|
nodenum = ifc.node.objid
|
||||||
if emane.getconfig(nodenum, self._name, None)[1] is not None:
|
# Adamson change - use getifcconfig() to get proper result
|
||||||
|
#if emane.getconfig(nodenum, self._name, None)[1] is not None:
|
||||||
|
if emane.getifcconfig(nodenum, self._name, None, ifc) is not None:
|
||||||
name = ifc.localname.replace('.','_')
|
name = ifc.localname.replace('.','_')
|
||||||
return "%s%s" % (name, self._name)
|
return "%s%s" % (name, self._name)
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,13 @@ def main():
|
||||||
names = EmaneIeee80211abgModel.getnames()
|
names = EmaneIeee80211abgModel.getnames()
|
||||||
values = list(EmaneIeee80211abgModel.getdefaultvalues())
|
values = list(EmaneIeee80211abgModel.getdefaultvalues())
|
||||||
# TODO: change any of the EMANE 802.11 parameter values here
|
# TODO: change any of the EMANE 802.11 parameter values here
|
||||||
|
for i in range(0, len(names)):
|
||||||
|
print "EMANE 80211 \"%s\" = \"%s\"" % (names[i], values[i])
|
||||||
try:
|
try:
|
||||||
values[ names.index('pathlossmode') ] = '2ray'
|
values[ names.index('pathlossmode') ] = '2ray'
|
||||||
except ValueError:
|
except ValueError:
|
||||||
values[ names.index('propagationmodel') ] = '2ray'
|
values[ names.index('propagationmodel') ] = '2ray'
|
||||||
|
|
||||||
session.emane.setconfig(wlan.objid, EmaneIeee80211abgModel._name, values)
|
session.emane.setconfig(wlan.objid, EmaneIeee80211abgModel._name, values)
|
||||||
services_str = "zebra|OSPFv3MDR|vtysh|IPForward"
|
services_str = "zebra|OSPFv3MDR|vtysh|IPForward"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue