You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make it obvious in documentation. Indicate which elements are mutually exclusive
Also, if the --choice-subsstatements-as-subclasses option is chosen when running ydk-gen, all the cases of a choice statement should be generated as subclasses of a parent class.
Currently, the cases of a choice statement are modeled as Properties. So, below yang produces below python code.
choice rule-type {
description
"This choice matches if all leafs present in the rule
match the request. If no leafs are present, the
choice matches all requests.";
case protocol-operation {
leaf rpc-name {
type union {
type matchall-string-type;
type string;
}
description
"This leaf matches if it has the value '*' or if
its value equals the requested protocol operation
name.";
}
}
case notification {
leaf notification-name {
type union {
type matchall-string-type;
type string;
}
description
"This leaf matches if it has the value '*' or if its
value equals the requested notification name.";
}
}
case data-node {
leaf path {
type node-instance-identifier;
mandatory true;
description
"Data Node Instance Identifier associated with the
data node controlled by this rule.
Configuration data or state data instance
identifiers start with a top-level data node. A
complete instance identifier is required for this
type of path value.
The special value '/' refers to all possible
datastore contents.";
}
}
}
If this option is chosen, below python code will be produced instead :
self.rule_type = RuleType()
class RuleType(object):
pass
class NotificationName(RuleType):
pass
class Path(RuleType):
pass
class(RuleType):
pass
RuleType is not from the choice, rather it should be from the container or list that is the parent of the choice. No class should be generated for the choice. (In the case where choice is a top level element under the module, the case classes would inherit themodule class)
Note in the case there are 2 choices under the given statement , this generation algorithm should not be used
The text was updated successfully, but these errors were encountered:
Make it obvious in documentation. Indicate which elements are mutually exclusive
Also, if the --choice-subsstatements-as-subclasses option is chosen when running ydk-gen, all the cases of a choice statement should be generated as subclasses of a parent class.
Currently, the cases of a choice statement are modeled as Properties. So, below yang produces below python code.
If this option is chosen, below python code will be produced instead :
The text was updated successfully, but these errors were encountered: