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

Missing container in list support in YANG Model #16704

Closed
kellyyeh opened this issue Sep 26, 2023 · 2 comments
Closed

Missing container in list support in YANG Model #16704

kellyyeh opened this issue Sep 26, 2023 · 2 comments
Labels
Help Wanted 🆘 Issue for 202305 Triaged this issue has been triaged YANG YANG model related changes

Comments

@kellyyeh
Copy link
Contributor

Description

Currently having container in list for YANG Model fails PR check due to missing support of parsing container in list.
According to RFC, container inside a list is supported.
https://datatracker.ietf.org/doc/html/rfc7950#section-4.2.2.4

Config_db.json:

"DHCP_RELAY": {
        "Vlan1000": {
            "dhcpv6_servers": [
                "fc02:2000::1",
                "fc02:2000::2",
                "fc02:2000::3",
                "fc02:2000::4"
            ],
            "dhcpv6_option”: {
               “rfc6939_support": "false",
                “interface_id”: “false”
           }
    }
}

Corresponding Yang Model:

module sonic-dhcpv6-relay {

	namespace "http://github.com/sonic-net/sonic-dhcpv6-relay";

	prefix sdhcpv6relay;

	yang-version 1.1;

	import ietf-inet-types {
		prefix inet;
	}

	organization "SONiC";

	contact "SONiC";

	description "DHCPv6 Relay yang Module for SONiC OS";

	revision 2021-10-30 {
		description "First Revision";
	}

	container sonic-dhcpv6-relay {

		container DHCP_RELAY {

			description "DHCP_RELAY part of config_db.json";

			list DHCP_RELAY_LIST {

				key "name";

				leaf name {
					type string;
				}

				leaf-list dhcpv6_servers {
					description "Configure the dhcp v6 servers";
					type inet:ipv6-address;
				}

				container dhcpv6_option {
					leaf rfc6939_support {
						description "Set rfc6939 for the relay";
						type string {
							pattern "false|true";
						}
					}
					leaf interface_id {
						description "Enable interface ID insertion in relayed messages";
						type string {
							pattern "false|true";
						}
					}
				}
			}
			/* end of DHCP_RELAY_LIST */
		}
		/* end of container DHCP_RELAY */
	}
	/* end of container sonic-dhcpv6-relay */
}
/* end of module sonic-dhcpv6-relay */

Steps to reproduce the issue:

  1. Update DHCPv6 Relay YANG model
  2. Run make target/python-wheels/bullseye/sonic_yang_mgmt-1.0-py3-none-any.whl
  3. Fails due to sonic yang xlate translation not supporting container inside a list.

Describe the results you received:

PR runs into build failure due to sonic yang xlate translation not supporting container inside a list.
sonic-buildimage/src/sonic-yang-mgmt/sonic_yang_ext.py at e286869b24992a6ee17a31a76bbd54bf186fc383 · sonic-net/sonic-buildimage (github.com)

Error encountered:

        # All entries in copy of config must have been parsed.
        if len(configC):
            self.sysLog(msg="All Keys are not parsed in {}\n{}".format(table, \
                configC.keys()), debug=syslog.LOG_ERR, doPrint=True)
            self.sysLog(msg="exceptionList:{}".format(exceptionList), \
                debug=syslog.LOG_ERR, doPrint=True)
            raise(Exception("All Keys are not parsed in {}\n{}\nexceptionList:{}".format(table, \
>               configC.keys(), exceptionList)))
E           Exception: All Keys are not parsed in DHCP_RELAY
E           dict_keys(['Vlan111', 'Vlan777'])
E           exceptionList:["'dhcpv6_option'", "'dhcpv6_option'"]

Describe the results you expected:

PR check passing

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

@judyjoseph
Copy link
Contributor

To be taken up in Yang working group

@VladimirKuk
Copy link
Contributor

VladimirKuk commented Jan 27, 2024

Hi @qiluo-msft ,
Following our discussion, please assign this issue to me.
Thank you.

VladimirKuk added a commit to Marvell-sonic/sonic-buildimage that referenced this issue Feb 13, 2024
Add support container in list

Signed-off-by: vkuk <vkuk@marvell.com>
VladimirKuk added a commit to Marvell-sonic/sonic-buildimage-yang-bug that referenced this issue Feb 13, 2024
Add support container in list

Signed-off-by: vkuk <vkuk@marvell.com>
VladimirKuk added a commit to Marvell-sonic/sonic-buildimage-yang-bug that referenced this issue Feb 25, 2024
Add support container in list

Signed-off-by: vkuk <vkuk@marvell.com>
VladimirKuk added a commit to Marvell-sonic/sonic-buildimage that referenced this issue Feb 25, 2024
Add support container in list
Add support for single choice statement in container/list

Signed-off-by: vkuk <vkuhk@marvell.com>
VladimirKuk added a commit to Marvell-sonic/sonic-buildimage-yang-bug that referenced this issue Feb 26, 2024
Added test yang model for single/multiple choice(s) in container/list
Add test yang model for container in list

Signed-off-by: vkuk <vkuk@marvell.com>
kellyyeh pushed a commit to kellyyeh/sonic-buildimage that referenced this issue Feb 29, 2024
Add support container in list

Signed-off-by: vkuk <vkuk@marvell.com>
kellyyeh pushed a commit to kellyyeh/sonic-buildimage that referenced this issue Feb 29, 2024
Add support container in list

Signed-off-by: vkuk <vkuk@marvell.com>
kellyyeh pushed a commit to kellyyeh/sonic-buildimage that referenced this issue Feb 29, 2024
Added test yang model for single/multiple choice(s) in container/list
Add test yang model for container in list

Signed-off-by: vkuk <vkuk@marvell.com>
qiluo-msft pushed a commit that referenced this issue Mar 21, 2024
Fixes "Missing container in list support in YANG Model #16704"

Why I did it
Adds support for container in list

How I did it
Identify container in list's leaf and add its data.

Fixes "Update dhcpv6 option yang model" #16290

Why I did it
Adds support for single "choice" statement in container/list

How I did it
Check if choice data is dictionary (instead of list).

How to verify it
Reconstruction details in bug's description.

Tested branch (Please provide the tested image version)
 202311
Description for the changelog
Adds support for container in list to yang parsing

Link to config_db schema for YANG module changes
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#dhcp_relay

Signed-off-by: vkuk [vkuk@marvell.com]
@github-project-automation github-project-automation bot moved this to Done in yang Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted 🆘 Issue for 202305 Triaged this issue has been triaged YANG YANG model related changes
Projects
Status: Done
Development

No branches or pull requests

6 participants