openconfig / goyang Goto Github PK
View Code? Open in Web Editor NEWYANG parser and compiler to produce Go language objects
License: Apache License 2.0
YANG parser and compiler to produce Go language objects
License: Apache License 2.0
Is it possible to start linting this project as I get this long list of issues with it:
starting the lint process...
pkg/yang/entry.go:325:1:warning: depth is unused (deadcode)
pkg/yang/entry_test.go:1154::error: arg dir for printf verb %s of wrong type: map[string]*yang.Entry (vet)
pkg/yang/node.go:305::error: missing argument for Fprintf("%s"): format reads arg 3, have only 2 args (vet)
pkg/yang/node.go:334::error: missing argument for Fprintf("%s"): format reads arg 3, have only 2 args (vet)
pkg/yang/node.go:343::error: arg i for printf verb %s of wrong type: int (vet)
proto.go:275:1:warning: receiver name m should be consistent with previous receiver name mi for messageInfo (golint)
proto.go:638:41:warning: error strings should not be capitalized or end with punctuation or a newline (golint)
proto.go:650:41:warning: error strings should not be capitalized or end with punctuation or a newline (golint)
pkg/yang/lex_test.go:38:29:warning: exported func T returns unexported type *yang.token, which can be annoying to use (golint)
pkg/yang/modules.go:241:28:warning: error strings should not be capitalized or end with punctuation or a newline (golint)
pkg/yang/node.go:56:1:warning: exported method ErrorNode.Kind should have comment or be unexported (golint)
pkg/yang/node.go:57:1:warning: exported method ErrorNode.ParentNode should have comment or be unexported (golint)
pkg/yang/node.go:58:1:warning: exported method ErrorNode.NName should have comment or be unexported (golint)
pkg/yang/node.go:59:1:warning: exported method ErrorNode.Statement should have comment or be unexported (golint)
pkg/yang/node.go:60:1:warning: exported method ErrorNode.Exts should have comment or be unexported (golint)
pkg/yang/parse.go:73:1:warning: exported method Statement.NName should have comment or be unexported (golint)
pkg/yang/parse.go:74:1:warning: exported method Statement.Kind should have comment or be unexported (golint)
pkg/yang/parse.go:75:1:warning: exported method Statement.Statement should have comment or be unexported (golint)
pkg/yang/parse.go:76:1:warning: exported method Statement.ParentNode should have comment or be unexported (golint)
pkg/yang/parse.go:77:1:warning: exported method Statement.Exts should have comment or be unexported (golint)
pkg/yang/types_builtin.go:35:2:warning: exported const Ynone should have comment (or a comment on this block) or be unexported (golint)
pkg/yang/types_builtin.go:58:5:warning: exported var TypeKindFromName should have comment or be unexported (golint)
pkg/yang/types_builtin.go:81:5:warning: exported var TypeKindToName should have comment or be unexported (golint)
pkg/yang/types_builtin.go:248:6:warning: type name will be used as yang.YangType by other packages, and that stutters; consider calling this Type (golint)
pkg/yang/types_builtin.go:453:2:warning: exported const MaxInt64 should have comment (or a comment on this block) or be unexported (golint)
pkg/yang/types_builtin.go:461:6:warning: exported type NumberKind should have comment or be unexported (golint)
pkg/yang/types_builtin.go:464:2:warning: exported const Positive should have comment (or a comment on this block) or be unexported (golint)
pkg/yang/types_builtin.go:616:6:warning: type name will be used as yang.YangRange by other packages, and that stutters; consider calling this Range (golint)
pkg/yang/yang.go:55:1:warning: receiver name v should be consistent with previous receiver name s for Value (golint)
pkg/yang/yang.go:81:1:warning: receiver name v should be consistent with previous receiver name s for Value (golint)
pkg/yang/yang.go:98:1:warning: receiver name v should be consistent with previous receiver name s for Value (golint)
pkg/yang/yang.go:156:1:warning: exported method Module.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:162:1:warning: exported method Module.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:163:1:warning: exported method Module.NName should have comment or be unexported (golint)
pkg/yang/yang.go:164:1:warning: exported method Module.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:165:1:warning: exported method Module.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:166:1:warning: exported method Module.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:167:1:warning: exported method Module.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:168:1:warning: exported method Module.Identities should have comment or be unexported (golint)
pkg/yang/yang.go:193:1:warning: receiver name m should be consistent with previous receiver name s for Module (golint)
pkg/yang/yang.go:202:1:warning: receiver name m should be consistent with previous receiver name s for Module (golint)
pkg/yang/yang.go:230:1:warning: exported method Import.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:231:1:warning: exported method Import.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:232:1:warning: exported method Import.NName should have comment or be unexported (golint)
pkg/yang/yang.go:233:1:warning: exported method Import.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:234:1:warning: exported method Import.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:250:1:warning: exported method Include.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:251:1:warning: exported method Include.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:252:1:warning: exported method Include.NName should have comment or be unexported (golint)
pkg/yang/yang.go:253:1:warning: exported method Include.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:254:1:warning: exported method Include.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:267:1:warning: exported method Revision.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:268:1:warning: exported method Revision.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:269:1:warning: exported method Revision.NName should have comment or be unexported (golint)
pkg/yang/yang.go:270:1:warning: exported method Revision.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:271:1:warning: exported method Revision.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:283:1:warning: exported method BelongsTo.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:284:1:warning: exported method BelongsTo.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:285:1:warning: exported method BelongsTo.NName should have comment or be unexported (golint)
pkg/yang/yang.go:286:1:warning: exported method BelongsTo.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:287:1:warning: exported method BelongsTo.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:306:1:warning: exported method Typedef.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:307:1:warning: exported method Typedef.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:308:1:warning: exported method Typedef.NName should have comment or be unexported (golint)
pkg/yang/yang.go:309:1:warning: exported method Typedef.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:310:1:warning: exported method Typedef.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:335:1:warning: exported method Type.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:336:1:warning: exported method Type.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:337:1:warning: exported method Type.NName should have comment or be unexported (golint)
pkg/yang/yang.go:338:1:warning: exported method Type.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:339:1:warning: exported method Type.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:370:1:warning: exported method Container.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:371:1:warning: exported method Container.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:372:1:warning: exported method Container.NName should have comment or be unexported (golint)
pkg/yang/yang.go:373:1:warning: exported method Container.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:374:1:warning: exported method Container.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:375:1:warning: exported method Container.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:376:1:warning: exported method Container.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:391:1:warning: exported method Must.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:392:1:warning: exported method Must.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:393:1:warning: exported method Must.NName should have comment or be unexported (golint)
pkg/yang/yang.go:394:1:warning: exported method Must.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:395:1:warning: exported method Must.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:417:1:warning: exported method Leaf.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:418:1:warning: exported method Leaf.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:419:1:warning: exported method Leaf.NName should have comment or be unexported (golint)
pkg/yang/yang.go:420:1:warning: exported method Leaf.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:421:1:warning: exported method Leaf.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:445:1:warning: exported method LeafList.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:446:1:warning: exported method LeafList.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:447:1:warning: exported method LeafList.NName should have comment or be unexported (golint)
pkg/yang/yang.go:448:1:warning: exported method LeafList.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:449:1:warning: exported method LeafList.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:484:1:warning: exported method List.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:485:1:warning: exported method List.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:486:1:warning: exported method List.NName should have comment or be unexported (golint)
pkg/yang/yang.go:487:1:warning: exported method List.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:488:1:warning: exported method List.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:489:1:warning: exported method List.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:490:1:warning: exported method List.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:516:1:warning: exported method Choice.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:517:1:warning: exported method Choice.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:518:1:warning: exported method Choice.NName should have comment or be unexported (golint)
pkg/yang/yang.go:519:1:warning: exported method Choice.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:520:1:warning: exported method Choice.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:544:1:warning: exported method Case.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:545:1:warning: exported method Case.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:546:1:warning: exported method Case.NName should have comment or be unexported (golint)
pkg/yang/yang.go:547:1:warning: exported method Case.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:548:1:warning: exported method Case.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:567:1:warning: exported method AnyXML.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:568:1:warning: exported method AnyXML.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:569:1:warning: exported method AnyXML.NName should have comment or be unexported (golint)
pkg/yang/yang.go:570:1:warning: exported method AnyXML.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:571:1:warning: exported method AnyXML.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:593:1:warning: exported method AnyData.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:594:1:warning: exported method AnyData.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:595:1:warning: exported method AnyData.NName should have comment or be unexported (golint)
pkg/yang/yang.go:596:1:warning: exported method AnyData.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:597:1:warning: exported method AnyData.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:623:1:warning: exported method Grouping.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:624:1:warning: exported method Grouping.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:625:1:warning: exported method Grouping.NName should have comment or be unexported (golint)
pkg/yang/yang.go:626:1:warning: exported method Grouping.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:627:1:warning: exported method Grouping.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:628:1:warning: exported method Grouping.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:629:1:warning: exported method Grouping.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:647:1:warning: exported method Uses.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:648:1:warning: exported method Uses.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:649:1:warning: exported method Uses.NName should have comment or be unexported (golint)
pkg/yang/yang.go:650:1:warning: exported method Uses.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:651:1:warning: exported method Uses.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:671:1:warning: exported method Refine.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:672:1:warning: exported method Refine.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:673:1:warning: exported method Refine.NName should have comment or be unexported (golint)
pkg/yang/yang.go:674:1:warning: exported method Refine.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:675:1:warning: exported method Refine.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:694:1:warning: exported method RPC.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:695:1:warning: exported method RPC.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:696:1:warning: exported method RPC.NName should have comment or be unexported (golint)
pkg/yang/yang.go:697:1:warning: exported method RPC.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:698:1:warning: exported method RPC.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:699:1:warning: exported method RPC.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:700:1:warning: exported method RPC.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:721:1:warning: exported method Input.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:722:1:warning: exported method Input.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:723:1:warning: exported method Input.NName should have comment or be unexported (golint)
pkg/yang/yang.go:724:1:warning: exported method Input.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:725:1:warning: exported method Input.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:726:1:warning: exported method Input.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:727:1:warning: exported method Input.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:748:1:warning: exported method Output.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:749:1:warning: exported method Output.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:750:1:warning: exported method Output.NName should have comment or be unexported (golint)
pkg/yang/yang.go:751:1:warning: exported method Output.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:752:1:warning: exported method Output.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:753:1:warning: exported method Output.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:754:1:warning: exported method Output.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:779:1:warning: exported method Notification.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:780:1:warning: exported method Notification.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:781:1:warning: exported method Notification.NName should have comment or be unexported (golint)
pkg/yang/yang.go:782:1:warning: exported method Notification.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:783:1:warning: exported method Notification.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:784:1:warning: exported method Notification.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:785:1:warning: exported method Notification.Typedefs should have comment or be unexported (golint)
pkg/yang/yang.go:812:1:warning: exported method Augment.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:813:1:warning: exported method Augment.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:814:1:warning: exported method Augment.NName should have comment or be unexported (golint)
pkg/yang/yang.go:815:1:warning: exported method Augment.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:816:1:warning: exported method Augment.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:832:1:warning: exported method Identity.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:833:1:warning: exported method Identity.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:834:1:warning: exported method Identity.NName should have comment or be unexported (golint)
pkg/yang/yang.go:835:1:warning: exported method Identity.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:836:1:warning: exported method Identity.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:877:1:warning: exported method Extension.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:878:1:warning: exported method Extension.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:879:1:warning: exported method Extension.NName should have comment or be unexported (golint)
pkg/yang/yang.go:880:1:warning: exported method Extension.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:881:1:warning: exported method Extension.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:893:1:warning: exported method Argument.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:894:1:warning: exported method Argument.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:895:1:warning: exported method Argument.NName should have comment or be unexported (golint)
pkg/yang/yang.go:896:1:warning: exported method Argument.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:897:1:warning: exported method Argument.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:909:1:warning: exported method Element.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:910:1:warning: exported method Element.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:911:1:warning: exported method Element.NName should have comment or be unexported (golint)
pkg/yang/yang.go:912:1:warning: exported method Element.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:913:1:warning: exported method Element.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:928:1:warning: exported method Feature.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:929:1:warning: exported method Feature.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:930:1:warning: exported method Feature.NName should have comment or be unexported (golint)
pkg/yang/yang.go:931:1:warning: exported method Feature.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:932:1:warning: exported method Feature.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:946:1:warning: exported method Deviation.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:947:1:warning: exported method Deviation.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:948:1:warning: exported method Deviation.NName should have comment or be unexported (golint)
pkg/yang/yang.go:949:1:warning: exported method Deviation.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:950:1:warning: exported method Deviation.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:970:1:warning: exported method Deviate.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:971:1:warning: exported method Deviate.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:972:1:warning: exported method Deviate.NName should have comment or be unexported (golint)
pkg/yang/yang.go:973:1:warning: exported method Deviate.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:974:1:warning: exported method Deviate.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:989:1:warning: exported method Enum.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:990:1:warning: exported method Enum.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:991:1:warning: exported method Enum.NName should have comment or be unexported (golint)
pkg/yang/yang.go:992:1:warning: exported method Enum.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:993:1:warning: exported method Enum.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1008:1:warning: exported method Bit.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:1009:1:warning: exported method Bit.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:1010:1:warning: exported method Bit.NName should have comment or be unexported (golint)
pkg/yang/yang.go:1011:1:warning: exported method Bit.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:1012:1:warning: exported method Bit.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1027:1:warning: exported method Range.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:1028:1:warning: exported method Range.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:1029:1:warning: exported method Range.NName should have comment or be unexported (golint)
pkg/yang/yang.go:1030:1:warning: exported method Range.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:1031:1:warning: exported method Range.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1046:1:warning: exported method Length.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:1047:1:warning: exported method Length.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:1048:1:warning: exported method Length.NName should have comment or be unexported (golint)
pkg/yang/yang.go:1049:1:warning: exported method Length.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:1050:1:warning: exported method Length.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1065:1:warning: exported method Pattern.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:1066:1:warning: exported method Pattern.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:1067:1:warning: exported method Pattern.NName should have comment or be unexported (golint)
pkg/yang/yang.go:1068:1:warning: exported method Pattern.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:1069:1:warning: exported method Pattern.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1094:1:warning: exported method Action.Kind should have comment or be unexported (golint)
pkg/yang/yang.go:1095:1:warning: exported method Action.ParentNode should have comment or be unexported (golint)
pkg/yang/yang.go:1096:1:warning: exported method Action.NName should have comment or be unexported (golint)
pkg/yang/yang.go:1097:1:warning: exported method Action.Statement should have comment or be unexported (golint)
pkg/yang/yang.go:1098:1:warning: exported method Action.Exts should have comment or be unexported (golint)
pkg/yang/yang.go:1099:1:warning: exported method Action.Groupings should have comment or be unexported (golint)
pkg/yang/yang.go:1100:1:warning: exported method Action.Typedefs should have comment or be unexported (golint)
protogen/protogen.go:50:1:warning: exported function GetProtoFlags should have comment or be unexported (golint)
protogen/protogen.go:95:1:warning: exported function Generate should have comment or be unexported (golint)
protogen/protogen.go:294:1:warning: receiver name m should be consistent with previous receiver name mi for messageInfo (golint)
protogen/protogen.go:668:41:warning: error strings should not be capitalized or end with punctuation or a newline (golint)
protogen/protogen.go:680:41:warning: error strings should not be capitalized or end with punctuation or a newline (golint)
treegen/treegen.go:34:1:warning: exported function Generate should have comment or be unexported (golint)
typesgen/typesgen.go:43:1:warning: exported function Generate should have comment or be unexported (golint)
pkg/yang/ast.go:236::warning: line is 173 characters (lll)
pkg/yang/entry_test.go:1160::warning: line is 179 characters (lll)
results/ietf_interfaces_2014_05_08.pb.go:111::warning: line is 202 characters (lll)
results/ietf_interfaces_2014_05_08.pb.go:117::warning: line is 198 characters (lll)
results/ietf_interfaces_2014_05_08.pb.go:332::warning: line is 165 characters (lll)
results/ietf_interfaces_2014_05_08.pb.go:333::warning: line is 162 characters (lll)
proto.go:407::warning: cyclomatic complexity 44 of function (*protofile).printNode() is high (> 10) (gocyclo)
proto.go:80::warning: cyclomatic complexity 25 of function doProto() is high (> 10) (gocyclo)
yang.go:129::warning: cyclomatic complexity 21 of function main() is high (> 10) (gocyclo)
tree.go:44::warning: cyclomatic complexity 20 of function Write() is high (> 10) (gocyclo)
types.go:77::warning: cyclomatic complexity 18 of function printType() is high (> 10) (gocyclo)
proto.go:354::warning: cyclomatic complexity 15 of function (*protofile).printService() is high (> 10) (gocyclo)
pkg/yang/entry.go:333::warning: cyclomatic complexity 94 of function ToEntry() is high (> 10) (gocyclo)
pkg/yang/types.go:161::warning: cyclomatic complexity 59 of function (*Type).resolve() is high (> 10) (gocyclo)
pkg/yang/ast.go:256::warning: cyclomatic complexity 37 of function initTypes() is high (> 10) (gocyclo)
pkg/yang/identity_test.go:407::warning: cyclomatic complexity 29 of function TestIdentityTree() is high (> 10) (gocyclo)
pkg/yang/ast.go:90::warning: cyclomatic complexity 28 of function build() is high (> 10) (gocyclo)
pkg/yang/ast_test.go:43::warning: cyclomatic complexity 22 of function (*MainNode).checkEqual() is high (> 10) (gocyclo)
pkg/yang/lex.go:410::warning: cyclomatic complexity 21 of function lexQString() is high (> 10) (gocyclo)
pkg/yang/node.go:141::warning: cyclomatic complexity 21 of function FindNode() is high (> 10) (gocyclo)
pkg/yang/entry.go:769::warning: cyclomatic complexity 18 of function (*Entry).Find() is high (> 10) (gocyclo)
pkg/yang/node.go:237::warning: cyclomatic complexity 16 of function ChildNode() is high (> 10) (gocyclo)
pkg/yang/camelcase.go:38::warning: cyclomatic complexity 15 of function CamelCase() is high (> 10) (gocyclo)
pkg/yang/find.go:50::warning: cyclomatic complexity 14 of function FindGrouping() is high (> 10) (gocyclo)
pkg/yang/node.go:301::warning: cyclomatic complexity 14 of function PrintNode() is high (> 10) (gocyclo)
pkg/yang/modules.go:317::warning: cyclomatic complexity 14 of function (*Modules).Process() is high (> 10) (gocyclo)
pkg/yang/parse.go:270::warning: cyclomatic complexity 14 of function (*parser).nextStatement() is high (> 10) (gocyclo)
pkg/yang/parse.go:114::warning: cyclomatic complexity 13 of function (*Statement).Write() is high (> 10) (gocyclo)
pkg/yang/parse.go:220::warning: cyclomatic complexity 13 of function (*parser).next() is high (> 10) (gocyclo)
pkg/yang/entry_test.go:840::warning: cyclomatic complexity 12 of function TestActionRPC() is high (> 10) (gocyclo)
pkg/yang/file.go:129::warning: cyclomatic complexity 12 of function findInDir() is high (> 10) (gocyclo)
pkg/yang/types_builtin.go:760::warning: cyclomatic complexity 12 of function (YangRange).Contains() is high (> 10) (gocyclo)
pkg/yang/entry.go:945::warning: cyclomatic complexity 12 of function (sortedErrors).Less() is high (> 10) (gocyclo)
pkg/yang/types_builtin.go:577::warning: cyclomatic complexity 11 of function (Number).Less() is high (> 10) (gocyclo)
pkg/yang/parse_test.go:56::warning: cyclomatic complexity 11 of function TestParse() is high (> 10) (gocyclo)
pkg/yang/identity_test.go:101::warning: cyclomatic complexity 11 of function TestIdentityExtract() is high (> 10) (gocyclo)
pkg/yang/entry_test.go:486::warning: cyclomatic complexity 11 of function TestFullModuleProcess() is high (> 10) (gocyclo)
pkg/yang/entry_test.go:753::warning: cyclomatic complexity 11 of function TestAnyDataAnyXML() is high (> 10) (gocyclo)
pkg/yang/types_test.go:22::warning: cyclomatic complexity 11 of function TestTypeResolve() is high (> 10) (gocyclo)
pkg/yang/entry.go:130::warning: cyclomatic complexity 11 of function (*Entry).Print() is high (> 10) (gocyclo)
protogen/protogen.go:426::warning: cyclomatic complexity 46 of function (*protofile).printNode() is high (> 10) (gocyclo)
protogen/protogen.go:99::warning: cyclomatic complexity 25 of function doProto() is high (> 10) (gocyclo)
protogen/protogen.go:373::warning: cyclomatic complexity 15 of function (*protofile).printService() is high (> 10) (gocyclo)
sysrepogen/sysrepogen.go:91::warning: cyclomatic complexity 21 of function doSysrepo() is high (> 10) (gocyclo)
sysrepogen/sysrepogen.go:325::warning: cyclomatic complexity 18 of function (*protofile).printNode() is high (> 10) (gocyclo)
treegen/treegen.go:45::warning: cyclomatic complexity 20 of function Write() is high (> 10) (gocyclo)
typesgen/typesgen.go:80::warning: cyclomatic complexity 18 of function printType() is high (> 10) (gocyclo)
pkg/yang/file.go:52::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:176::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:192::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:311::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:313::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:314::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:317::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:340::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/lex.go:343::warning: Errors unhandled.,LOW,HIGH (gas)
pkg/yang/types.go:174:2:warning: ineffectual assignment to source (ineffassign)
pkg/yang/types_builtin.go:777:6:warning: ineffectual assignment to ok (ineffassign)
pkg/yang/entry.go:574:8:warning: 2 other occurrence(s) of "leaf" found in: node.go:215:20 yang.go:417:48 (goconst)
pkg/yang/node.go:215:20:warning: 2 other occurrence(s) of "leaf" found in: entry.go:574:8 yang.go:417:48 (goconst)
pkg/yang/yang.go:417:48:warning: 2 other occurrence(s) of "leaf" found in: entry.go:574:8 node.go:215:20 (goconst)
pkg/yang/entry.go:594:8:warning: 2 other occurrence(s) of "rpc" found in: node.go:201:18 yang.go:694:48 (goconst)
pkg/yang/node.go:201:18:warning: 2 other occurrence(s) of "rpc" found in: entry.go:594:8 yang.go:694:48 (goconst)
pkg/yang/yang.go:694:48:warning: 2 other occurrence(s) of "rpc" found in: entry.go:594:8 node.go:201:18 (goconst)
pkg/yang/entry.go:514:8:warning: 2 other occurrence(s) of "choice" found in: node.go:215:10 yang.go:516:50 (goconst)
pkg/yang/node.go:215:10:warning: 2 other occurrence(s) of "choice" found in: entry.go:514:8 yang.go:516:50 (goconst)
pkg/yang/yang.go:516:50:warning: 2 other occurrence(s) of "choice" found in: entry.go:514:8 node.go:215:10 (goconst)
pkg/yang/node.go:251:12:warning: 2 other occurrence(s) of "nomerge" found in: node.go:315:12 ast.go:291:14 (goconst)
pkg/yang/node.go:315:12:warning: 2 other occurrence(s) of "nomerge" found in: node.go:251:12 ast.go:291:14 (goconst)
pkg/yang/ast.go:291:14:warning: 2 other occurrence(s) of "nomerge" found in: node.go:251:12 node.go:315:12 (goconst)
pkg/yang/modules.go:130:7:warning: 3 other occurrence(s) of "submodule" found in: node.go:111:7 node.go:167:20 yang.go:158:10 (goconst)
pkg/yang/node.go:111:7:warning: 3 other occurrence(s) of "submodule" found in: modules.go:130:7 node.go:167:20 yang.go:158:10 (goconst)
pkg/yang/node.go:167:20:warning: 3 other occurrence(s) of "submodule" found in: modules.go:130:7 node.go:111:7 yang.go:158:10 (goconst)
pkg/yang/yang.go:158:10:warning: 3 other occurrence(s) of "submodule" found in: modules.go:130:7 node.go:111:7 node.go:167:20 (goconst)
pkg/yang/entry.go:57:10:warning: 2 other occurrence(s) of "true" found in: entry.go:364:9 yang.go:87:7 (goconst)
pkg/yang/entry.go:364:9:warning: 2 other occurrence(s) of "true" found in: entry.go:57:10 yang.go:87:7 (goconst)
pkg/yang/yang.go:87:7:warning: 2 other occurrence(s) of "true" found in: entry.go:57:10 entry.go:364:9 (goconst)
pkg/yang/entry.go:510:8:warning: 2 other occurrence(s) of "case" found in: node.go:215:28 yang.go:544:48 (goconst)
pkg/yang/node.go:215:28:warning: 2 other occurrence(s) of "case" found in: entry.go:510:8 yang.go:544:48 (goconst)
pkg/yang/yang.go:544:48:warning: 2 other occurrence(s) of "case" found in: entry.go:510:8 node.go:215:28 (goconst)
pkg/yang/entry.go:602:8:warning: 2 other occurrence(s) of "input" found in: entry.go:608:24 yang.go:721:50 (goconst)
pkg/yang/entry.go:608:24:warning: 2 other occurrence(s) of "input" found in: entry.go:602:8 yang.go:721:50 (goconst)
pkg/yang/yang.go:721:50:warning: 2 other occurrence(s) of "input" found in: entry.go:602:8 entry.go:608:24 (goconst)
pkg/yang/modules.go:128:7:warning: 2 other occurrence(s) of "module" found in: node.go:107:7 yang.go:160:9 (goconst)
pkg/yang/node.go:107:7:warning: 2 other occurrence(s) of "module" found in: modules.go:128:7 yang.go:160:9 (goconst)
pkg/yang/yang.go:160:9:warning: 2 other occurrence(s) of "module" found in: modules.go:128:7 node.go:107:7 (goconst)
pkg/yang/node.go:71:9:warning: 2 other occurrence(s) of "unknown" found in: parse.go:100:10 types.go:174:12 (goconst)
pkg/yang/parse.go:100:10:warning: 2 other occurrence(s) of "unknown" found in: node.go:71:9 types.go:174:12 (goconst)
pkg/yang/types.go:174:12:warning: 2 other occurrence(s) of "unknown" found in: node.go:71:9 parse.go:100:10 (goconst)
pkg/yang/entry.go:59:10:warning: 2 other occurrence(s) of "false" found in: entry.go:366:9 yang.go:89:7 (goconst)
pkg/yang/entry.go:366:9:warning: 2 other occurrence(s) of "false" found in: entry.go:59:10 yang.go:89:7 (goconst)
pkg/yang/yang.go:89:7:warning: 2 other occurrence(s) of "false" found in: entry.go:59:10 entry.go:366:9 (goconst)
pkg/yang/entry.go:611:8:warning: 2 other occurrence(s) of "output" found in: entry.go:617:25 yang.go:748:51 (goconst)
pkg/yang/entry.go:617:25:warning: 2 other occurrence(s) of "output" found in: entry.go:611:8 yang.go:748:51 (goconst)
pkg/yang/yang.go:748:51:warning: 2 other occurrence(s) of "output" found in: entry.go:611:8 entry.go:617:25 (goconst)
pkg/yang/entry.go:624:8:warning: 2 other occurrence(s) of "uses" found in: node.go:267:18 yang.go:647:48 (goconst)
pkg/yang/node.go:267:18:warning: 2 other occurrence(s) of "uses" found in: entry.go:624:8 yang.go:647:48 (goconst)
pkg/yang/yang.go:647:48:warning: 2 other occurrence(s) of "uses" found in: entry.go:624:8 node.go:267:18 (goconst)
proto.go:304:59:warning: "presense" is a misspelling of "presence" (misspell)
proto.go:657:65:warning: "decendents" is a misspelling of "descendants" (misspell)
types.go:63:48:warning: "decendents" is a misspelling of "descendants" (misspell)
pkg/yang/ast.go:210:3:warning: "exeptional" is a misspelling of "exceptional" (misspell)
pkg/yang/ast.go:329:47:warning: "actaully" is a misspelling of "actually" (misspell)
pkg/yang/ast_test.go:315:29:warning: "absense" is a misspelling of "absence" (misspell)
pkg/yang/doc.go:22:37:warning: "retuns" is a misspelling of "returns" (misspell)
pkg/yang/entry.go:74:61:warning: "encounterd" is a misspelling of "encountered" (misspell)
pkg/yang/entry.go:283:38:warning: "dupicate" is a misspelling of "duplicate" (misspell)
pkg/yang/modules.go:99:60:warning: "searchs" is a misspelling of "searches" (misspell)
pkg/yang/node.go:88:41:warning: "statment" is a misspelling of "statement" (misspell)
pkg/yang/node.go:90:47:warning: "statment" is a misspelling of "statement" (misspell)
pkg/yang/parse.go:19:32:warning: "Statment" is a misspelling of "Statement" (misspell)
pkg/yang/parse_test.go:38:16:warning: "statment" is a misspelling of "statement" (misspell)
pkg/yang/parse_test.go:48:15:warning: "statment" is a misspelling of "statement" (misspell)
pkg/yang/types_builtin.go:495:13:warning: "hexidecimal" is a misspelling of "hexadecimal" (misspell)
protogen/protogen.go:323:59:warning: "presense" is a misspelling of "presence" (misspell)
protogen/protogen.go:687:65:warning: "decendents" is a misspelling of "descendants" (misspell)
yang.go:61:2:warning: typesDebug redeclared in this block (interfacer)
types.go:28:2:warning: other declaration of typesDebug (interfacer)
yang.go:62:2:warning: typesVerbose redeclared in this block (interfacer)
types.go:29:2:warning: other declaration of typesVerbose (interfacer)
typesgen/typesgen.go:66:48:warning: "decendents" is a misspelling of "descendants" (misspell)
tree.go:1::warning: file is not goimported (goimports)
yang.go:61:2:warning: typesDebug redeclared in this block (unconvert)
types.go:28:2:warning: other declaration of typesDebug (unconvert)
yang.go:62:2:warning: typesVerbose redeclared in this block (unconvert)
types.go:29:2:warning: other declaration of typesVerbose (unconvert)
yang.go:61:2:warning: unused struct field typesDebug redeclared in this block (structcheck)
types.go:28:2:warning: unused struct field other declaration of typesDebug (structcheck)
yang.go:62:2:warning: unused struct field typesVerbose redeclared in this block (structcheck)
types.go:29:2:warning: unused struct field other declaration of typesVerbose (structcheck)
yang.go:61:2:warning: error return value not checked (typesDebug redeclared in this block) (errcheck)
types.go:28:2:warning: error return value not checked (other declaration of typesDebug) (errcheck)
yang.go:62:2:warning: error return value not checked (typesVerbose redeclared in this block) (errcheck)
types.go:29:2:warning: error return value not checked (other declaration of typesVerbose) (errcheck)
pkg/yang/marshal_test.go:22:2:warning: error return value not checked (could not import github.com/kylelemons/godebug/pretty (cannot find package "github.com/kylelemons/godebug/pretty" in any of:) (errcheck)
pkg/yang/marshal_test.go:273:14:warning: error return value not checked (undeclared name: pretty) (errcheck)
pkg/yang/marshal_test.go:590:17:warning: error return value not checked (undeclared name: pretty) (errcheck)
yang.go:61:2:warning: typesDebug redeclared in this block (gosimple)
types.go:28:2:warning: other declaration of typesDebug (gosimple)
yang.go:62:2:warning: typesVerbose redeclared in this block (gosimple)
types.go:29:2:warning: other declaration of typesVerbose (gosimple)
pkg/yang/marshal_test.go:22:2:warning: could not import github.com/kylelemons/godebug/pretty (cannot find package "github.com/kylelemons/godebug/pretty" in any of: (gosimple)
pkg/yang/marshal_test.go:273:14:warning: undeclared name: pretty (gosimple)
pkg/yang/marshal_test.go:590:17:warning: undeclared name: pretty (gosimple)
yang.go:61:2:warning: unused variable or constant typesDebug redeclared in this block (varcheck)
types.go:28:2:warning: unused variable or constant other declaration of typesDebug (varcheck)
yang.go:62:2:warning: unused variable or constant typesVerbose redeclared in this block (varcheck)
types.go:29:2:warning: unused variable or constant other declaration of typesVerbose (varcheck)
pkg/yang/marshal_test.go:22:2:warning: unused variable or constant could not import github.com/kylelemons/godebug/pretty (cannot find package "github.com/kylelemons/godebug/pretty" in any of: (varcheck)
pkg/yang/marshal_test.go:273:14:warning: unused variable or constant undeclared name: pretty (varcheck)
pkg/yang/marshal_test.go:590:17:warning: unused variable or constant undeclared name: pretty (varcheck)
yang.go:61:2:warning: typesDebug redeclared in this block (staticcheck)
types.go:28:2:warning: other declaration of typesDebug (staticcheck)
yang.go:62:2:warning: typesVerbose redeclared in this block (staticcheck)
types.go:29:2:warning: other declaration of typesVerbose (staticcheck)
pkg/yang/marshal_test.go:22:2:warning: could not import github.com/kylelemons/godebug/pretty (cannot find package "github.com/kylelemons/godebug/pretty" in any of: (staticcheck)
pkg/yang/marshal_test.go:273:14:warning: undeclared name: pretty (staticcheck)
pkg/yang/marshal_test.go:590:17:warning: undeclared name: pretty (staticcheck)
pkg/yang/camelcase.go:1::warning: file is not goimported (goimports)
The lint process has exited with status code 1, view the log for more details.
For a yang.Entry
, Prefix
is only set when the current node has a prefix
statement. This is only the case for the entry corresponding a yang.Module
.
When a grouping
statement is "entry-ised", the entry corresponding the grouping
has a nil Parent
. This means that when the grouping
is placed in a uses
(i.e., in some other module), we will never be able to ascend the Parent
entries to determine the current prefix.
One solution would be to simply set the Prefix
for each entry.
Hello,
I am using goyang to process MIB-YANG modules obtained after converting SMIv2 files with SMIDUMP.
This issue is about special errors that trigger "index out of range" while processing a module.
To reproduce:
goyang CISCO-IMAGE-TC.yang
Output should be:
goyang CISCO-IETF-PW-ATM-MIB.yang
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/openconfig/goyang/pkg/yang.sortedErrors.Less.func1(0x1, 0x5c)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/entry.go:1058 +0x10d
github.com/openconfig/goyang/pkg/yang.sortedErrors.Less(0xc8203c2fc0, 0x6, 0x6, 0x1, 0x0, 0x422999)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/entry.go:1061 +0x27f
github.com/openconfig/goyang/pkg/yang.(*sortedErrors).Less(0xc8204bf840, 0x1, 0x0, 0x422169)
<autogenerated>:67 +0xb5
sort.insertionSort(0x7f72c9e86750, 0xc8204bf840, 0x0, 0x6)
/usr/lib/golang/src/sort/sort.go:32 +0x6f
sort.quickSort(0x7f72c9e86750, 0xc8204bf840, 0x0, 0x6, 0x6)
/usr/lib/golang/src/sort/sort.go:184 +0x153
sort.Sort(0x7f72c9e86750, 0xc8204bf840)
/usr/lib/golang/src/sort/sort.go:199 +0x74
github.com/openconfig/goyang/pkg/yang.errorSort(0xc8203a7680, 0x6, 0x8, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/entry.go:1085 +0x2c6
github.com/openconfig/goyang/pkg/yang.(*Entry).GetErrors(0xc820133c20, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/entry.go:338 +0xbd
github.com/openconfig/goyang/pkg/yang.(*Modules).Process(0xc8200bc0c0, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/modules.go:380 +0xc96
main.main()
/home/camcardo/go/src/github.com/openconfig/goyang/yang.go:192 +0x18bb
The function raising the errors is sortedErrors.Less:
func (s sortedErrors) Less(i, j int) bool {
fi := strings.SplitN(s[i].s, ":", 4)
fj := strings.SplitN(s[j].s, ":", 4)
if fi[0] < fj[0] {
return true
}
if fi[0] > fj[0] {
return false
}
// compare compares field x to see which is less.
// numbers are compared as numbers.
compare := func(x int) int {
switch {
case len(fi) == x && len(fj) > x:
return -1
case len(fj) == x && len(fi) > x:
return 1
case len(fj) < x || len(fi) < x:
return 0
}
return nless(fi[x], fj[x])
}
for x := 1; x < 4; x++ {
switch compare(1) {
case -1:
return true
case 1:
return false
}
}
return false
}
Two observations here:
Thanks.
YANG 1.1 allows usage of "reference" and "description" statements inside "import" statement.
Example of such usage is in ietf-routing from RFC 8349.
Hi *,
If I have a YANG module which comes in a form [email protected]
and I provide a full path to that file to the ms.Read()
function:
ms := yang.NewModules()
if err := ms.Read("/tmp/[email protected]"); err != nil {
log.Info(err)
}
I end up having two modules added to the ms
:
This is due to that part which I can't quite understand the meaning of.
https://github.com/openconfig/goyang/blob/master/pkg/yang/modules.go#L148
Is this intended? If so, what is the purpose of duplicating the modules under the name with a revision as well as without it?
/cc @andaru @robshakir
Currently in the *Entry tree built by ToEntry() and Augment(), only the children of "augment" statements are merged into the target *Entry during [entry.go].merge(). The "augment" statement itself is discarded, which is problemsome because the "augment" statement also contains the "when" statement. Thus we need a way to save the "augment" statement on the augmented *Entry.
The least intrusive and backwards compatible way is to either
Let me know your comments.
There is some incorrect behaviour where if there are multiple enumerations (typedef or not) within a union, then goyang fails to put all of them within the []*YangType field, meaning downstream tools will not recognize them.
There is some further strange behaviour where if these ignored enumerations are put within another level of nested union, some of them are then added to the AST. In any case, more testing and corresponding fixes are needed for this.
Windows uses a different path separator to that of Unix, and the standard library's "path" module always uses the Unix path separator for its functions, including path.Dir
, path.Base
and path.Join
as used by goyang
. The standard library's path/filepath
package, however, uses the local system's path separator.
A fix for this issue is provided as #31 (tested on Windows 10)
Hi,
It seems unreasonable to print the union type as unionunion
, then I have a small change from unionunion
to union
, using yang module and test results as follows:
mod.yang:
module mod {
namespace "urn:cent";
prefix m;
container bar {
leaf my-mode {
type union {
type string;
type enumeration {
enum short;
enum long;
enum wide;
}
}
}
}
}
test results with goyang -f types with mod.yang
:
#$goyang -f types mod.yang
unionunion{
string;
enumeration;
}
In YANG 1.1 (RFC7950), action
statements are like rpc
elements which apply to a specific container(s) or list(s) (plurality via grouping application).
goyang
should support lexing action
statements and importing them to *Entry
, similarly to rpc
statements. However, while rpc
statements exist only as direct children of the module
statement, action
may appear in the schema as direct children of the container
, list
, grouping
, or augment
statements.
Currently, goyang
fails to load modules with action
statements, issuing errors such as:
[email protected]:447:9: unknown list field: action
ietf-keychain.yang:129:9: unknown list field: action
If only posix-pattern is provided, then unions would be parsed incorrectly.
Hi,
I'm facing an issue with the method here: https://github.com/openconfig/goyang/blob/master/pkg/yang/entry.go#L1459
In the below code, the case where len(fi) == len(fi) == x, nless ends up panicking due to index out of range.
compare := func(x int) int {
switch {
case len(fi) == x && len(fj) > x:
return -1
case len(fj) == x && len(fi) > x:
return 1
case len(fj) < x && len(fi) < x:
return 0
}
return nless(fi[x], fj[x])
}
In my use case, both fi
and fj
are identical with len == 1.
Also, I might be wrong but shouldn't compare
take x (not 1) in the below code ?
for x := 1; x < 4; x++ {
switch compare(1) {
case -1:
return true
case 1:
return false
}
}
Hello,
I am using your great library while working on an implementation of a library that is parsing yang files and does some processing with them (in relation to this). Recently I realized parsing many models makes my library leak memory. After some debugging I discovered that it should be because of the use of typeDict that is growing with each model parsing. I would be willing to work on resolving this issue, but as I saw that there is already a TODO
comment around it, I imagine you already have an idea what would be a good solution for you. The best solution for me would be to have reference to the typeDict
in the Modules
type, but it seems that some initialization is done for the default types, which would make that more difficult (we can have separate typeDict
for the built-in types and the parsed ones). Do you have better ideas and would you be willing to review and possibly merge such a change?
Thank you in advance!
goyang installation is failing as shown below.
[user@host ~/go/src ] go get github.com/openconfig/goyang
package github.com/openconfig/goyang
imports runtime/trace: unrecognized import path "runtime/trace"
[user@host ~/go/src ] go version
go version go1.4.2 darwin/amd64
System Version: OS X 10.10.5 (14F1509)
Kernel Version: Darwin 14.5.0
Thanks,
Nilesh
The anydata
statement is defined in YANG 1.1 here.
While goyang
s validation (performed by ToEntry
) is largely YANG 1.0 specific, the input lexer supports reading YANG 1.1 modules as they don't change the syntax dramatically (notable exception: uses
allows more than 1 augment
child in YANG 1.1) and this type is used by IETF standard modules, which are increasingly using YANG 1.1.
Goyang should support lexing and handling anydata
statements as it does anyxml
presently.
In evaluating what changes are necessary to support YANG 1.1 completely in the lexer, I've found one interesting type of breaking change - sub-statement cardinality changes (from 0..1
to 0..n
). Example:
In YANG 1.0, a uses
statement has a child statement augment
, with a cardinality of 0..1
(ref: RFC6020 s7.12.1).
In YANG 1.1, a uses
statement has a child statement augment
, with a cardinality of 0..n
(ref: RFC7951 s7.13.1).
Due to the use of reflection in the YANG lexer, to support this change we could change one field in the Uses
type;
Augment *Augment `yang:"augment"`
to:
Augment []*Augment `yang:"augment"`
However, this causes a breaking change for library users. The Augment
field of Uses
is not used by the goyang
library itself at this point.
Multiple augment
children of a uses
is found in both [email protected]
and [email protected]
, e.g.,
Currently this leads to an error in goyang
: augment: already set
(from pkg/yang/ast.go
, the error returned has no statement location attached at present).
Thoughts on the most appropriate way to make this change?
It should be noted there's a few other cases of this sort of change in YANG 1.1; the refine
substatement of uses
also changes similarly.
Changing from a single pointer to a slice with no other changes would remove the cardinality 0..1
syntax check for YANG 1.0 modules. This could be moved to the ToEntry
function since the whole schema has been lexed (and thus the yang-version
statement is available for determining which syntax and semantic rules to apply to the derived schema). As YANG 1.1 makes other semantic changes (such as its changes to scoping rules for submodules), we will need to make a switch during ToEntry
based on the YANG version.
This issue can be shown with two modules like this:
foo.yang
module foo {
namespace "urn:foo";
prefix "foo";
import bar { prefix "temp-bar"; }
container foo-c {
leaf zzz { type string; }
uses temp-bar:common;
}
uses temp-bar:common;
}
bar.yang
module bar {
namespace "urn:bar";
prefix "bar";
grouping common {
container test1 { leaf str { type string; } }
container test2 { leaf str { type string; } }
}
}
A valid path here should be /foo/foo-c/test1
, but goyang tells us the path of that node is /foo/foo-c/common/test1
. By adding v.Parent = e
before the final e.Dir[k] = v
in Entry.merge()
, this test passes and the correct paths are written.
extension
keyword is not currently implemented, but extension
statements found in YANG files are stored in *yang.Entry.Exts
field. ygot
can retrieve extension
statements from this field and perform further processing.
However, because uses
's grouping
are returned as a deep-copy in ToEntry()
(https://github.com/openconfig/goyang/blob/master/pkg/yang/entry.go#L584), and that the deep-copying function does not copy the Exts
field (https://github.com/openconfig/goyang/blob/master/pkg/yang/entry.go#L1278), extension
statements defined within a uses
's grouping
are effectively lost. This impacts downstream ygot
and protogen
usage.
The comment at https://github.com/openconfig/goyang/blob/master/pkg/yang/entry.go#L1281 said there wasn't a clear use case of copying the Ext
field, but I believe we do now.
What's your opinion on this matter?
@wenovus This is a correction to the misguided issue #106
Given an example module like so,
module example {
yang-version "1";
prefix "ex";
namespace "https://example";
import extensions { prefix exts; }
container C {
exts:extension 1;
uses G {
exts:extension 2;
}
}
grouping G {
exts:extension 3;
leaf L {
exts:extension 4;
type int;
}
container C2 {
leaf L2 {
type int;
}
}
}
}
I would expect ext:extension2
and ext:extension3
are kept in the Entry.Ext
field of all direct child Entry
of grouping G
. In another word, the above module should result in the same Entry
tree as this module:
module example {
yang-version "1";
prefix "ex";
namespace "https://example";
import extensions { prefix exts; }
container C {
exts:extension 1;
leaf L {
exts:extension 2;
exts:extension 3;
exts:extension 4;
type int;
}
container C2 {
exts:extension 2;
exts:extension 3;
leaf L2 {
type int;
}
}
}
}
However, because Entry.Ext
field of the merged Entry
is not kept during merge()
, exts:extension 2
and ext:extension 3
are lost. The Entry
tree we get from our first example module is currently equivalent to this last module:
module example {
yang-version "1";
prefix "ex";
namespace "https://example";
import extensions { prefix exts; }
container C {
exts:extension 1;
leaf L {
exts:extension 4;
type int;
}
container C2 {
leaf L2 {
type int;
}
}
}
}
We have a YANG module that we implement (ietf-routing-policy), but there are some changes that we've made. In order to maintain a separation between the IETF module and our modifications, instead of directly modifying the IETF module, we have removed unsupported nodes using deviations, and added new nodes by augmenting from a separate module.
The problem occurs when we remove an unsupported node and then try to replace it with a different node of the same name. The new node comes from a different module and therefore has a different prefix, but Entry.Dir
only cares about unprefixed names. So when the deviations are applied, it wipes out the new node.
I'm aware that prefix handling is incomplete (#5) in goyang, and that we cannot change the way Entry.Dir
works without serious consequences. I would like to propose a workaround, in which we maintain a secondary map Entry.PrefixedDir
which acts exactly like Entry.Dir
except that its map keys are qualified with a prefix.
I have a branch in which I've made these changes, but I wanted to get feedback before submitting a PR.
Can do this in Settings -> Branch
https://github.com/github/renaming#renaming-existing-branches
Currently, goyang does not safely allow multiple sets of modules to be processed within a single process instance. The user has to fire up a different process in order to parse a different set of files, especially if the files use a modified version of a module.
The task is to put any global options and cache variables in a struct, and for that struct's methods to do processing of files. This work would most likely modify the Modules
struct modules.go to achieve this to minimize backwards-incompatible changes.
*Entry's "Uses" field currently is omitted when marshalling into JSON, but we should support it.
https://tools.ietf.org/html/rfc6020#page-120 says.
9.6.4. The enum Statement
It takes as an argument a string which is the assigned name. The
string MUST NOT be empty and MUST NOT have any leading or trailing
whitespace characters. The use of Unicode control codes SHOULD be
avoided.
The above is distinct and looser than the rule for yang identifiers I.e.
“Each identifier starts with an uppercase or lowercase ASCII
letter or an underscore character, followed by zero or more ASCII
letters, digits, underscore characters, hyphens, and dots.”
https://github.com/openconfig/ygot/blob/85c2a616f482be9dd965356733947cd77f9e84bd/ygen/helpers.go#L24
references in comments rules for RFC6020 Section 6.2, a YANG identifier, but has rules for some extra special characters.
func safeGoEnumeratedValueName(name string) string {
// NewReplacer takes pairs of strings to be replaced in the form
// old, new.
replacer := strings.NewReplacer(
".", "_",
"-", "_",
"/", "_",
"+", "_PLUS",
"*", "_ASTERISK",
":", "_COLON",
" ", "_")
return replacer.Replace(name)
}
I double-checked with pyang
tool and it makes the distinction between what is valid in enum assigned names vs YANG identifiers.
As an example modify :
~/go/src/github.com/openconfig/ygot/demo/getting_started/yang/openconfig-interfaces.yang
as follows:
366 leaf admin-status {
367 type enumeration {
368 enum "" {
369 description
370 "RFC says The string MUST NOT be empty";
371 }
372 enum "FOO@!£%^&*()_+" {
373 description
374 "Should be allowed";
375 }
376 enum " FOO " {
377 description
378 "RFC says MUST NOT have any leading or trailing whitespace characters";
379 }
380 }
// SNIP
394 }
395
PYANG does not warn about "FOO@!£%^&*()_+”, e.g.
pyang yang/openconfig-interfaces.yang
// SNIP
yang/openconfig-interfaces.yang:368: error: bad value "" (should be enum-arg)
yang/openconfig-interfaces.yang:376: error: bad value " FOO :" (should be enum-arg)
safeGoEnumeratedValueName
function regarding particular characters that are present today in vendors' published YANG files - in particular the @
and ,
chars are used in enum assigned names in YANG from Juniper and Cisco.An example from Juniper : https://raw.githubusercontent.com/Juniper/yang/master/19.4/19.4R1/junos/conf/junos-conf-system%402019-01-01.yang
enum "[email protected]" {
description "128-bit AES with Galois/Counter Mode";
}
An example from Cisco : https://raw.githubusercontent.com/YangModels/yang/master/vendor/cisco/nx/9.3-3/Cisco-NX-OS-device.yang
enum IPv4,_mLDP {
value 1;
description "Discovery Interface Clients - IPv4, mLDP";
}
To demo :
go run $GOPATH/src/github.com/openconfig/ygot/generator/generator.go -path=yang -output_file=pkg/ocdemo/oc.go -package_name=ocdemo -generate_fakeroot -fakeroot_name=device -compress_paths=true -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang
which generates ...
387 const (
388 // OpenconfigInterfaces_Interface_AdminStatus_UNSET corresponds to the value UNSET of OpenconfigInterfaces_Interface_AdminStatus
389 OpenconfigInterfaces_Interface_AdminStatus_UNSET E_OpenconfigInterfaces_Interface_AdminStatus = 0
390 // OpenconfigInterfaces_Interface_AdminStatus_ corresponds to the value of OpenconfigInterfaces_Interface_AdminStatus
391 OpenconfigInterfaces_Interface_AdminStatus_ E_OpenconfigInterfaces_Interface_AdminStatus = 1
392 // OpenconfigInterfaces_Interface_AdminStatus_FOO@!£%^&_ASTERISK()__PLUS corresponds to the value FOO@!£%^&_ASTERISK()__PLUS of OpenconfigInterfaces_Interface_AdminStatus
393 OpenconfigInterfaces_Interface_AdminStatus_FOO@!£%^&_ASTERISK()__PLUS E_OpenconfigInterfaces_Interface_AdminStatus = 2
394 // OpenconfigInterfaces_Interface_AdminStatus__FOO__ corresponds to the value _FOO__ of OpenconfigInterfaces_Interface_AdminStatus
395 OpenconfigInterfaces_Interface_AdminStatus__FOO__ E_OpenconfigInterfaces_Interface_AdminStatus = 3
396 )
397
// SNIP
439 var ΛEnum = map[string]map[int64]ygot.EnumDefinition{
440 "E_IETFInterfaces_InterfaceType": {
441 },
442 "E_OpenconfigInterfaces_Interface_AdminStatus": {
443 1: {Name: ""},
444 2: {Name: "FOO@!£%^&*()_+"},
445 3: {Name: " FOO "},
446 },
which does not compile ...
go build
# github.com/openconfig/ygot/demo/getting_started/pkg/ocdemo
pkg/ocdemo/oc.go:393:48: invalid character U+0040 '@'
pkg/ocdemo/oc.go:393:49: syntax error: unexpected !, expecting semicolon or newline or )
pkg/ocdemo/oc.go:393:50: invalid identifier character U+00A3 '£'
Hi team,
thank you all for making goyang
a reality.
I would like to know if the maintainers are up to adopt the semantic versioning for goyang
? I think the common benefits of a versioned package are well-known.
Aside from the common versioning benefits the adoption will also make it possible to create an automatic release pipeline powered by goreleaser and github actions (like we did for gnmic).
Having pre-built goyang
binaries ready available and downloadable (via github releases) will help users to leverage one of the best yang compilers out there. I am willing to contribute the release pipeline if the OC community is up for maintaining the versioning.
Currently its not allowed, as it is not present in YANG 1.0 RFC,
YANG 1.1 adds default
substatement to leaf-lists
Hi *,
findFile
func promises to recursively traverse the paths in Path
and find the file by a module name or by name@revision
pattern.
From what I see, the only traversal search for revisioned files is done for the paths that end with ...
Lines 110 to 123 in 78bac27
When the path is a regular realpath, then scanDir is not called, and a the path is concatenated with module name (L115).
Should it be fixed to be like that?:
for _, dir := range Path {
var n string
if filepath.Base(dir) == "..." {
n = scanDir(filepath.Dir(dir), name, true)
} else {
n = scanDir(dir, name, true)
}
In that case even if the paths is /a/b/c
the search will be done and the latest revision will be picked up
goyang
currently has a bug whereby it always recognizes min
and max
as the min and max of the root type (i.e. uint64, int8, etc.) instead of its direct typedef parent. This leads to an incorrect (overly-lenient) verification of YANG types during AST construction (example file), and to an incorrect (overly-lenient) validation of actual values for downstream libraries such as ygot
when min
or max
are not -inf and +inf.
To fix this, each Number
simply needs to know the actual values of min
and max
, and the easiest way to do that would be to abolish MinNumber
/MaxNumber
(link), and use the actual values instead.
This is a backwards-incompatible change, but just like #125, I believe the usability improvement is worth the cost, as it also fixes bugs.
The proposed changes have the following backwards-incompatible components:
MaxNumber
/MinNumber
will be removed as Number
types. All numbers will be concrete values once parsed into a Number
type.
ParseInt
, ParseDecimal
, ParseRangesInt
, and ParseRangesDecimal
will now take min/max as function parameters to resolve min
and max
inputs to concrete values when parsing.
It fixes the following:
YangRange.Contains
will filter out invalid YANG that currently would pass.YangRange
will store only concrete values, making range validations much easier for downstream libraries such as ygot
.Currently, max-elements allows 0. This is not allowed by the RFC. I think we should do the following:
unbounded
. This doesn't make downstream code perfect, but is more robust, as 0 can be treated as unbounded
instead of 0, which is fragile as it currently forces any instantiation of ListAttr
to use NewDefaultListAttr
.Hello,
I am using goyang to process MIB-YANG modules obtained after converting SMIv2 files with SMIDUMP.
This issue is about handling multiple invalid characters after a backslash () in a YANG module.
To reproduce:
goyang CISCO-IMAGE-TC.yang
Output should be:
goyang CISCO-IMAGE-TC.yang
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan send]:
github.com/openconfig/goyang/pkg/yang.(*lexer).emitText(0xc8200ca7e0, 0xfffffffffffffffe, 0xc8200dcdae, 0xad)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:200 +0x2dd
github.com/openconfig/goyang/pkg/yang.(*lexer).emit(0xc8200ca7e0, 0xfffffffffffffffe)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:185 +0x66
github.com/openconfig/goyang/pkg/yang.(*lexer).Errorf(0xc8200ca7e0, 0xc8200af0c8, 0x1b, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:319 +0x5fa
github.com/openconfig/goyang/pkg/yang.(*lexer).ErrorfAt(0xc8200ca7e0, 0x7b, 0x5, 0xc8200af0c8, 0x1b, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:329 +0xa2
github.com/openconfig/goyang/pkg/yang.lexQString(0xc8200ca7e0, 0xc8200af1d8)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:473 +0x79a
github.com/openconfig/goyang/pkg/yang.(*lexer).NextToken(0xc8200ca7e0, 0xc8200f61c0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/lex.go:178 +0x64d
github.com/openconfig/goyang/pkg/yang.(*parser).next.func1(0xc8200af868)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:226 +0x2d
github.com/openconfig/goyang/pkg/yang.(*parser).next(0xc8200af868, 0xc820079c00)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:231 +0x86
github.com/openconfig/goyang/pkg/yang.(*parser).nextStatement(0xc8200af868, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:297 +0x18e
github.com/openconfig/goyang/pkg/yang.(*parser).nextStatement(0xc8200af868, 0xc820079380)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:313 +0x413
github.com/openconfig/goyang/pkg/yang.(*parser).nextStatement(0xc8200af868, 0x589ae0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:313 +0x413
github.com/openconfig/goyang/pkg/yang.Parse(0xc8200dc000, 0x2080, 0x7fffd00fd548, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/parse.go:184 +0x370
github.com/openconfig/goyang/pkg/yang.(*Modules).Parse(0xc8200ce000, 0xc8200dc000, 0x2080, 0x7fffd00fd548, 0x13, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/modules.go:59 +0x69
github.com/openconfig/goyang/pkg/yang.(*Modules).Read(0xc8200ce000, 0x7fffd00fd548, 0x13, 0x0, 0x0)
/home/camcardo/go/src/github.com/openconfig/goyang/pkg/yang/modules.go:53 +0xba
main.main()
/home/camcardo/go/src/github.com/openconfig/goyang/yang.go:185 +0x1769
The problem seems to be "the storage" of errors.
Remark: There could be a hole in the SMIv2 to YANG conversion (rfc6643). YANG only supports four special characters after a backslash (which is correctly handled by goyang), but there is no such impediment in SMIv2 modules; and the conversion does not force to deal with these cases.
Originally posted by @andaru in #95 (comment)
all: What was the original problem which led to these uses
statements being tracked? Was the problem related to identifier namespaces or other identifier resolution issues?
If so, it should be that we can avoid back-propagating the pointers to the uses
statements by tracking those in the "forward" direction as we traverse the populated model.
I get the below error when a notification is placed inside a list and a container
unknown list field: notification
unknown container field: notification
Example for notification inside a list node taken from Section-7.16.3(example2) from RFC7950:
yang-version 1.1;
namespace "urn:example:interface-module";
prefix "if";
container interfaces {
list interface {
key "name";
leaf name {
type string;
}
notification interface-enabled {
leaf by-user {
type string;
}
}
}
}
}
Presently, an RPC statement without a child "input" or "output" statement (valid per RFC) produces a *yang.Entry
with a nil RPC
field after a call to ToEntry
.
This makes such RPC difficult to use with goyang.
Instead, I would expect to see a populated (*yang.Entry).RPC{}
(type *yang.RPCEntry
) whose Input
and Output
fields are nil.
Issue #71 identifies two problems. The first, as that issue describes, is related to escape character handling.
The second, shown in the error message provided in #71 is a deadlock, which occurs due to the lexer's items
channel overflowing.
This issue is opened to address that part of the problem.
At present, errors can be sent to the items
channel an arbitrary number of times between each call to (*lexer).NextToken()
, which is the only place which receives from the items
channel. Each call to NextToken
will remove at most one item. When multiple errors are detected (in issue #71) within the same comment, only a single NextToken
call will occur, allowing the items
channel to overflow in short order.
In pkg/yang/lex.go
we currently have special handling for being within a pattern
statement whose argument is surrounded by double quotes rather than single quotes (see https://github.com/openconfig/goyang/blob/master/pkg/yang/lex.go#L460-L475).
In this case, we treat \
as a literal \
rather than an escape character. According to RFC6020 Section 6.1.3:
Within a double-quoted string (enclosed within " "), a backslash
character introduces a special character, which depends on the
character that immediately follows the backslash:
\n new line
\t a tab character
\" a double quote
\\ a single backslash
This language persisted in RFC7950. The sections of both RFCs that define pattern
don't seem to make any change to this language.
I'm therefore proposing to remove the special handling for pattern
arguments when within double quoted strings. This is causing some modules that use double quotes to fail validation when their contents is parsed using goyang.
Note that rfc6087bis recommends use of single-quoted strings in patterns - which would be nice, but not all module authors follow this.
@andaru -- do you see any issues with making this change? Thanks!
Entry.Augment calls ae.merge(nil, a.Namespace(), a)
where a
is the Entry for an augment. If a
is defined in a submodule, a.Namespace()
returns nil, because RootNode returns the submodule, and the namespace is set on the module, not on the submodule.
Hi @robshakir @wenovus,
I am struggling to make goyang parse the modules which have import statements with a specified revision.
To keep things real, lets take an example of Juniper yang modules, which come in the form of YANG files with [email protected]
pattern - https://github.com/Juniper/yang/tree/master/20.2/20.2R1/junos/conf
import junos-common-types {
prefix jt;
revision-date 2019-01-01;
}
name
is the bare module name, without revision suffix.ms.Read
to operate on junos-common-types
instead of junos-common-types@2019-01-01
name.ms.Read
in its turn uses findFile
that promises to pick the latest revision found, which is not what the import statement wanted.Shoudn't we instead read the module by revision by doing:
// Try to read it in.
if err := ms.Read(rev); err != nil {
return nil
}
The new deviation support doesn't work with remote paths for us at all. Every one of our valid deviations fail to parse.
e.g.,
cannot find target node to deviate, /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:state/oc-acl:matched-octets
This deviation is found in a module importing openconfig-acl
with prefix oc-acl
. This is the simplest example, but we see similar issues with augmented paths (where the namespace prefix change).
RFC7950 section 6.5 says that:
References to identifiers defined in external modules MUST be
qualified with appropriate prefixes, and references to identifiers
defined in the current module and its submodules MAY use a prefix.
As deviations are typically produced by a third-party to the original module author, this is the most common use case.
If you add some test cases to the previous change which include prefixes, you should see the error message above. e.g. a basic deviation module like this;
module foo {
import "external-module" { prefix extern; }
deviation /extern:some-top-level-node/extern:some-second-level-node/ { deviate not-supported; }
}
Hi~
I know the tree format in RFC8340
But I find that the tree format in this project:
tree - a simple tree representation
It's not the same as the RFC. Any specification about this?
I git cloned two model repos within the same directory.
https://github.com/openconfig/public
https://github.com/YangModels/yang
The following command works fine.
goyang --format=proto --path=public,yang
--proto_no_comments --proto_with_source
public/release/models/system/openconfig-system.yang
public/release/models/openflow/openconfig-openflow.yang
public/release/models/interfaces/openconfig-interfaces.yang
public/release/models/interfaces/openconfig-if-ethernet.yang
public/release/models/platform/openconfig-platform.yang | less
If I reorder the path argument, it fails.
goyang --format=proto --path=yang,public \
--proto_no_comments --proto_with_source
public/release/models/system/openconfig-system.yang
public/release/models/openflow/openconfig-openflow.yang
public/release/models/interfaces/openconfig-interfaces.yang
public/release/models/interfaces/openconfig-if-ethernet.yang
public/release/models/platform/openconfig-platform.yang
public/release/models/platform/openconfig-platform.yang:302:7: unknown group: oc-platform-types:avg-min-max-instant-stats-precision1-celsius
public/release/models/system/openconfig-aaa-radius.yang:83:7: unknown type oc-types:routing-password
public/release/models/system/openconfig-aaa-tacacs.yang:76:7: unknown type oc-types:routing-password
It seems to be an issue worth fixing.
As per RFC6020 section 9.3.4, the decimal64
YANG type requires the fraction-digits
attribute.
I note some old discussion in NETMOD groups about this and related issues, e.g.,
https://www.ietf.org/mail-archive/web/netmod/current/msg02732.html
Expected: given the drafts as I read them, the following module (missing fraction-digits
on the decimal64
type) should not parse successfully.
module test {
namespace "yang:test";
prefix "test";
yang-version "1";
leaf foo {
type decimal64;
}
}
Do you think a missing fraction-digits
attribute is an error (as stated by RFC6020)?
Both above cases, type assertion e.Node.(*Module)
results in panic
go panic: interface conversion: yang.Node is nil, not *yang.Module
Below is a test code, the schema is generated using openconfig-interfaces.yang file;
deviceEntry, ok := openconfig.SchemaTree["Device"]
assert.True(t, ok, "DeviceEntry should be present")
assert.NotNil(t, deviceEntry, "DeviceEntry should be non-nil")
interfaces := deviceEntry.Find("interfaces")
assert.NotNil(t, interfaces, "interfaces should be non-nil")
// modules := interfaces.Modules() // <-- panics here - e.Node.(*Module).modules
// assert.NotNil(t, modules, "modules should be non-nil")
interfaces = deviceEntry.Find("/interfaces") // <-- panics here - e.Node.(*Module).GetPrefix():
assert.NotNil(t, interfaces, "interfaces should be non-nil")
Are both cases above valid ? Is there any other way to find the module for an yang.Entry?
Hi all,
I am having troubles to identify why goayang
fails to process the types in this simple example where module test7
imports a typedef from common
module.
The contents of test7.yang
:
module test7 {
yang-version "1.1";
namespace "https://hellt/yangpath/test7";
prefix "test7";
import common { prefix comm; }
typedef network-instance-subintf-ref {
type comm:subinterface-all;
}
container test {
list interface {
key "name";
leaf name {
type test7:network-instance-subintf-ref;
}
leaf oper-state {
config false;
type string;
}
}
}
}
The contents of common.yang
is:
module common {
yang-version 1.1;
namespace "urn:srl_nokia/common";
prefix "comm";
typedef subinterface-all {
type string {
}
}
}
When I compile test7.yang
with goyang, I receive the following error:
pkg/path/testdata/test7/test7.yang:10:9: unknown prefix: comm for type subinterface-all
What I noticed, is that for some reason, goyang invokes findExternal
func twice, if I put the print statement at the very top of this function I see the following printouts reporting the same name
and prefix
of the type for which this function is called and the returned nodes are nil and non-nil:
// findExternal finds the externally defined typedef name in the module imported
// by n's root with the specified prefix.
func (d *typeDictionary) findExternal(n Node, prefix, name string) (*Typedef, error) {
fmt.Println("prefix:", prefix, "name:", name)
root := FindModuleByPrefix(n, prefix)
fmt.Println("root is nil", root == nil)
output:
❯ go run . export -y pkg/path/testdata/common -m pkg/path/testdata/test7/test7.yang
prefix: comm name: subinterface-all
root is nil true
prefix: comm name: subinterface-all
root is nil false
FATA[0000] pkg/path/testdata/test7/test7.yang:10:9: unknown prefix: comm for type subinterface-all
Examples of YANG module with "augment" inside "uses" are ietf-ipv4-unicast-routing and ietf-ipv6-unicast-routing from RFC 8349.
There is also a problem with multiple "augment" in one "uses" but it is already discussed in #51.
goyang tends to ignore prefixes. In openconfig we do not expect to see conflicts on names sans prefixes, but for general use, goyang must support prefixes better.
The following command has no output
$ goyang --format types [email protected]
However
goyang --format proto [email protected]
Results in output
syntax = "proto3";
// Automatically generated by goyang https://github.com/openconfig/goyang
// compiled 2018-04-09T23:54:02Z
// do not delete the next line
// goyang-version 1
// module "ietf-netconf"
// revision "2011-06-01"
// namespace "urn:ietf:params:xml:ns:netconf:base:1.0"
// NETCONF Protocol Data Types and Protocol Operations.
//
// Copyright (c) 2011 IETF Trust and the persons identified as
// the document authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, is permitted pursuant to, and subject
// to the license terms contained in, the Simplified BSD License
// set forth in Section 4.c of the IETF Trust's Legal Provisions
// Relating to IETF Documents
// (http://trustee.ietf.org/license-info).
//
// This version of this YANG module is part of RFC 6241; see
// the RFC itself for full legal notices.
package ietf_netconf;
service IETFNetconf {
rpc CancelCommit (CancelCommitRequest) returns (Empty);
rpc Commit (CommitRequest) returns (Empty);
...
Hi *,
I have problems understanding how one can get a directory structure of a module which augments another one.
Consider a module like that
module test {
namespace "test";
prefix test;
import conf {
prefix c;
revision-date 2019-01-01;
}
augment /c:configuration {
uses mygroup;
}
grouping mygroup {
container main {
// contents
}
This module solely augments /c:configuration
by using a grouping defined inside of it.
The issue I experience is that when I do e := yang.ToEntry(ms.Modules[mn])
for that module, the *yang.Entry
structure has an empty Dir
field.
The question is: how to get the directory of such modules?
In some schemas (non-OpenConfig), there exist circular dependencies between a set of submodules, based on YANG 1.0 not considering entities defined in a submodule to be accessible to another submodule of the same module without an explicit include
statement. Currently, goyang will loop around these statements. This issue tracks adding hooks to handle such cases.
A canonical example case is the one used in (pyangbind unit tests)[https://github.com/robshakir/pyangbind/tree/nokia-fix/tests/nokia]. mod-a
includes subm-x
and subm-b
which include each other.
I plan to add support for a command-line option to be able to handle this case, despite the fact that it violates the requirements of RFC6020. Comments welcome - otherwise I will open a PR.
Currently the ToEntry
function does not set default
for type *Choice
.
I plan on fixing this by adding the same snippet of code that is used in ToEntry
to set default
for type *Leaf
. In the end, it will look as the following:
...
case *Choice:
e.Kind = ChoiceEntry
// set `default` for type `*Choice`
if s.Default != nil {
e.Default = s.Default.Name
}
...
The yang.ParseRanges
function uses the Number
type under the surface, but the Number
type does not support floating point (decimal) values.
Both YANG 1.0 and the recently ratified YANG 1.1 support range
restrictions on the decimal64
type.
I would expect the test below to successfully import the enclosed module, which is successfully validated by pyang 1.7.
package ttt
import "testing"
import "github.com/openconfig/goyang/pkg/yang"
func TestYANGRangeDecimal64(t *testing.T) {
mod := `
module test {
prefix test;
namespace urn:test;
leaf d64 {
type decimal64 {
fraction-digits 2;
range "-0.5 .. 1.0";
}
}
}
`
ms := yang.NewModules()
ms.Parse(mod, "test.yang")
errs := ms.Process()
for i, err := range errs {
t.Errorf("error %d: %v", i, err)
}
}
However the test fails when parsing the Number
types due to their lack of floating point support:
$ go test -v .
=== RUN TestYANGRangeDecimal64
--- FAIL: TestYANGRangeDecimal64 (0.00s)
ttt_test.go:26: error 0: test.yang:9:7: bad range: strconv.ParseUint: parsing "0.5": invalid syntax
FAIL
exit status 1
FAIL github.com/aristanetworks/gopenconfig/ttt 0.008s
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.