Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add extended yang function for Openconfig Yang? #60

Open
guangjung opened this issue Jul 28, 2022 · 0 comments
Open

How to add extended yang function for Openconfig Yang? #60

guangjung opened this issue Jul 28, 2022 · 0 comments

Comments

@guangjung
Copy link

[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:

  1. 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
  2. add common transform handlers( eg. xfmr_optical.go)
  3. 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.

  1. 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant