<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: custom error-message for datatypes in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806090#M3345</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Take a look at what was provided in RFC7950 - YANG:&lt;BR /&gt;&lt;BR /&gt;7.5.4.  The must's Substatements&lt;BR /&gt;&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;                 | substatement  | section | cardinality |&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;                 | description   | 7.21.3  | 0..1        |&lt;BR /&gt;                 | error-app-tag | 7.5.4.2 | 0..1        |&lt;BR /&gt;                 | error-message | 7.5.4.1 | 0..1        |&lt;BR /&gt;                 | reference     | 7.21.4  | 0..1        |&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;&lt;BR /&gt;7.5.4.1.  The "error-message" Statement&lt;BR /&gt;&lt;BR /&gt;   The "error-message" statement, which is optional, takes a string as&lt;BR /&gt;   an argument.  If the constraint evaluates to "false", the string is&lt;BR /&gt;   passed as &amp;lt;error-message&amp;gt; in the &amp;lt;rpc-error&amp;gt; in NETCONF.&lt;BR /&gt;&lt;BR /&gt;7.5.4.2.  The "error-app-tag" Statement&lt;BR /&gt;&lt;BR /&gt;   The "error-app-tag" statement, which is optional, takes a string as&lt;BR /&gt;   an argument.  If the constraint evaluates to "false", the string is&lt;BR /&gt;   passed as &amp;lt;error-app-tag&amp;gt; in the &amp;lt;rpc-error&amp;gt; in NETCONF.&lt;BR /&gt;&lt;BR /&gt;7.5.4.3.  Usage Example of must and error-message&lt;BR /&gt;&lt;BR /&gt;     container interface {&lt;BR /&gt;       leaf ifType {&lt;BR /&gt;         type enumeration {&lt;BR /&gt;           enum ethernet;&lt;BR /&gt;           enum atm;&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;       leaf ifMTU {&lt;BR /&gt;         type uint32;&lt;BR /&gt;       }&lt;BR /&gt;       must 'ifType != "ethernet" or ifMTU = 1500' {&lt;BR /&gt;         error-message "An Ethernet MTU must be 1500";&lt;BR /&gt;       }&lt;BR /&gt;       must 'ifType != "atm" or'&lt;BR /&gt;          + ' (ifMTU &amp;lt;= 17966 and ifMTU &amp;gt;= 64)' {&lt;BR /&gt;         error-message "An ATM MTU must be 64 .. 17966";&lt;BR /&gt;       }&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;10.3.1.1.  Usage Example&lt;BR /&gt;&lt;BR /&gt;     list interface {&lt;BR /&gt;       key "name type";&lt;BR /&gt;       leaf name { ... }&lt;BR /&gt;       leaf type { ... }&lt;BR /&gt;       leaf enabled {&lt;BR /&gt;         type boolean;&lt;BR /&gt;       }&lt;BR /&gt;       ...&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;     container mgmt-interface {&lt;BR /&gt;       leaf name {&lt;BR /&gt;         type leafref {&lt;BR /&gt;           path "/interface/name";&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;       leaf type {&lt;BR /&gt;         type leafref {&lt;BR /&gt;           path "/interface[name=current()/../name]/type";&lt;BR /&gt;         }&lt;BR /&gt;         must 'deref(.)/../enabled = "true"' {&lt;BR /&gt;           error-message&lt;BR /&gt;             "The management interface cannot be disabled.";&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It seems a string must be configured in order for 'error-message' to work. Are you trying to set certain restraints on the ipv4-address?</description>
    <pubDate>Wed, 20 Feb 2019 18:01:55 GMT</pubDate>
    <dc:creator>joepak</dc:creator>
    <dc:date>2019-02-20T18:01:55Z</dc:date>
    <item>
      <title>custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3805300#M3328</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to define custom error-message for data types in yang? For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;type inet:ipv4-address {&lt;BR /&gt; error-message "Invalid IPv4 address for loopback0";&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS - the above produces an error: unexpected keyword 'error-message'&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 21:17:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3805300#M3328</guid>
      <dc:creator>Iman1</dc:creator>
      <dc:date>2019-02-19T21:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806090#M3345</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Take a look at what was provided in RFC7950 - YANG:&lt;BR /&gt;&lt;BR /&gt;7.5.4.  The must's Substatements&lt;BR /&gt;&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;                 | substatement  | section | cardinality |&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;                 | description   | 7.21.3  | 0..1        |&lt;BR /&gt;                 | error-app-tag | 7.5.4.2 | 0..1        |&lt;BR /&gt;                 | error-message | 7.5.4.1 | 0..1        |&lt;BR /&gt;                 | reference     | 7.21.4  | 0..1        |&lt;BR /&gt;                 +---------------+---------+-------------+&lt;BR /&gt;&lt;BR /&gt;7.5.4.1.  The "error-message" Statement&lt;BR /&gt;&lt;BR /&gt;   The "error-message" statement, which is optional, takes a string as&lt;BR /&gt;   an argument.  If the constraint evaluates to "false", the string is&lt;BR /&gt;   passed as &amp;lt;error-message&amp;gt; in the &amp;lt;rpc-error&amp;gt; in NETCONF.&lt;BR /&gt;&lt;BR /&gt;7.5.4.2.  The "error-app-tag" Statement&lt;BR /&gt;&lt;BR /&gt;   The "error-app-tag" statement, which is optional, takes a string as&lt;BR /&gt;   an argument.  If the constraint evaluates to "false", the string is&lt;BR /&gt;   passed as &amp;lt;error-app-tag&amp;gt; in the &amp;lt;rpc-error&amp;gt; in NETCONF.&lt;BR /&gt;&lt;BR /&gt;7.5.4.3.  Usage Example of must and error-message&lt;BR /&gt;&lt;BR /&gt;     container interface {&lt;BR /&gt;       leaf ifType {&lt;BR /&gt;         type enumeration {&lt;BR /&gt;           enum ethernet;&lt;BR /&gt;           enum atm;&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;       leaf ifMTU {&lt;BR /&gt;         type uint32;&lt;BR /&gt;       }&lt;BR /&gt;       must 'ifType != "ethernet" or ifMTU = 1500' {&lt;BR /&gt;         error-message "An Ethernet MTU must be 1500";&lt;BR /&gt;       }&lt;BR /&gt;       must 'ifType != "atm" or'&lt;BR /&gt;          + ' (ifMTU &amp;lt;= 17966 and ifMTU &amp;gt;= 64)' {&lt;BR /&gt;         error-message "An ATM MTU must be 64 .. 17966";&lt;BR /&gt;       }&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;10.3.1.1.  Usage Example&lt;BR /&gt;&lt;BR /&gt;     list interface {&lt;BR /&gt;       key "name type";&lt;BR /&gt;       leaf name { ... }&lt;BR /&gt;       leaf type { ... }&lt;BR /&gt;       leaf enabled {&lt;BR /&gt;         type boolean;&lt;BR /&gt;       }&lt;BR /&gt;       ...&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;     container mgmt-interface {&lt;BR /&gt;       leaf name {&lt;BR /&gt;         type leafref {&lt;BR /&gt;           path "/interface/name";&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;       leaf type {&lt;BR /&gt;         type leafref {&lt;BR /&gt;           path "/interface[name=current()/../name]/type";&lt;BR /&gt;         }&lt;BR /&gt;         must 'deref(.)/../enabled = "true"' {&lt;BR /&gt;           error-message&lt;BR /&gt;             "The management interface cannot be disabled.";&lt;BR /&gt;         }&lt;BR /&gt;       }&lt;BR /&gt;     }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It seems a string must be configured in order for 'error-message' to work. Are you trying to set certain restraints on the ipv4-address?</description>
      <pubDate>Wed, 20 Feb 2019 18:01:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806090#M3345</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-20T18:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806129#M3346</link>
      <description>&lt;P&gt;Thanks, yes I have seen that part of RFC but it seems in all the examples error-message is applicable when a condition is evaluated on datatype (for example: range, pattern, etc.). I'm not trying to impose further conditions on&amp;nbsp;"inet:ipv4-address", rather want to just customize the error message that NSO returns to NB API when an invalid IP address is sent. By default, NSO's error-message returned to NB API contains the internal xpath to the IPv4 address in question, I want to customize that to a more generic error message.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 18:48:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806129#M3346</guid>
      <dc:creator>Iman1</dc:creator>
      <dc:date>2019-02-20T18:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806238#M3349</link>
      <description>Hmm. Makes sense. For display purposes, can you provide a sample of what you see now when an error occurs? Just to make more sense of it.&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Feb 2019 20:55:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806238#M3349</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-20T20:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806324#M3353</link>
      <description>&lt;P&gt;Here's a sample of error-message NSO would return to NB API by default:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"error-message": "invalid value for: loopback0v4 in /myservice:myservice[myservice:device='Router24']/myservice:loopbacks/myservice:loopback0v4: \"10.10.10.1000\" is not a valid value."&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 00:10:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806324#M3353</guid>
      <dc:creator>Iman1</dc:creator>
      <dc:date>2019-02-21T00:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806328#M3354</link>
      <description>So..&lt;BR /&gt;&lt;BR /&gt;The only thing I can find within the NSO install directory is the following:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;src/ncs/errors/errcode.xml:343:        "{lexical-unicode}" is not a valid value.&lt;BR /&gt;&lt;BR /&gt;src/ncs/errors/errcode.xml:349:        {native-val} is not a valid value.&lt;BR /&gt;&lt;BR /&gt;src/ncs/errors/errcode.xml:400:        "{lexical-val}" is not a valid value.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In which leads me to believe it may not be something that is easily adjustable since I think it is predefined within NSO. I could be wrong, but take a look at the errcode.xml:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  &lt;TYPE name="bad_value"&gt;&lt;BR /&gt;&lt;BR /&gt;    &lt;DESCRIPTION&gt;&lt;BR /&gt;&lt;BR /&gt;      This error type denotes a type error.  It is generated when an&lt;BR /&gt;&lt;BR /&gt;      invalid value is specified for a certain leaf.&lt;BR /&gt;&lt;BR /&gt;    &lt;/DESCRIPTION&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;    &lt;CODE name="bad_value"&gt;&lt;BR /&gt;&lt;BR /&gt;      &lt;FMT&gt;&lt;BR /&gt;&lt;BR /&gt;        {native-val} is not a valid value.&lt;BR /&gt;&lt;BR /&gt;      &lt;/FMT&gt;&lt;BR /&gt;&lt;BR /&gt;    &lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/TYPE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 00:21:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806328#M3354</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-21T00:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806329#M3355</link>
      <description>&lt;P&gt;Sorry, it filtered the other info. But bad_value us explained as:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: -webkit-standard; font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"&gt;This error type denotes a type error. It is generated when an&lt;/SPAN&gt;&lt;BR style="color: #000000; font-family: -webkit-standard; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" /&gt;&lt;SPAN style="color: #000000; font-family: -webkit-standard; font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"&gt;invalid value is specified for a certain leaf.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: -webkit-standard; font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"&gt;which leads to the following errcodes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: -webkit-standard; font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"&gt;Another thing would be, what is the use-case here? More customization? To me it seems straight forward as to what is wrong, but I understand use cases my vary.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 00:35:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806329#M3355</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-21T00:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806357#M3356</link>
      <description>&lt;P&gt;yeah good find... I'm not sure how&amp;nbsp;errcode.xml is imported and used inside ncs. If someone could shed more light on it, that would be great... I wish there was some documentation around it (maybe there is?)...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use-case is simple... we don't necessarily want NSO's default error-messages which refer to the internal structure of service yang to be passed to a NB system/user. Ability to customize/generalize the error text returned to NB systems/users who are unaware of NSO details is very much desired.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 01:07:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806357#M3356</guid>
      <dc:creator>Iman1</dc:creator>
      <dc:date>2019-02-21T01:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806361#M3357</link>
      <description>I’ll see what I can do for you.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2019 01:11:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806361#M3357</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-21T01:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806362#M3358</link>
      <description>&lt;P&gt;Thanks Joe&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 01:14:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3806362#M3358</guid>
      <dc:creator>Iman1</dc:creator>
      <dc:date>2019-02-21T01:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: custom error-message for datatypes</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3807111#M3377</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So..As far as I know..only some errors can&amp;nbsp; be altered. If you go to your NSO install directory and go into the man pages &amp;gt; man3 &amp;gt; confd_lib_dp, you can check out a section called 'Error Formatting Callback'. But that is all I can find at the moment. I checked it out myself and I'm not too familiar with this, but as far as I can find, this is the closest to what you are requesting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 20:03:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/custom-error-message-for-datatypes/m-p/3807111#M3377</guid>
      <dc:creator>joepak</dc:creator>
      <dc:date>2019-02-21T20:03:57Z</dc:date>
    </item>
  </channel>
</rss>

