12-07-2021 03:43 PM
Hello,
I'm Unable to perform config changes via Python Script to WLC 9800 on 17.x.x code. However, this works correctly when WLC is on 16.x.x code. Is there a known issue with this and possible fix in place?
Thanks
12-08-2021 12:10 AM
- What problems are you encountering ?
M.
12-08-2021 05:57 AM
These are the errors I'm getting: Scripts are good since it works for 16.3.5 code but does not work on any code on 17.4.x or 17.6.x
Traceback (most recent call last):
File "c:\Python\WT-Cisco\create-wlan-profile.py", line 31, in <module>
result = m.edit_config(target="running", config=new_wlan_profile)
File "C:\Python\WT-Cisco\WT-Cisco\lib\site-packages\ncclient\manager.py", line 246, in execute
return cls(self._session,
File "C:\Python\WT-Cisco\WT-Cisco\lib\site-packages\ncclient\operations\edit.py", line 75, in request
return self._request(node)
File "C:\Python\WT-Cisco\WT-Cisco\lib\site-packages\ncclient\operations\rpc.py", line 375, in _request
raise self._reply.error
ncclient.operations.rpc.RPCError: {'type': 'protocol', 'tag': 'unknown-element', 'app_tag': None, 'severity': 'error', 'info': '<?xml version="1.="1.0" encoding="UTF-8"?><error-info xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><bad-ent>0" encoding="UTF-8"?><error-info xmlns="urn:ietf:paramselement>config</bad-element>\n</error-info>\n', 'path': '\n /rpc/edit-config\n ', 'message': None}
12-08-2021 06:00 AM
HOW are you trying to configure the 9800 - CLI/netconf/restconf?
12-08-2021 06:31 AM - edited 10-05-2022 04:27 AM
I activated netconf GUI and pulled down XML data. I then took that XML data and wrapped it in a Python script. The script is below. When I run the python script (venv or not) to a 9800 WLC on 17.4.x or 17.6.x code I get errors (listed on my previous post).
This is a test script for now (pulled from a fellow wireless engineer resource) that has led me to WLC code discrepancy between 16.x.x and 17.x.x
#Import Dependencies
from ncclient import manager
from jinja2 import Template
# NETCONF Connection Manager
m = manager.connect(host='x.x.x.', port=830, username='username',
password='password', device_params={'name': 'iosxe'})
MACAddress = 'MAC ADDRESS'
# Render Jinja Template, we going to update add a static mapping for an AP to its Tags
tags_template = Template(open('updateap.xml').read())
tags_rendered = tags_template.render(
MAC_ADDRESS= MACAddress,
POLICY_TAG= 'PolicyTag1',
SITE_TAG= 'FlexSite1',
RF_TAG= 'test-RF'
)
# Execute the netconf update to the device
result = m.edit_config(target='running', config=tags_rendered)
12-08-2021 08:19 AM
You know you need to update your yang model for each new release right?
There can be changes between each release.
https://github.com/YangModels/yang/tree/master/vendor/cisco/xe
12-08-2021 12:51 PM
Understood. The correct YANG model is updated to the WLC. The problem here seems to be a communication issue from the ncclient to the WLC on 17.x.x code when executing a python script.
from ncclient import manager
Found the following message board highlighting a similar issue.
12-08-2021 04:29 PM
It's not the Yang model on the WLC that needs updating - that's built into IOS-XE.
You need to update YOUR scripts to match the Yang data model for that release.
We have restconf (which uses the same data models) working fine on 17.6.1.
12-08-2021 04:31 PM
And that link you provided answers your question for you - you need to update the structure of your netconf request to make it work.
Note: You will need to re-validate your scripts, and update them if necessary, for every new release you use.
Your pre-deployment testing should include a full regression test of any scripts you're using.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide