cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1254
Views
0
Helpful
8
Replies

Unable to perform config changes via Python Script to WLC 9800

aihassan1
Level 1
Level 1

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

8 Replies 8

marce1000
VIP
VIP

 

   - What problems are you encountering ?

 M.



-- ' 'Good body every evening' ' this sentence was once spotted on a logo at the entrance of a Weight Watchers Club !

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}

 

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)

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

 

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. 

 

https://community.cisco.com/t5/mobility-discussions/wlc98k-configure-ap-tags-through-netconf/td-p/4146361 

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.

 

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.

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card