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

ygot Validate error, when yang leaf type is union #949

Open
songlinglingpml opened this issue Jan 13, 2024 · 0 comments
Open

ygot Validate error, when yang leaf type is union #949

songlinglingpml opened this issue Jan 13, 2024 · 0 comments

Comments

@songlinglingpml
Copy link

I am using openconfig/ygotv0.7.1 , Validate funtion
When I use restful to send delete messages, sometimes the following error occurs

URL:
restconf/data/openconfig-network-instance:network-instances/network-instance=DEFAULT/protocols/protocol=oc-pol-types:ISIS,DEFAULT/isis/interfaces/interface=Ethernet8/levels/level=2/afi-safi/af=oc-isis-types:IPV4,oc-isis-types:UNICAST/segment-routing/adjacency-sids/adjacency-sid=172.60.61.1,321536

Code:
baseTreeNode, err := ytypes.GetNode(ygSchema.RootSchema(), deviceObj, path)
basePathObj, ok := (baseTreeNode[0].Data).(ygot.ValidatedGoStruct)
if ok {
err := basePathObj.Validate(&ytypes.LeafrefOptions{IgnoreMissingData: true})
......

error-message
"/device/network-instances/network-instance: /device/network-instances/network-instance/protocols/protocol: /device/network-instances/network-instance/protocols/protocol/isis/interfaces: /device/network-instances/network-instance/protocols/protocol/isis/interfaces/interface: /device/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level: /device/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level/afi-safi/af: /device/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level/afi-safi/af/segment-routing/adjacency-sids: /device/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level/afi-safi/af/segment-routing/adjacency-sids/adjacency-sid: "321536" does not match regular expression pattern "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$" for schema "

yang info:
sid-id is in openconfig-segment-routing.yang,and it's type union

leaf sid-id {
  type oc-srt:sr-sid-type;
  description
    "The Segment Identifier to be used when advertising the IGP Prefix SID.";
}

typedef sr-sid-type {
type union {
type oc-mplst:mpls-label; ===》openconfig-mpls-types.yang
type oc-inet:ipv6-address; ===》openconfig-inet-types.yang
}
description
"The defined value of a segment identifier.";
}

Is this a known issue?

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

1 participant