Skip to content

Adding support for OC YANG interfaces.#9

Merged
nagarwal03 merged 29 commits intointernal-review-ocintffrom
oc-intf-common-code-Jan30
Mar 6, 2024
Merged

Adding support for OC YANG interfaces.#9
nagarwal03 merged 29 commits intointernal-review-ocintffrom
oc-intf-common-code-Jan30

Conversation

@nagarwal03
Copy link
Owner

@nagarwal03 nagarwal03 commented Feb 13, 2024

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.

"The length of the subnet prefix.";
}

leaf family {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the family attribute from OC Yang and xfmr_intf.go


import (
"fmt"
//"github.com/Azure/sonic-mgmt-common/translib/db"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need this change? this import remove is already present in community file. Check for white-space

Copy link
Owner Author

@nagarwal03 nagarwal03 Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was originally added twice in the community file and one of the lines was commented out so I deleted that commented line.

description
"The length of the subnet prefix.";
}
leaf family {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

procTable map[uint64]dbEntry
}

type reqType int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this change in this file? It's not been used in xfmr_intf.go

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used to be used, seems to be removed with one of the code changes to remove unnecessary code. Will double check & remove.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kwangsuk
Copy link
Collaborator

You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that's fine. Just mention the phased plan for community reviewers.

@@ -0,0 +1,147 @@
module openconfig-interfaces-ext {

yang-version "1.1";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the revision number as 0.1.0 and update description accordingly.

reference "2.13.0";
}

revision "2022-04-20" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we have discussed, let's remove all other revisions except "2.12.1" & "2.8.0"

@rathnasabapathyv
Copy link
Collaborator

You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework.

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?

@kwangsuk
Copy link
Collaborator

You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework.

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.

@kwangsuk
Copy link
Collaborator

Please run your unit test binary, sonic-mgmt-common/build/tests/translib/translib.test, to see the test result.

@rathnasabapathyv
Copy link
Collaborator

You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework.

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.

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?

@rathnasabapathyv
Copy link
Collaborator

Please run your unit test binary, sonic-mgmt-common/build/tests/translib/translib.test, to see the test result.
Team has written new test specific to interfaces and they are going to attach those automation-logs for reference in PR.

@kwangsuk
Copy link
Collaborator

You may have to update go.mod and go.sum files. Please check them in the following repos - sonic-mgmt-common, sonic-mgmt-framework.

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.

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.

@kwangsuk
Copy link
Collaborator

Please run your unit test binary, sonic-mgmt-common/build/tests/translib/translib.test, to see the test result.
Team has written new test specific to interfaces and they are going to attach those automation-logs for reference in PR.

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.

nagarwal03 and others added 3 commits February 22, 2024 14:43
Updating automation files. Removed family attribute.
Adding fixes based on review. Adding go.mod and go.sum files for tran…
@Satoru-Shinohara
Copy link
Collaborator

The PR with the latest change has been merged to the internal common branch.
Those changes should be reflected in this PR now.

Please review when possible, thank you so much!

@kwangsuk
Copy link
Collaborator

kwangsuk commented Feb 28, 2024

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.
https://github.com/sonic-net/sonic-mgmt-common/blob/99052691c3aa2c9ddaf5f69104af12677a387d4d/translib/Makefile#L67C3-L67C27

Satoru-Shinohara and others added 2 commits February 28, 2024 17:44
Address additional review comments regarding port-speed and switch ca…
@kwangsuk
Copy link
Collaborator

kwangsuk commented Mar 4, 2024

SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well.

@rathnasabapathyv
Copy link
Collaborator

rathnasabapathyv commented Mar 4, 2024

SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well.
Why we need to write test cases for those @kwangsuk, since this PR is about transformer changes from OC-yang to Sonic-yang? Even i had that question in SFLOW XFMR PR as well? Even without these xfmr application changes, sonic-yang test via mgmt-framework infra is expected to work as it is.

@kwangsuk
Copy link
Collaborator

kwangsuk commented Mar 4, 2024

SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well.
Why we need to write test cases for those @kwangsuk, since this PR is about transformer changes from OC-yang to Sonic-yang? Even i had that question in SFLOW XFMR PR as well? Even without these xfmr application changes, sonic-yang test via mgmt-framework infra is expected to work as it is.

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.

@rathnasabapathyv
Copy link
Collaborator

SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well.
Why we need to write test cases for those @kwangsuk, since this PR is about transformer changes from OC-yang to Sonic-yang? Even i had that question in SFLOW XFMR PR as well? Even without these xfmr application changes, sonic-yang test via mgmt-framework infra is expected to work as it is.

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.

@kwangsuk
Copy link
Collaborator

kwangsuk commented Mar 5, 2024

SONiC community is far more likely to use the SONiC yangs. Like Sflow app, lets upstream interfacs_sonic_test.go as well.
Why we need to write test cases for those @kwangsuk, since this PR is about transformer changes from OC-yang to Sonic-yang? Even i had that question in SFLOW XFMR PR as well? Even without these xfmr application changes, sonic-yang test via mgmt-framework infra is expected to work as it is.

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.

@nagarwal03 nagarwal03 merged commit 0a95d5d into internal-review-ocintf Mar 6, 2024
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

Successfully merging this pull request may close these issues.

4 participants