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

Unable to perform config changes via Python Script to WLC 9800

aihassan1
Frequent Visitor
Frequent Visitor

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

Mark Elsen
Hall of Fame
Hall of Fame

 

   - What problems are you encountering ?

 M.



-- Let everything happen to you  
       Beauty and terror
      Just keep going    
       No feeling is final
Reiner Maria Rilke (1899)

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}

 

HOW are you trying to configure the 9800 - CLI/netconf/restconf?

 

------------------------------
Please click Helpful if this post helped you and Accept as Solution if this answered your query.
------------------------------
TAC recommended codes for AireOS WLC's   and   TAC recommended codes for 9800 WLC's
Best Practices for AireOS WLC's,   Best Practices for 9800 WLC's   and   Cisco Wireless compatibility matrix
Check your 9800 WLC config with Wireless Config Analyzer using "show tech wireless" output or "config paging disable" then "show run-config" output on AireOS and use Wireless Debug Analyzer to analyze your WLC client debugs
Field Notice: FN63942 APs and WLCs Fail to Create CAPWAP Connections Due to Certificate Expiration
Field Notice: FN72424 Later Versions of WiFi 6 APs Fail to Join WLC - Software Upgrade Required
Field Notice: FN72524 IOS APs stuck in downloading state after 4 Dec 2022 due to Certificate Expired
- Fixed in 8.10.196.0, latest 9800 releases, 8.5.182.12 (8.5.182.13 for 3504) and 8.5.182.109 (IRCM, 8.5.182.111 for 3504)
Field Notice: FN70479 AP Fails to Join or Joins with 1 Radio due to Country Mismatch, RMA needed
Field Notice: FN74383 APs Running 17.12.4/5/6/6a May Run Out of Flash Space Preventing Upgrades
How to avoid boot loop due to corrupted image on Wave 2 and Catalyst 11ax Access Points (CSCvx32806)
Field Notice: FN74035 - Wave2 APs DFS May Not Detect Radar After Channel Availability Check Time
Leo's list of bugs affecting 2800/3800/4800/1560 APs
Default AP console baud rate from 17.12.x is 115200 - introduced by CSCwe88390

aihassan1
Frequent Visitor
Frequent Visitor

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

 

------------------------------
Please click Helpful if this post helped you and Accept as Solution if this answered your query.
------------------------------
TAC recommended codes for AireOS WLC's   and   TAC recommended codes for 9800 WLC's
Best Practices for AireOS WLC's,   Best Practices for 9800 WLC's   and   Cisco Wireless compatibility matrix
Check your 9800 WLC config with Wireless Config Analyzer using "show tech wireless" output or "config paging disable" then "show run-config" output on AireOS and use Wireless Debug Analyzer to analyze your WLC client debugs
Field Notice: FN63942 APs and WLCs Fail to Create CAPWAP Connections Due to Certificate Expiration
Field Notice: FN72424 Later Versions of WiFi 6 APs Fail to Join WLC - Software Upgrade Required
Field Notice: FN72524 IOS APs stuck in downloading state after 4 Dec 2022 due to Certificate Expired
- Fixed in 8.10.196.0, latest 9800 releases, 8.5.182.12 (8.5.182.13 for 3504) and 8.5.182.109 (IRCM, 8.5.182.111 for 3504)
Field Notice: FN70479 AP Fails to Join or Joins with 1 Radio due to Country Mismatch, RMA needed
Field Notice: FN74383 APs Running 17.12.4/5/6/6a May Run Out of Flash Space Preventing Upgrades
How to avoid boot loop due to corrupted image on Wave 2 and Catalyst 11ax Access Points (CSCvx32806)
Field Notice: FN74035 - Wave2 APs DFS May Not Detect Radar After Channel Availability Check Time
Leo's list of bugs affecting 2800/3800/4800/1560 APs
Default AP console baud rate from 17.12.x is 115200 - introduced by CSCwe88390

aihassan1
Frequent Visitor
Frequent Visitor

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.

 

------------------------------
Please click Helpful if this post helped you and Accept as Solution if this answered your query.
------------------------------
TAC recommended codes for AireOS WLC's   and   TAC recommended codes for 9800 WLC's
Best Practices for AireOS WLC's,   Best Practices for 9800 WLC's   and   Cisco Wireless compatibility matrix
Check your 9800 WLC config with Wireless Config Analyzer using "show tech wireless" output or "config paging disable" then "show run-config" output on AireOS and use Wireless Debug Analyzer to analyze your WLC client debugs
Field Notice: FN63942 APs and WLCs Fail to Create CAPWAP Connections Due to Certificate Expiration
Field Notice: FN72424 Later Versions of WiFi 6 APs Fail to Join WLC - Software Upgrade Required
Field Notice: FN72524 IOS APs stuck in downloading state after 4 Dec 2022 due to Certificate Expired
- Fixed in 8.10.196.0, latest 9800 releases, 8.5.182.12 (8.5.182.13 for 3504) and 8.5.182.109 (IRCM, 8.5.182.111 for 3504)
Field Notice: FN70479 AP Fails to Join or Joins with 1 Radio due to Country Mismatch, RMA needed
Field Notice: FN74383 APs Running 17.12.4/5/6/6a May Run Out of Flash Space Preventing Upgrades
How to avoid boot loop due to corrupted image on Wave 2 and Catalyst 11ax Access Points (CSCvx32806)
Field Notice: FN74035 - Wave2 APs DFS May Not Detect Radar After Channel Availability Check Time
Leo's list of bugs affecting 2800/3800/4800/1560 APs
Default AP console baud rate from 17.12.x is 115200 - introduced by CSCwe88390

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.

 

------------------------------
Please click Helpful if this post helped you and Accept as Solution if this answered your query.
------------------------------
TAC recommended codes for AireOS WLC's   and   TAC recommended codes for 9800 WLC's
Best Practices for AireOS WLC's,   Best Practices for 9800 WLC's   and   Cisco Wireless compatibility matrix
Check your 9800 WLC config with Wireless Config Analyzer using "show tech wireless" output or "config paging disable" then "show run-config" output on AireOS and use Wireless Debug Analyzer to analyze your WLC client debugs
Field Notice: FN63942 APs and WLCs Fail to Create CAPWAP Connections Due to Certificate Expiration
Field Notice: FN72424 Later Versions of WiFi 6 APs Fail to Join WLC - Software Upgrade Required
Field Notice: FN72524 IOS APs stuck in downloading state after 4 Dec 2022 due to Certificate Expired
- Fixed in 8.10.196.0, latest 9800 releases, 8.5.182.12 (8.5.182.13 for 3504) and 8.5.182.109 (IRCM, 8.5.182.111 for 3504)
Field Notice: FN70479 AP Fails to Join or Joins with 1 Radio due to Country Mismatch, RMA needed
Field Notice: FN74383 APs Running 17.12.4/5/6/6a May Run Out of Flash Space Preventing Upgrades
How to avoid boot loop due to corrupted image on Wave 2 and Catalyst 11ax Access Points (CSCvx32806)
Field Notice: FN74035 - Wave2 APs DFS May Not Detect Radar After Channel Availability Check Time
Leo's list of bugs affecting 2800/3800/4800/1560 APs
Default AP console baud rate from 17.12.x is 115200 - introduced by CSCwe88390
Review Cisco Networking for a $25 gift card