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

There is a parsing error when data model yang file contains a self namespace prefix

twinstiger2
Level 1
Level 1

I've tried a sample python script like the following and one of my yang file uses a self namespace prefix as follows;  And it seems to produce parsing error.   When I modified mdsif prefix to com:gemds:mds-interfaces , then it works.   Does anyone has a clue how to fix this?   Thanks in advance...

**************  Yang file ********************************

module mds-interfaces {
  namespace "com:gemds:mds-interfaces";
  prefix mdsif;

... more ...

  identity ethernet {
    base if:interface-type;
    description
      "Ethernet port.";
  }

... more ...

  augment "/if:interfaces-state/if:interface" {

    when "if:type = 'mdsif:ethernet'";

  }

******************* start of python script *******************************

from ydk.path import NetconfSession

from ydk.path import Codec

from ydk.types import EncodingFormat

import logging

 

log = logging.getLogger('ydk') 

log.setLevel(logging.INFO) 

handler = logging.StreamHandler() 

log.addHandler(handler)

 

session = NetconfSession('192.168.1.90', 'admin', 'admin')

root_schema = session.get_root_schema()

codec_service = Codec()  

get_rpc = root_schema.create_rpc('ietf-netconf:get-config')

 

get_rpc.get_input_node().create_datanode('source/running')

 

get_rpc(session)

 

************  some debug outputs ************************************************

=============Generating payload to send 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>
</get-config>
</rpc>

=============Reply payload received from device=============

<?xml version="1.0" encoding="UTF-8"?>

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="23">

  <data>

    <logging xmlns="com:gemds:mds-logging">

      <event-rule>

        <name>internal_software_warning</name>

        <local>true</local>

        <alarm>true</alarm>

      </event-rule>

      <default-event-rule>

        <name>LN_cal</name>

        <description>NIC calibration alert</description>

        <local>true</local>

        <priority>alert</priority>

        <syslog-facility>user</syslog-facility>

        <syslog>true</syslog>

        <snmp-notification>true</snmp-notification>

... more ...

Data is invalid according to the yang model. Error details: Invalid value "mdsif:ethernet" in "type" element. Path: '/ietf-interfaces:interfaces/interface[name='ETH1']/type'

Data is invalid according to the yang model. Error details: Invalid value "mdsif:ethernet" in "type" element. Path: '/ietf-interfaces:interfaces/interface[name='ETH1']/type'

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

RuntimeError: YModelError: Invalid value "mdsif:ethernet" in "type" element. Path: /ietf-interfaces:interfaces/interface[name='ETH1']/type

0 Replies 0
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: