Skip to content

iosxe_yang resource xml encoding key not being grabbed #372

@hexabyte8

Description

@hexabyte8

When using the iosxe_yang resource with Netconf set as the protocol, the xml that is generated seems to not put the key at the front of an entry, causing the device to return an error for the key.

This happens with multiple endpoints, I have copy/pasted an example below.

example.tf

resource "iosxe_yang" "wlan-config" {
  path     = "Cisco-IOS-XE-wireless-wlan-cfg:wlan-cfg-data/wlan-cfg-entries"
  for_each = toset([for wlc in local.wlcs : wlc.name])
  device   = each.key
  lists = [{
    name = "wlan-cfg-entry"
    key  = "profile-name"
    items = [
      {
        "profile-name"                   = "TEST"
        "wlan-id"                        = 1
        "authentication-list"            = "default"
        "apf-vap-id-data/broadcast-ssid" = false
        "apf-vap-id-data/ccx-aironet-ie" = true
        "apf-vap-id-data/ssid"           = "TEST"
        "mdns-sd-mode"                   = "mdns-sd-gateway"
      }
  }]
}

Example generated xml:

   <wlan-cfg-data xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-wireless-wlan-cfg">
     <wlan-cfg-entries>
       <wlan-cfg-entry>
         <apf-vap-id-data>
           <ccx-aironet-ie>true</ccx-aironet-ie>
           <ssid>TEST</ssid>
           <broadcast-ssid>false</broadcast-ssid>
         </apf-vap-id-data>
         <authentication-list>default</authentication-list>
         <mdns-sd-mode>mdns-sd-gateway</mdns-sd-mode>
         <profile-name>TEST</profile-name>
         <wlan-id>1</wlan-id>
       </wlan-cfg-entry>
     </wlan-cfg-entries>
   </wlan-cfg-data>

and returned:

   <rpc-error>
  
     <error-type>application</error-type>
  
     <error-tag>missing-element</error-tag>
  
     <error-severity>error</error-severity>
  
     <error-path xmlns:_xmlns="xmlns" _xmlns:wireless-wlan-cfg="http://cisco.com/ns/yang/Cisco-IOS-XE-wireless-wlan-cfg" _xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
       /nc:rpc/nc:edit-config/nc:config/wireless-wlan-cfg:wlan-cfg-data/wireless-wlan-cfg:wlan-cfg-entries/wireless-wlan-cfg:wlan-cfg-entry
     </error-path>
     <error-message xml:lang="en">expected tag: &#39;profile-name&#39;, got tag: &#39;apf-vap-id-data&#39;</error-message>
     <error-info>
       <bad-element>profile-name</bad-element>
  
     </error-info>
  
   </rpc-error>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions