Giter Site home page Giter Site logo

Comments (7)

rkrejci avatar rkrejci commented on August 24, 2024

In devel branch the error is different:

[ERR] (sr_check_value_conform_to_schema:807) Value doesn't conform to schema expected 0 instead of 19                                                                                                                     
[ERR] (sr_val_to_str:1070) Value doesn't conform to schema node testunion                                                                                                                                                 
[ERR] (rp_dt_set_item:373) Copy new value to string failed
[ERR] (rp_dt_set_item_wrapper:574) Set item failed
[ERR] (rp_set_item_req_process:919) Set item failed for '/test:testunion', session id=921487922.

with the following model:

module test {
  namespace "test";
  prefix t;

  typedef u {
    type union {
      type string {
        pattern "disabled";
      }
      type uint8 {
        range "1..100";
      }
    }
    default "disabled";
  }
  leaf testunion {
    type u;
  }
}

and edit-config:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <edit-config>
    <target>
      <candidate/>
    </target>
    <config>
      <testunion xmlns="test">10</testunion>
    </config>
  </edit-config>
</rpc>

It is unclear to me what kind of data are expected to be stored in sr_val_t in case of union. Netopeer actually know the type (SR_UINT8_T in this case) so the type detection in sysrepo could be skipped. Just storing the value as uint8_t and declaring type SR_UNION_T does not work:

netopeer2-server[21115]: (sr_set_val_t_type_in_gpb:1105) Type can not be mapped to gpb type '(null)' type 6
netopeer2-server[21115]: (sr_dup_val_t_to_gpb:1249) Setting type in gpb failed for xpath '(null)'
netopeer2-server[21115]: (sr_set_item:1695) value duplication failed.

from netopeer2.

lukasmacko avatar lukasmacko commented on August 24, 2024

The value should be declared as actual type SR_UINT8_T in this case

from netopeer2.

rkrejci avatar rkrejci commented on August 24, 2024

That's how it is done currently in devel branch, but the result is following.
netopeer2-server log:

netopeer2-server[27919]: Resolving unresolved data nodes and their constraints...
netopeer2-server[27919]: All data nodes and constraints resolved.
netopeer2-server[27919]: (cl_request_process:483) Error by processing of the set-item request (session id=547989496): Invalid argument.
netopeer2-server[27919]: (sr_set_item:1699) Error by processing of the request.

sysrepod log:

[ERR] (sr_check_value_conform_to_schema:803) Value doesn't conform to schema expected 0 instead of 18
[ERR] (sr_val_to_str:1066) Value doesn't conform to schema node testunion
[ERR] (rp_dt_set_item:373) Copy new value to string failed
[ERR] (rp_dt_set_item_wrapper:574) Set item failed
[ERR] (rp_set_item_req_process:919) Set item failed for '/test:testunion', session id=547989496.

from netopeer2.

lukasmacko avatar lukasmacko commented on August 24, 2024

OK, the issue was in sysrepo's typedef hadling. Should be fixed now

from netopeer2.

joanlandry avatar joanlandry commented on August 24, 2024

is the fix on the master branch?

from netopeer2.

lukasmacko avatar lukasmacko commented on August 24, 2024

yes it is

from netopeer2.

joanlandry avatar joanlandry commented on August 24, 2024

Thanks!

from netopeer2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.