Skip to content

Missing container in list support in YANG Model #16704

Closed
@kellyyeh

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions