cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
963
Views
11
Helpful
12
Replies

Can not create transceiver type using YDK

vaniat
Beginner
Beginner

I am trying to configure "transceiver type all monitoring" using ydk but I get RPC error. I don't think this is YDK related though. Here is XML I sent to device and response I get:

<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><native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <hostname>MYXXX-ASW001</hostname>
  <memory>
    <free>
      <low-watermark>
        <processor>290488</processor>
      </low-watermark>
    </free>
  </memory>
  <service>
    <password-encryption/>
    <unsupported-transceiver/>
  </service>
  <platform>
    <punt-keepalive xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-platform">
      <disable-kernel-core>false</disable-kernel-core>
    </punt-keepalive>
  </platform>
  <archive>
    <log>
      <config>
        <hidekeys/>
        <logging>
          <enable/>
        </logging>
        <notify>
          <syslog>
            <contenttype>plaintext</contenttype>
          </syslog>
        </notify>
      </config>
    </log>
  </archive>
  <ip>
    <source-route>false</source-route>
    <domain>
      <lookup>false</lookup>
      <name>MYXXX.COM</name>
    </domain>
    <gratuitous-arps-conf>
      <gratuitous-arps>false</gratuitous-arps>
    </gratuitous-arps-conf>
    <name-server>
      <no-vrf>10.10.1.1</no-vrf>
    </name-server>
    <routing-conf>
      <routing>false</routing>
    </routing-conf>
    <multicast-routing xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-multicast" nc:operation="remove"/>
    <http xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-http">
      <server>false</server>
    </http>
  </ip>
  <cdp>
    <run xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-cdp"/>
  </cdp>
  <logging>
    <buffered>
      <size-value>16000</size-value>
      <severity-level>warnings</severity-level>
    </buffered>
    <console>
      <severity>critical</severity>
    </console>
  </logging>
  <aaa>
    <authentication xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-aaa">
      <login>
        <name>default</name>
        <a1>
          <local/>
        </a1>
      </login>
      <login>
        <name>console</name>
        <a1>
          <local/>
        </a1>
      </login>
    </authentication>
  </aaa>
  <login>
    <on-failure>
      <log/>
    </on-failure>
    <on-success>
      <log/>
    </on-success>
  </login>
  <spanning-tree>
    <mode xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-spanning-tree">rapid-pvst</mode>
    <extend xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-spanning-tree">
      <system-id/>
    </extend>
  </spanning-tree>
  <vtp>
    <mode xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-vtp">
      <off/>
    </mode>
  </vtp>
  <port-channel>
    <load-balance xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ethernet">
      <load-balance>src-dst-ip</load-balance>
    </load-balance>
  </port-channel>
  <system>
    <mtu xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-switch">
      <size>9000</size>
    </mtu>
  </system>
  <errdisable>
    <detect>
      <cause>
        <gbic-invalid nc:operation="remove"/>
      </cause>
    </detect>
  </errdisable>
  <transceiver>
    <type>
      <all nc:operation="create">
        <monitoring nc:operation="create"/>
      </all>
    </type>
  </transceiver>
  <ntp>
    <server xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ntp">
      <server-list>
        <ip-address>10.10.7.10</ip-address>
      </server-list>
      <server-list>
        <ip-address>10.10.4.10</ip-address>
      </server-list>
      <server-list>
        <ip-address>10.10.4.11</ip-address>
      </server-list>
    </server>
  </ntp>
  <lldp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-lldp">
    <run/>
  </lldp>
  <diagnostic xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-diagnostics">
    <bootup>
      <level>complete</level>
    </bootup>
  </diagnostic>
</native>
</config>
</edit-config>
</rpc>

And I get back:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="7">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>unknown-element</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:ios="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    /nc:rpc/nc:edit-config/nc:config/ios:native/ios:transceiver
  </error-path>
    <error-info>
      <bad-element>transceiver</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>
1 Accepted Solution

Accepted Solutions

I've looked at the YANG model for release 17.7.1 (the 17.6.4 is yet to be published) and noted this:

    container transceiver {
      if-feature "ios-features:transceiver";

 That means the feature must be enabled on the device. Please check the device capabilities before applying this model. I guess it is not enabled, hence the error 'bad-element'.

View solution in original post

12 Replies 12

Marcel Zehnder
Spotlight
Spotlight

Change the ns in your native and config tags:

Is:

 

 

<config>
<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
...
</native>
</config>

 

 


Should:

 

 

<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
...
</native>
</config>

 

 

HTH


vaniat
Beginner
Beginner

Hi Marcel,

I am using ydk-gen kit to generate the RPC's. It only fails on transceiver part. If I remove that XML, rest of config is applied correctly?

Here is how I create it using ydk-gen:

native_config = Cisco_ISO_XE_native.Native()
native_config.transceiver.type.all = native_config.Transceiver.Type.All()
native_config.transceiver.type.all.yfilter = YFilter.create
native_config.transceiver.type.all.monitoring = native_config.Transceiver.Type.All.Monitoring()
native_config.transceiver.type.all.monitoring.yfilter = YFilter.create

Whats the platform, maybe there are no transceivers at all and therefore the call is failing?

vaniat
Beginner
Beginner

C9200L-24T-4X

When I execute them from terminal it works:

!
!
transceiver type all
 monitoring

The fact that you can configure transceiver in the CLI does not mean that YANG model and Netconf support this configuration.

What is the XE release number?

vaniat
Beginner
Beginner

17.6.4

I've looked at the YANG model for release 17.7.1 (the 17.6.4 is yet to be published) and noted this:

    container transceiver {
      if-feature "ios-features:transceiver";

 That means the feature must be enabled on the device. Please check the device capabilities before applying this model. I guess it is not enabled, hence the error 'bad-element'.

vaniat
Beginner
Beginner

I found this indeed:

Cisco-IOS-XE-native.yang:    container transceiver {
Cisco-IOS-XE-native.yang:      if-feature "ios-features:transceiver";

However when I list device capabilities, I seem to get only 

- http://cisco.com/ns/yang/Cisco-IOS-XE-transceiver-oper?module=Cisco-IOS-XE-transceiver-oper&revision=2020-03-01

I suppose this means it is not supported then? 

17.06.04 seems to be latest recommended Cisco release:

Screenshot 2023-01-19 at 11.23.25.png

Thant means my post was a solution. Please vote.

vaniat
Beginner
Beginner

I accepted it as solution but I don't see how to vote?

devoraharvey3
Beginner
Beginner

The error message you received indicates that the device is reporting an "unknown-element" error related to the <transceiver> element in your XML configuration. The device does not recognize the  element or does not support configuring it through the NETCONF interface.

To troubleshoot this issue, you can perform the following steps:

  1. Verify device capabilities: Ensure that the device you are targeting supports the configuration of transceivers through NETCONF. You can check the device's documentation or contact the manufacturer to confirm if this feature is supported and the correct YANG data models are available.

  2. Check YANG models: Validate that the YANG model associated with the device's native configuration supports the <transceiver> element. The error message suggests that the device does not recognize this element, so it's possible that it is not included in the YANG model or it has a different name.

  3. Consult device documentation: Review the device's documentation or configuration guides to understand if there is a specific method or API for configuring transceivers. It's possible that transceiver configuration requires a different approach or a specialized API that is not covered by the native YANG model.

By performing these steps, you should gain a better understanding of whether transceiver configuration is supported and how to correctly configure it using NETCONF or another appropriate method for your device. Understand the completely use of xml presets

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: