11-24-2022 02:40 AM
Hi,
I am working on a script that can create and delete VLANs on Catalyst 9000 series switches through NETCONF. Using the cisco-ios-xe-native YANG module, I am able to deploy the VLAN through the VLAN -> VLAN-list -> ID element.
However, once I try to revert the configuration I get the following error (output is from YANG-Suite, but I've also tried through a script and get the same result):
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:7fe08623-bed3-4130-8ad6-a416c19b037d"><rpc-error> <error-type>application</error-type> <error-tag>data-missing</error-tag> <error-severity>error</error-severity> <error-path xmlns:ios-vlan="http://cisco.com/ns/yang/Cisco-IOS-XE-vlan" xmlns:ios="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> /nc:rpc/nc:edit-config/nc:config/ios:native/ios:vlan/ios-vlan:vlan-list[ios-vlan:id='511'] </error-path><error-info><bad-element>vlan-list</bad-element> </error-info> </rpc-error> </rpc-reply>
The RPC request is structured like this:
<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:7fe08623-bed3-4130-8ad6-a416c19b037d"> <nc:edit-config> <nc:target> <nc:running/> </nc:target> <nc:config> <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"> <vlan> <vlan-list xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-vlan" nc:operation="delete"> <id>511</id> </vlan-list> </vlan> </native> </nc:config> </nc:edit-config> </nc:rpc>
Any clues?
- Johnny
11-25-2022 09:17 AM
@Johnny Karms Pedersen this is a guess, what mode of VTP is your switch in (show vtp status)?
11-25-2022 12:04 PM
It’s in mode server. I’m guessing that it fails as VTP server doesn’t contain the VLANs in the running config?
11-25-2022 12:49 PM
@Johnny Karms Pedersen this is my guess yes, try this with the switch in transparent mode.
11-25-2022 08:03 PM
You got delete flag on wrong attribute. It should be:
<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:7fe08623-bed3-4130-8ad6-a416c19b037d"> <nc:edit-config> <nc:target> <nc:running/> </nc:target> <nc:config> <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"> <vlan> <vlan-list xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-vlan"> <id nc:operation="delete">511</id> </vlan-list> </vlan> </native> </nc:config> </nc:edit-config> </nc:rpc>
12-05-2022 08:22 AM
"vlan-list" is a list node and "id" is the key to the list. The proper way to delete a list entry is to apply the delete to the list and provide the key. The rpc looks correct. Is the "candidate" datastore configured? Does the 511 vlan exist in the show command after applying to edit-config? Can you manually delete it from the CLI without errors? Does a "remove" work?
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: