Showing results for 
Search instead for 
Did you mean: 

IOS-XE openconfg_interfaces error




I am attempting to push a basic openconfig-interfaces configuration to an IOS-XE(version 16.9.4) device using YDK, and the model is rendering properly but the device is rejecting the configuration with the following error:


<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3">
    <error-path xmlns:oc-vlan="" xmlns:oc-eth="" xmlns:oc-if="">                                                            
    <error-message xml:lang="en">/oc-if:interfaces/interface[name='GigabitEthernet1/0/1']/oc-eth:ethernet/oc-vlan:switched-vlan/config/access-vlan: Runtime mapping error.</error-message>                                                    

This error only occurs when I try and commit the candidate -- if I do a validate, the RPC comes back with an 'ok'.  Here's the actual NETCONF payload I am sending:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">                                                                                                                             
  <config><interfaces xmlns="">                                                                                                                                                                           
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>                                                                                                                                             
    <ethernet xmlns="">                                                                                                                                                                          
      <switched-vlan xmlns="">                                                                                                                                                                                  

 Can anyone tell me if I'm missing something here?  I've tried using a merge operation, or no explicit operation at all but the behavior is unchanged.

10 Replies 10

Cisco Employee
Cisco Employee

This doesn't really seem like an issue with YDK.  It points to a model mapping issue on the XE device.  I'll check to see if there's a workaround.

This issue mysteriously resolved itself when I started working on it again this morning, were you able to reproduce this?

This has started happening again after sitting idle over the weekend.

Could you please post your script and python environment (pip list | grep ydk).

Yan Gorelik
YDK Solutions

Sure, here's my environment:

root@ba46e77e2368:~/ydk-py/persist# pip list | grep ydk
ydk                     0.8.4      
ydk-models-cisco-ios-xe 16.9.3     
ydk-models-cisco-nx-os  9.3.3      
ydk-models-ietf         0.1.5.post2
ydk-models-openconfig   0.1.7 

...and the little script I'm testing with:

from import NetconfService, Datastore
from ydk.providers import NetconfServiceProvider
from ydk.models.openconfig import openconfig_interfaces, openconfig_vlan_types
from ydk.models.ietf import iana_if_type
from ydk.filters import YFilter

def build_oc_if(phys_port, descr, vlan_id):
    configures an openconfig interface model

    :param port: interface name, e.g. Gi0/0/0
    :param descr: interface description
    :param vlan_id: VLAN id number
    interfaces = openconfig_interfaces.Interfaces() = phys_port
    i.config.type = iana_if_type.EthernetCsmacd() = phys_port
    i.config.description = descr
    i.ethernet.switched_vlan.config.interface_mode = \
    i.ethernet.switched_vlan.config.access_vlan = vlan_id

    return i

if __name__ == '__main__':
    import sys
    import logging
    from getpass import getpass

    log = logging.getLogger('ydk')
    handler = logging.StreamHandler()
    formatter = logging.Formatter(
            "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

    interface = build_oc_if("GigabitEthernet1/0/1", "TEST DESCRIPTION", 10)

    password = getpass(prompt="SSH password: ")
    nc = NetconfService()

    nc_provider = NetconfServiceProvider(

    interface.yfilter = YFilter.replace
    model = openconfig_interfaces.Interfaces()


    nc.validate(nc_provider, Datastore.candidate)



In the first post you noted that XE device version is 16.9.4, but in your environment the XE model version is 16.9.3. That could be the root cause of the issue, because models could be essentially different. Please upgrade you XE model bundle to 16.9.4 and repeat your script.

Yan Gorelik
YDK Solutions

Hi Yan, this is using the openconfig model bundle

I tried your script on XE sandbox and got the same error. I then realized that this could be due to limitation on usage of openconfig models on XE-16.9.x devices. Indeed, when I checked deviations, I found that configuration of vlan using openconfig models currently is not supported. Therefore for vlan configuration you should use native Cisco XE models.

Yan Gorelik
YDK Solutions


I found a similar situation with IOS XE and Openconfig BGP. I cannot create a new peer using openconfig-bgp model.

I can create the bgp process, I can update a peer, but I cannot create a new one, both via netconf and restconf.

The error I get is below. It complains about send-community configuration, which is optional. But it does not work even I do set define <send-community> in my request.

Interresting also is that I cannot retrieve the send-community configuration if I set it manually via CLI. 


<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
        <error-message>/network-instances/network-instance{default}/protocols/protocol{oc-pol-types:BGP 65111}/bgp/neighbors/neighbor{}/config/send-community: Runtime mapping error.</error-message>

My xml filter is below. It works (update the peer) if I create the peer first on CLI. 


<network-instance xmlns=""  xmlns:oc-netinst="">
            <identifier xmlns:oc-pol-types="">oc-pol-types:BGP</identifier>
                <identifier xmlns:oc-pol-types="">oc-pol-types:BGP</identifier>



The XML payload in your post does not pass simple validation test! That tells me, the payload was not generated by YDK. Its content does not look correct.

Yan Gorelik
YDK Solutions
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:

Recognize Your Peers