fix for wlan configuration not getting set by default

This commit is contained in:
bharnden 2019-09-11 21:54:07 -07:00
parent 935a7da0e9
commit 89fe61f312
2 changed files with 10 additions and 8 deletions

View file

@ -393,7 +393,6 @@ class BasicRangeModel(WirelessModel):
:param core.session.Session session: related core session
:param int _id: object id
:param dict config: values
"""
super(BasicRangeModel, self).__init__(session=session, _id=_id)
self.session = session
@ -401,7 +400,7 @@ class BasicRangeModel(WirelessModel):
self._netifs = {}
self._netifslock = threading.Lock()
self.range = None
self.range = 0
self.bw = None
self.delay = None
self.loss = None

View file

@ -1156,6 +1156,11 @@ class WlanNode(CoreNetwork):
logging.debug("node(%s) setting model: %s", self.name, model.name)
if model.config_type == RegisterTlvs.WIRELESS.value:
self.model = model(session=self.session, _id=self.id)
for netif in self.netifs():
netif.poshook = self.model.position_callback
if netif.poshook and netif.node:
x, y, z = netif.node.position.get()
netif.poshook(netif, x, y, z)
self.updatemodel(config)
elif model.config_type == RegisterTlvs.MOBILITY.value:
self.mobility = model(session=self.session, _id=self.id)
@ -1173,12 +1178,10 @@ class WlanNode(CoreNetwork):
"node(%s) updating model(%s): %s", self.id, self.model.name, config
)
self.model.update_config(config)
if self.model.position_callback:
for netif in self.netifs():
netif.poshook = self.model.position_callback
if netif.node is not None:
x, y, z = netif.node.position.get()
netif.poshook(netif, x, y, z)
for netif in self.netifs():
if netif.poshook and netif.node:
x, y, z = netif.node.position.get()
netif.poshook(netif, x, y, z)
def all_link_data(self, flags):
"""