-
Notifications
You must be signed in to change notification settings - Fork 115
Description
[Question] I tried to add extended yang for an Openconfig Yang, but found that leaf in extended yang cannot be operated (set/get operations by executing REST command). Can you make an example ? Or help me, thanks.
I met some questions, the steps are as follows:
- add yang files
models/yang/openconfig-optical-attenuator.yang (Openconfig Yang, refer to attach file)
models/yang/extensions/openconfig-optical-attenuator-ext.yang (customer extended yang, refer to attach file)
models/yang/annotations/openconfig-optical-attenuator-annot.yang (annotation yang, refer to attach file)
models/yang/sonic/sonic-optical-attenuator.yang - add common transform handlers( eg. xfmr_optical.go)
- execute REST command by curl on device
curl -vk -X POST --data-binary "@create_voa2.txt" "https://127.0.0.1/restconf/data/openconfig-optical-attenuator:optical-attenuator" -H "Content-Type: application/yang-data+json"
Result : test-bool value is not set to redis db, and an error occures in syslog:
Jul 28 03:16:50.993116 sonic INFO mgmt-framework#/supervisord: rest-server W0728 03:16:50.992765 19 xlate_to_db.go:94] Table for yang-path("/openconfig-optical-attenuator:optical-attenuator/attenuators/attenuator/config/test-bool") not found.
- I found some abnormal items in /tmp/fullSpec.txt (mgnt-framwork container) , refer to fullSpec.txt
a. NOT find test-bool in yangEntry map of /openconfig-optical-attenuator:optical-attenuator/attenuators/attenuator/config
b. tableName , yangEntry, keyXpath are empty in /openconfig-optical-attenuator:optical-attenuator/attenuators/attenuator/config/test-bool, but be OK in /openconfig-optical-attenuator:optical-attenuator/attenuators/attenuator/config/enabled
why? How to modify openconfig-optical-attenuator-annot.yang or others in order to identify openconfig-optical-attenuator-ext.yang ?
fullSpec.txt
[openconfig-optical-attenuator-annot.yan
create_voa2.txt
g.txt](https://github.com/sonic-net/sonic-mgmt-common/files/9207507/openconfig-optical-attenuator-annot.yang.txt)
[openconfig-optical-attenuator-ext.yang.t
openconfig-optical-attenuator.yang.txt
xt](https://github.com/sonic-net/sonic-mgmt-common/files/9207519/openconfig-optical-attenuator-ext.yang.txt)