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

config: false Lists may not have a "key" sub-stmt / ordered-by #7

Closed
2 tasks done
robshakir opened this issue May 23, 2015 · 3 comments
Closed
2 tasks done

config: false Lists may not have a "key" sub-stmt / ordered-by #7

robshakir opened this issue May 23, 2015 · 3 comments

Comments

@robshakir
Copy link
Owner

Note: Two changes to resolve under this ticket:

  • ordered-by user is not supported
  • lists without keys are not yet supported

According to RFC6020, a list that is config: false may not have a key statement - this is currently not supported in pyangbind.

Example module - yang/vendor/cisco/xr/530/Cisco-IOS-XR-cdp-oper.yang

        container neighbors {
          xr:xr-xml-map "cdp_oper:Neighbors";
          description "The CDP neighbor tables on this node";

          container details {
            xr:xr-xml-map "cdp_oper:DetailTable";
            description "The detailed CDP neighbor table";

            list detail {
              xr:xr-xml-map "cdp_oper:Detail";
              description
                "Detailed information about a CDP neighbor
                entry";
              leaf interface-name {
                xr:xr-xml-map "cdp_oper:InterfaceName";
                type xr:Interface-name;
                description "The interface name";
              }
              leaf device-id {
                xr:xr-xml-map "cdp_oper:DeviceID";
                type string;
                description "The neighboring device identifier";
              }
              uses CDP-NEIGHBOR;
            }
          }
@aashaikh
Copy link
Collaborator

We use a similar construct in the RIB model, where there may be a multitude of routes in the table with the same prefix/next-hop/etc. so creating a keyless list is useful since it's read-only.

would it make sense in this case to create a map with a system-generated key (e.g., uuid) that is just never accessed by the user?

btw, do you use an ordered collection for ordered-by: user lists?

@robshakir
Copy link
Owner Author

ordered-by is not yet supported, but I was planning to use a collections.OrderedDict - under the YANGList class (right now self._members there is a dict()).

There are a couple of options here - I would prefer to use a dict since otherwise YANGList needs to handle the fact that self._members might have multiple types.

@robshakir robshakir changed the title config: false Lists may not have a "key" sub-stmt config: false Lists may not have a "key" sub-stmt / ordered-by May 24, 2015
robshakir pushed a commit that referenced this issue May 24, 2015
	* (M) tests/run.sh lets a single test be run by specifying it as an
		  argument.
	* (M) when ordered-by user is specified for a list then rather than
		  the list being represented by a dict() a
		  collections.OrderedDict container is used for the list members
		  so that the order that items are added is maintained (as per
		  issue #7).
@robshakir
Copy link
Owner Author

Resolved in 4fa7f47.

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

2 participants