cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
735
Views
5
Helpful
3
Replies

ietf-interface and CIsco-IOS-XE-native which one is suitable for C9k IOS 16.12.05b

Hello Boss,

 

Please kindly see the question below.

 

   Question is here,  I can get the data with filter1 but I am not able to get anything with filter2.
I'd like to know what's the scenario we use  ietf-interface and what's the situation we use Cisco-IOS-XE-native (sub module interface)

 

interface_filter1 = """
<filter>
  <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
    <interface>
      <name>{int_name}</name>
    </interface>
  </interfaces>
</filter>
"""

interface_filter2 = """
    <filter>
      <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <interface>
          <TwoGigabitEthernet>
            <name>{int_name}</name>
            <media-type/>
          </TwoGigabitEthernet>
        </interface>
      </native>
    </filter>
"""



# Open NETCONF connection to device
with manager.connect(host = "1.1.1.2",
                     port = 830,
                     username = "admin",
                     password = "cisco",
                     hostkey_verify = Falseas m:
 
   Question is here,  I can get the data with filter1 but I am not able to get anything with filter2.
I'd like to know what's the scenario we use  ietf-interface and what's the situation we use Cisco-IOS-XE-native (sub module interface)
    # Create desired NETCONF filter and <get-config>
    filter = interface_filter1.format(int_name = "TwoGigabitEthernet1/0/10")
    filter = interface_filter2.format(int_name = "TwoGigabitEthernet1/0/10") 
 
    r = m.get_config("running"filter)
 
   

    # Pretty print raw xml to screen
    xml_doc = minidom.parseString(r.xml)
    print(xml_doc.toprettyxml(indent = "  "))
 
 
 
Jacky Zhang
Global Telecom
3 Replies 3

yangorelik
Spotlight
Spotlight

Hi Jacky

You got wrong tag name 'TwoGigabitEthernet'; should be 'twogigabitethernet' according to the YANG model.

Suggest to read documentation here.

Yan Gorelik
YDK Solutions

Hi Yan,

 

I tried it but it still doesn't work for "CIsco-IOS-XE-native" but it works for "ieft-interfaces" and "openconfig-interfaces"

 

It works means I can get the data from the switch.  It doesn't work means nothing data from the reply.

 

Please see the log below. 

 

Waiting for Data...
No session found. Creating a new temporary session
Sending:
<nc:hello xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">...</nc:hello>
]]>]]>
Received message from host
initialized: session-id=101 | server_capabilities=<dict_keyiterator object at 0x7f1070892950>
NETCONF CONNECTED 1.1.1.254:830
NETCONF SEND rpc
Requesting 'Dispatch'
Sending:

#524
<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:3b450594-0156-4372-a521-2b65aca2c757"><nc:get-config>
    <nc:source>
      <nc:running/>
    </nc:source>
    <nc:filter>
      <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <interface>
          <twogigabitethernet>
            <name>TwoGigabitEthernet1/0/10</name>
          </twogigabitethernet>
        </interface>
      </native>
    </nc:filter>
  </nc:get-config>
</nc:rpc>

##
Received message from host
<?xml version="1.0" ?>
<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:3b450594-0156-4372-a521-2b65aca2c757">
  <data/>
</rpc-reply>
NETCONF rpc COMPLETE
Requesting 'CloseSession'
Sending:

#184
<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:1ae653a5-527b-4d54-8d74-3bb7e726311c">
  <nc:close-session/>
</nc:rpc>

##
Received message from host
NETCONF DISCONNECT 

 

 

 

 

Received message from host

 

Jacky Zhang
Global Telecom

Hi Jacky

Based on the Netconf response, the interface with name TwoGigabitEthernet1/0/10 is not present in the router configuration. I suggest before trying to get specific interface, retrieve all the interfaces by sending RPC:

<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:3b450594-0156-4372-a521-2b65aca2c757"><nc:get-config>
    <nc:source>
      <nc:running/>
    </nc:source>
    <nc:filter>
      <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <interface />
      </native>
    </nc:filter>
  </nc:get-config>
</nc:rpc>

If you still get empty data tag, then native model is not implemented or disabled on this router. You also might check Netconf capabilities to make sure that native model is supported.

BTW, what tool do you use to send RPCs. I guess it is not YDK.

Yan Gorelik
YDK Solutions