cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
179
Views
0
Helpful
3
Replies
Highlighted
Beginner

JunOS openconfig interfaces read errors

Hello Community colleagues!

 

Wondering if anyone is experiencing the same errors when trying to read with ydk-py with an OC Interfaces filter from a JunOS (MX 19.4)

 

Seems to me that unlike the IOS-XR devices i've tried before this, JunOS  have some openconfig model representation mismatch with the YDK bundle, at least for the addresses element within interfaces. Also, unlike IOS-XR they don't list the OC yang models in the capabilities list when opening the netconf session which also creates other issues for writing config as well... I've managed to solve that by using pre-defined OC Repository() objects, but this doesn't seem to apply for read ...

 

For the read part this is what I'm trying initially:

 

>>> from ydk.services import NetconfService
>>> from ydk.types import Filter
>>> from ydk.models.openconfig.openconfig_interfaces import Interfaces as oci
>>> from ydk.models.openconfig import openconfig_network_instance as oc_netins
>>> netconf = NetconfService()
>>> ifaces_filt= oci()
>>> filters = Filter(ifaces_filt)
>>> crud = CRUDService()
>>> netconf_output = crud.read_config(provider, filters)

 

And this is the response:

 

2020-09-08 09:04:15,261 - ydk - INFO - Executing CRUD read operation on [openconfig-interfaces:interfaces]
2020-09-08 09:04:15,261 - ydk - INFO - Executing 'get-config' RPC on [openconfig-interfaces:interfaces] from running
2020-09-08 09:04:15,262 - ydk - INFO - ============= Sending RPC to device =============
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <source>
    <running/>
  </source>
  <filter><interfaces xmlns="http://openconfig.net/yang/interfaces"/></filter>
</get-config>
</rpc>
2020-09-08 09:04:15,365 - ydk - INFO - ============= Received RPC from device =============
<?xml version="1.0"?>
<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.4R0/junos" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="12">
  <nc:data>
    <interfaces xmlns="http://openconfig.net/yang/interfaces">
      <interface>
        <name>fxp0</name>
        <config>
          <name>fxp0</name>
          <type>ianaift:ethernetCsmacd</type>
          <description/>
          <enabled>true</enabled>
        </config>
        <subinterfaces>
          <subinterface>
            <index>0</index>
            <config>
              <index>0</index>
            </config>
            <ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
              <addresses>
                <address>
                  <ip>10.1.1.5</ip>
                  <config>
                    <ip>10.1.1.5</ip>
                    <prefix-length>24</prefix-length>
                  </config>
                </address>
              </addresses>
            </ipv4>
          </subinterface>
        </subinterfaces>
      </interface>
      <interface>
        <name>ge-0/0/0</name>
        <config>
          <name>ge-0/0/0</name>
          <type>ianaift:ethernetCsmacd</type>
          <mtu>1514</mtu>
          <description>ge-0/0/0 test</description>
          <enabled>true</enabled>
        </config>
        <subinterfaces>
          <subinterface>
            <index>0</index>
            <config>
              <index>0</index>
            </config>
            <ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
              <addresses>
                <address>
                  <ip>192.168.2.1</ip>
                  <config>
                    <ip>192.168.2.1</ip>
                    <prefix-length>27</prefix-length>
                  </config>
                </address>
              </addresses>
            </ipv4>
          </subinterface>
        </subinterfaces>
      </interface>
      <interface>
        <name>lo0</name>
        <config>
          <name>lo0</name>
          <type>ianaift:softwareLoopback</type>
          <description/>
          <enabled>true</enabled>
        </config>
        <subinterfaces>
          <subinterface>
            <index>0</index>
            <config>
              <index>0</index>
            </config>
            <ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
              <addresses>
                <address>
                  <ip>192.168.1.101</ip>
                  <config>
                    <ip>192.168.1.101</ip>
                    <prefix-length>32</prefix-length>
                  </config>
                </address>
              </addresses>
            </ipv4>
          </subinterface>
        </subinterfaces>
      </interface>
    </interfaces>
  </nc:data>
</nc:rpc-reply>

2020-09-08 09:04:15,373 - ydk - ERROR - Cannot find model with module name '//openconfig.net/yang/interfaces/ip'
2020-09-08 09:04:15,375 - ydk - ERROR - Data is invalid according to the yang model. Libyang error: Data model "//openconfig.net/yang/interfaces/ip" not found.
2020-09-08 09:04:15,381 - ydk - ERROR - Cannot find model with module name '//openconfig.net/yang/interfaces'
2020-09-08 09:04:15,381 - ydk - ERROR - Data is invalid according to the yang model. Libyang error: Data model "//openconfig.net/yang/interfaces" not found.

If instead of using crud.read_config() I switch to crud.read() I'd get this RPC response:

2020-09-08 09:03:36,630 - ydk - INFO - Executing CRUD read operation on [openconfig-interfaces:interfaces]
2020-09-08 09:03:36,637 - ydk - INFO - Executing 'get' RPC on [openconfig-interfaces:interfaces]
2020-09-08 09:03:36,639 - ydk - INFO - ============= Sending RPC to device =============
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <filter><interfaces xmlns="http://openconfig.net/yang/interfaces"/></filter>
</get>
</rpc>
2020-09-08 09:03:36,651 - ydk - INFO - ============= Received RPC from device =============
<?xml version="1.0"?>
<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.4R0/junos" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
  <nc:rpc-error>
    <nc:error-type>protocol</nc:error-type>
    <nc:error-tag>operation-failed</nc:error-tag>
    <nc:error-severity>error</nc:error-severity>
    <nc:error-message>syntax error</nc:error-message>
    <nc:error-info>
      <nc:bad-element>interfaces</nc:bad-element>
    </nc:error-info>
  </nc:rpc-error>
</nc:rpc-reply>

Below is the details of my python environment:

 

Python 3.7.7
ydk                     0.8.4
ydk-models-cisco-ios-xr 6.6.3
ydk-models-ietf         0.1.5.post2
ydk-models-openconfig   0.1.8

 

 

Cheers,

Mauro

3 REPLIES 3
Highlighted
Participant

The root cause of the issue is that Openconfig modules are missing in the Junos device capabilities and the YDK does not have means to translate namespace "http://openconfig.net/yang/interfaces/ip" to module name, and therefore cannot import it to the YANG schema. I also got across similar issue where I needed expand device capabilities and lookup table. Unfortunately I could not solve it either. This issue requires new development on the YDK side.

Yan Gorelik
YDK Solutions
Highlighted

Thanks Yan for the reply,

 

I tried asking Juniper support and they mentioned RFC6022 that as long as ietf-netconf-monitoring is advertised as capability the netconf client should be able to retrieve the the schema ...

https://tools.ietf.org/html/rfc6022#section-4.1

 

Could this issue be related with https://github.com/CiscoDevNet/ydk-gen/issues/737 , or something else? I could raise another github issue if needed ...

 

I would like to help, in any possible way, in getting this feature fixed/introduced if possible as we want to push the use of YDK overall

 

Cheers

Mauro

Highlighted

Hi Mauro

You are correct. That is the open issue #737. In order to resolve it, the YDK API must be extended with capability to add user defined lookup table to already allocated one, based on device capabilities. I definitely can help with this issue and open to any logistics discussions. Let's connect over private messaging for further communications.

Yan Gorelik
YDK Solutions
This widget could not be displayed.