cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1605
Views
0
Helpful
10
Replies

IOS-XE openconfg_interfaces error

grundler
Level 1
Level 1

Hello,

 

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">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:oc-vlan="http://openconfig.net/yang/vlan" xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet" xmlns:oc-if="http://openconfig.net/yang/interfaces">                                                            
    /oc-if:interfaces/oc-if:interface[oc-if:name='GigabitEthernet1/0/1']/oc-eth:ethernet/oc-vlan:switched-vlan/oc-vlan:config/oc-vlan:access-vlan                                                                                             
  </error-path>
    <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>                                                    
    <error-info>
      <bad-element>access-vlan</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

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">                                                                                                                             
  <target>                                                                                                                                                                                                                                     
    <candidate/>                                                                                                                                                                                                                               
  </target>                                                                                                                                                                                                                                    
  <config><interfaces xmlns="http://openconfig.net/yang/interfaces">                                                                                                                                                                           
  <interface>                                                                                                                                                                                                                                  
    <name>GigabitEthernet1/0/1</name>                                                                                                                                                                                                          
    <config>                                                                                                                                                                                                                                   
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>                                                                                                                                             
      <name>GigabitEthernet1/0/1</name>                                                                                                                                                                                                        
      <description>TESTING</description>                                                                                                                                                                                                       
    </config>                                                                                                                                                                                                                                  
    <ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">                                                                                                                                                                          
      <switched-vlan xmlns="http://openconfig.net/yang/vlan">                                                                                                                                                                                  
        <config>                                                                                                                                                                                                                               
          <interface-mode>ACCESS</interface-mode>                                                                                                                                                                                              
          <access-vlan>10</access-vlan>                                                                                                                                                                                                        
        </config>                                                                                                                                                                                                                              
      </switched-vlan>                                                                                                                                                                                                                         
    </ethernet>                                                                                                                                                                                                                                
  </interface>                                                                                                                                                                                                                                 
</interfaces>                                                                                                                                                                                                                                  
</config>                                                                                                                                                                                                                                      
</edit-config>                                                                                                                                                                                                                                 
</rpc>  

 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

saalvare
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 ydk.services 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()
    i.name = phys_port
    i.config.type = iana_if_type.EthernetCsmacd()
    i.config.name = phys_port
    i.config.description = descr
    i.ethernet.switched_vlan.config.interface_mode = \
        openconfig_vlan_types.VlanModeType().ACCESS
    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')
    log.setLevel(logging.INFO)
    handler = logging.StreamHandler()
    formatter = logging.Formatter(
            "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
            )
    handler.setFormatter(formatter)
    log.addHandler(handler)

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

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

    nc_provider = NetconfServiceProvider(
        address=sys.argv[1],
        port=830,
        username='grundler',
        password=password)

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


    nc.edit_config(nc_provider,
                   Datastore.candidate,
                   model)

    nc.validate(nc_provider, Datastore.candidate)

    nc.commit(nc_provider)

    nc.close_session(nc_provider)

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

pauloroque
Level 1
Level 1

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>
        <error-message>/network-instances/network-instance{default}/protocols/protocol{oc-pol-types:BGP 65111}/bgp/neighbors/neighbor{1.1.1.2}/config/send-community: Runtime mapping error.</error-message>
        <error-path>/openconfig-network-instance:network-instances/network-instance</error-path>
        <error-tag>malformed-message</error-tag>
        <error-type>application</error-type>
    </error>
</errors>

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

 

<network-instance xmlns="http://openconfig.net/yang/network-instance"  xmlns:oc-netinst="http://openconfig.net/yang/network-instance">
    <name>default</name>
    <config>
        <name>default</name>
    </config>
    <protocols>
        <protocol>
            <identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:BGP</identifier>
            <name>65111</name>
            <config>
                <identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:BGP</identifier>
                <name>65111</name>
            </config>
            <bgp>
                <global>
                    <config>
                        <as>65111</as>
                    </config>
                </global>
			<neighbors>
  <neighbor>
    <neighbor-address>1.1.1.2</neighbor-address>
    <config>
      <neighbor-address>1.1.1.2</neighbor-address>
      <peer-as>65112</peer-as>

    </config>
    
</neighbor>
</neighbors>

 

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: