Adding support for OC YANG interfaces.#9
Conversation
sonic-port xfmr support
…f github.com:nagarwal03/oc-yang-intf into Nikita_subintf_oc_yang
Adding support for OC yang interfaces.
Remove IntfType related code for any non-supported types
Code Clean-up - Remove unsupported interface related code
Merge branch 'oc-intf-common-code-Jan30' into Nikita_subintf_oc_yang
Removing unnecessary code.
models/yang/openconfig-if-ip.yang
Outdated
| "The length of the subnet prefix."; | ||
| } | ||
|
|
||
| leaf family { |
There was a problem hiding this comment.
Let's not introduce "family" yang attribute in OC-yang, since it was present in sonic-yang. If we introduce a new attribute in OC-yang, we should have a justification for that. From OC-yang perspective, "family" attribute is not needed, since OC have separate container already for IPv4 (subinterfaces/subinterface/ipv4) & IPv6 (subinterfaces/subinterface/ipv6), which is already intuitive. But in Sonic-yang, there is no separate table for each address-family, hence family attribute is needed in sonic-yang alone. Based on the incoming OC-yang URI for IP-config, we can populate family attribute field in sonic-yang/config-db accordingly in YangToDb_intf_ip_addr_xfmr
There was a problem hiding this comment.
I've removed the family attribute from OC Yang and xfmr_intf.go
|
|
||
| import ( | ||
| "fmt" | ||
| //"github.com/Azure/sonic-mgmt-common/translib/db" |
There was a problem hiding this comment.
why we need this change? this import remove is already present in community file. Check for white-space
There was a problem hiding this comment.
This line was originally added twice in the community file and one of the lines was commented out so I deleted that commented line.
models/yang/openconfig-if-ip.yang
Outdated
| description | ||
| "The length of the subnet prefix."; | ||
| } | ||
| leaf family { |
| procTable map[uint64]dbEntry | ||
| } | ||
|
|
||
| type reqType int |
There was a problem hiding this comment.
Do we really need this change in this file? It's not been used in xfmr_intf.go
There was a problem hiding this comment.
Used to be used, seems to be removed with one of the code changes to remove unnecessary code. Will double check & remove.
There was a problem hiding this comment.
@rathnasabapathyv It is required in the sys_app.go file and pfm_app.go file. It was earlier defined in the intf_app.go file and since we deleted that file, we were seeing the following errors so had to redefine it here:
./pfm_app.go:38:28: undefined: dbEntry
./pfm_app.go:168:39: undefined: dbEntry
./pfm_app.go:184:39: undefined: dbEntry
./sys_app.go:42:25: undefined: dbEntry
./sys_app.go:43:25: undefined: dbEntry
./sys_app.go:269:36: undefined: dbEntry
./sys_app.go:285:33: undefined: dbEntry
./sys_app.go:290:34: undefined: dbEntry
./sys_app.go:307:24: undefined: dbEntry
make[3]: *** [Makefile:59: /sonic/src/sonic-mgmt-common/build/tests/translib/testapp.test] Error 2
There was a problem hiding this comment.
As part of this enhancement, we don't have any enhancements in pfm_app.go & sys_app.go. Without this change, existing community code pfm_app.go, how it's compiling?
There was a problem hiding this comment.
Looks like in existing community code, these two typedefs reqType & dbEntry were present earlier in intf_app.go, which has been removed by us as part of this PR and we have to park it somewhere. It's ok then.
…yang-intf into satoru-port-jan30
Adding automation file for subinterfaces.
Add Interface-level and Ethernet UT scripts + Merge all interface related tests to 1 file
Addressing review comments. Removed family attribute from OC Yang.
…Jan30' into Nikita_subintf_oc_yang
|
You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework. |
There was a problem hiding this comment.
The extension YANG file is intended to extend the existing OC YANG definitions to support Dell specific nodes. Since this file does not have such extended node definitions but just deviations, you do not need this file. Please move the deviate statements to openconfig-interfaces-deviation.yang.
There was a problem hiding this comment.
go.mod and go.sum files have been updated with the latest build.
Extention yang has been deleted and all deviations has been moved to the openconfig-interfaces-deviation.yang
translib/transformer/xfmr_intf.go
Outdated
| XlateFuncBind("DbToYang_intf_enabled_xfmr", DbToYang_intf_enabled_xfmr) | ||
| XlateFuncBind("YangToDb_intf_eth_port_config_xfmr", YangToDb_intf_eth_port_config_xfmr) | ||
| XlateFuncBind("DbToYang_intf_eth_port_config_xfmr", DbToYang_intf_eth_port_config_xfmr) | ||
| XlateFuncBind("DbToYangPath_intf_eth_port_config_path_xfmr", DbToYangPath_intf_eth_port_config_path_xfmr) |
There was a problem hiding this comment.
The path-xmfr callback is designed for subscription support. Just note that earlier code upstream for sflow app includes the subscription support. To be consistent, please plan to add subscription support.
For your reference, here is the PR - sonic-net#91
There was a problem hiding this comment.
We are not planning to support subscription as part of this initial PR. Planning to do next. We can remove path-xfmr code and relevant annotations from here.
There was a problem hiding this comment.
Okay, that's fine. Just mention the phased plan for community reviewers.
| @@ -0,0 +1,147 @@ | |||
| module openconfig-interfaces-ext { | |||
|
|
|||
| yang-version "1.1"; | |||
There was a problem hiding this comment.
Let's move all deviations present in this file to openconfig-interfaces-deviation.yang
|
|
||
| revision "2024-01-19" { | ||
| description | ||
| "Add Yang deviations for unsupported subinterfaces."; |
There was a problem hiding this comment.
Let's change the revision number as 0.1.0 and update description accordingly.
| reference "2.13.0"; | ||
| } | ||
|
|
||
| revision "2022-04-20" { |
There was a problem hiding this comment.
Like we have discussed, let's remove all other revisions except "2.12.1" & "2.8.0"
What kind of update, do we need @kwangsuk on this? Looks like existing one itself is working for us. Do you think anything is missing for this code changes in PR? |
The xfmr_intf.go file adds a new package - "inet.af/netaddr", that it will update go.mod accordingly. Please check. |
|
Please run your unit test binary, sonic-mgmt-common/build/tests/translib/translib.test, to see the test result. |
Got it. Thanks @kwangsuk . If we don't include that "inet.af/netaddr" in go.mod, what kind of issue, we will see? Compilation error or functionality error? Compilation & functional test seems fine, that's why asking. If that was the case, can we assume that pkg is already included through other inclusions? |
|
It will fail in azure pipeline. |
Yes, I know. Since the "testapp" is tagged to the test.go files, it is compiled into translib.test, which is expected. More importantly, the azure pipeline will trigger running tests at time of merge. So, all testcase should pass. Please refer to the azure-pipelines.yml. |
Updating automation files. Removed family attribute.
Adding fixes based on review. Adding go.mod and go.sum files for tran…
|
The PR with the latest change has been merged to the internal common branch. Please review when possible, thank you so much! |
|
As commented earlier, please attach the test result of the testapp.test, which is relevant to the PR. Please replace the translib.test log with testapp.test log. Please refer to the testapp.test binary. |
Address additional review comments regarding port-speed and switch ca…
|
SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well. |
|
The upstream from both Dell and Broadcom is also aimed to encourage the community to adapt the sonic-mgmt-common infrastructure including transformer, cvl and DB components. So, the app code will serve as a show case. |
Since this PR changes are more about transformer application code changes to enable user to configure via OC-yang, we want to spend effort for writing automation test cases for that cases alone. Without this xfmr application changes, config via OC-yang is not possible. Other existing working scenarios like config via sonic-yang is fine, we don't want to spend time writing automation for those. If we want to show-case some sample test application via sonic-yang, we can let them refer SFLOW automation-test code for sonic-yang. |
Since SONiC yang is 1:1 translation performed by transformer, the YANG to ABNF is pretty straightforward to demonstrate the SONiC yang path for sonic-port.yang and sonic-interface.yang. I believe the interface is most useful show case to the community. But, if you think it's overloaded effort, that would be fine. You can plan it next phase. |
What we did:
Added transformer support for OpenConfig Interfaces.
Why we did it?
Earlier, intf_app.go was used for interfaces configuration. Replacing it with xfmr_intf.go to add transformer support for OpenConfig YANG interfaces configuration via REST and gNMI.
How did we verify the changes?
Verified by adding interface unit test files for REST and gNMI.
Unit test file changes for REST:
interfaces_openconfig_test.go – To test the parameters in the openconfig-interfaces.yang.
(https://github.com/nagarwal03/oc-yang-intf/files/14440648/feb28_testapp.log)
Log files for REST manual run:
REST_ETHERNET.log
REST_SUBINTERFACE.log
REST_TOP.log
Log files for gNMI manual run:
GNMI_ETH.log
GNMI_SUB.log
GNMI_TOP.log
Translib.test Logs:
https://github.com/nagarwal03/oc-yang-intf/files/14440650/feb28_translib.log
Support added:
Ethernet interface parameters can be modified via REST and gNMI.