Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add data if 'config false' YANG

Can i sent POST(not PUT or PATCH) command if the config statement is false? How?

module system {
  namespace "system:uri";
  prefix "sys";

  leaf id {
    config false;
    type string;
  }
}

It's possible to define the leaf as a read-only in netconf or YANG? (after POST)

like image 687
Shira E Avatar asked Sep 15 '26 19:09

Shira E


1 Answers

Config false nodes are not configurable. The server implementation sets their values. You cannot directly change the value of your id leaf. You can however instruct the server to do this indirectly, if you define a custom operation with such semantics.

rpc change-id {
  input {
    leaf new-id {
      description "Sets the value of system:id.";
      type string;
    }
  }
}

Obviously, the leaf would need to be really special to warrant something like this. You would then invoke the operation via POST:

POST /restconf/operations/system:change-id HTTP/1.1
Host: example.com
Content-Type: application/yang-data+json
{"system:input":{"new-id": "foo"}}

You will of course need to define proper semantics of your operation yourself.

P.S.: seeing that you asked a somewhat similar question here, perhaps what you really need is access control.

like image 106
predi Avatar answered Sep 24 '26 09:09

predi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!