Skip to content

parameters updating acs device may have short life #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions acs/models/acs_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,34 @@ def update_acs_parameters(self, attributes_rpc_response):
root = etree.Element("DjangoAcsParameterCache")
### loop through all params in valuesrequest
paramcount = 0
param_omitted_count = 0
for param in values_rpc_response.soap_body.find('cwmp:GetParameterValuesResponse', acs_session.soap_namespaces).find('ParameterList').getchildren():
paramname = param.xpath("Name")[0].text
paramcount += 1

writable = etree.Element("Writable")
if paramname in writabledict:
# not all params have a lifetime that lasts until values are retrieved
# in which case they are omitted
if paramname in attributedict:
writable = etree.Element("Writable")
# add writable value if we can find it
writable.text = writabledict[paramname]
param.append(writable)
if paramname in writabledict:
writable.text = writabledict[paramname]
param.append(writable)

# append acl and notification (and any future attributes that may appear) to our tree
for attrib in attributedict[paramname]:
param.append(attrib)
# append acl and notification (and any future attributes that may appear) to our tree
for attrib in attributedict[paramname]:
param.append(attrib)

# append this to the tree
root.append(param)
# append this to the tree
root.append(param)
else:
param_omitted_count += 1

### alright, save the tree
self.acs_parameters = etree.tostring(root, xml_declaration=True).decode('utf-8')
self.acs_parameters_time = timezone.now()
self.save()
acs_session.acs_log("Finished processing %s acs parameters for device %s" % (paramcount, self))
acs_session.acs_log("Finished processing %s acs parameters (%s parameters omitted) for device %s" % (paramcount, param_omitted_count, self))
return True

@property
Expand Down