holo-routing / yang-rs

Rust bindings for the libyang library.
MIT License
23 stars 12 forks source link

Update the source example in the docs #3

Closed dgjustice closed 1 year ago

dgjustice commented 1 year ago

I have updated the README code so it compiles. Using the data in the existing assets folder, I get the following error:

libyang[0]: Mandatory node "oper-status" instance does not exist. (path: Schema location "/ietf-interfaces:interfaces/interface/oper-status", line number 20.)
thread 'main' panicked at 'Failed to parse data tree: Error { errcode: 7, msg: Some("Mandatory node \"oper-status\" instance does not exist."), path: Some("Schema location \"/ietf-interfaces:interfaces/interface
/oper-status\", line number 20."), apptag: None }', src/bin/dewit.rs:33:6

This is easily resolved by adding

"oper-status": "up",
"statistics": {
  "discontinuity-time": "2019-08-08T10:11:12.345+09:01"
}

to the interfaces container. I would be happy to update the interfaces.json file or include a note about the expected failure. I will leave that up to your discretion. Thanks!