-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add PathAndStruct helper for generated non-leaf PathStruct types. #533
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1612,6 +1612,16 @@ type ContainerWithConfigAny struct { | |
*ygot.NodePath | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.ContainerWithConfig for the path "/root-module/container-with-config". | ||
func (n *ContainerWithConfig) PathAndStruct() (*ContainerWithConfig, *oc.ContainerWithConfig) { | ||
return n, &oc.ContainerWithConfig{} | ||
} | ||
|
||
// PathAndStruct returns the wildcard path struct and an empty oc.ContainerWithConfig for the path "/root-module/container-with-config". | ||
func (n *ContainerWithConfigAny) PathAndStruct() (*ContainerWithConfigAny, *oc.ContainerWithConfig) { | ||
return n, &oc.ContainerWithConfig{} | ||
} | ||
|
||
// ContainerWithConfig_Leaf represents the /root-module/container-with-config/state/leaf YANG schema element. | ||
type ContainerWithConfig_Leaf struct { | ||
*ygot.NodePath | ||
|
@@ -1718,6 +1728,11 @@ type ContainerWithConfig struct { | |
*ygot.NodePath | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.ContainerWithConfig for the path "/root-module/container-with-config". | ||
func (n *ContainerWithConfig) PathAndStruct() (*ContainerWithConfig, *oc.ContainerWithConfig) { | ||
return n, &oc.ContainerWithConfig{} | ||
} | ||
|
||
// ContainerWithConfig_Leaf represents the /root-module/container-with-config/state/leaf YANG schema element. | ||
type ContainerWithConfig_Leaf struct { | ||
*ygot.NodePath | ||
|
@@ -1785,6 +1800,11 @@ func DeviceRoot(id string) *RootPath { | |
return &RootPath{ygot.NewDeviceRootBase(id)} | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.Root for the path "/root". | ||
func (n *RootPath) PathAndStruct() (*RootPath, *oc.Root) { | ||
return n, &oc.Root{} | ||
} | ||
|
||
// LeafPath represents the /root-module/leaf YANG schema element. | ||
type LeafPath struct { | ||
*ygot.NodePath | ||
|
@@ -1866,6 +1886,11 @@ func DeviceRoot(id string) *RootPath { | |
return &RootPath{ygot.NewDeviceRootBase(id)} | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.Root for the path "/root". | ||
func (n *RootPath) PathAndStruct() (*RootPath, *oc.Root) { | ||
return n, &oc.Root{} | ||
} | ||
|
||
// LeafPath represents the /root-module/leaf YANG schema element. | ||
type LeafPath struct { | ||
*ygot.NodePath | ||
|
@@ -1934,6 +1959,16 @@ type ListAny struct { | |
*ygot.NodePath | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.List for the path "/root-module/list-container/list". | ||
func (n *List) PathAndStruct() (*List, *oc.List) { | ||
return n, &oc.List{} | ||
} | ||
|
||
// PathAndStruct returns the wildcard path struct and an empty oc.List for the path "/root-module/list-container/list". | ||
func (n *ListAny) PathAndStruct() (*ListAny, *oc.List) { | ||
return n, &oc.List{} | ||
} | ||
|
||
// List_Key1 represents the /root-module/list-container/list/key1 YANG schema element. | ||
type List_Key1 struct { | ||
*ygot.NodePath | ||
|
@@ -2040,6 +2075,11 @@ type List struct { | |
*ygot.NodePath | ||
} | ||
|
||
// PathAndStruct returns the path struct and an empty oc.List for the path "/root-module/list-container/list". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is interesting -- for YANG |
||
func (n *List) PathAndStruct() (*List, *oc.List) { | ||
return n, &oc.List{} | ||
} | ||
|
||
// List_Key1 represents the /root-module/list-container/list/key1 YANG schema element. | ||
type List_Key1 struct { | ||
*ygot.NodePath | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should generating the path and struct helper be optional? In general we've tried to have these other features that are new types of output flag-controlled in the library - even if we have it as on by default, it'd probably be nice to have something whereby a user can turn this off if they don't want it to save on generated code size.