openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

go build is failing for package "github.com/openconfig/ygot/experimental/ygotutils" #583

Open niranjan-83 opened 3 years ago

niranjan-83 commented 3 years ago

when i am trying to build the go project "gnxi-simulators-master" , i am getting this error :

$ go mod tidy go: finding module for package github.com/openconfig/ygot/experimental/ygotutils github.com/onosproject/gnxi-simulators/pkg/gnmi imports github.com/openconfig/ygot/experimental/ygotutils: module github.com/openconfig/ygot@latest found (v0.12.0), but does not contain package github.com/openconfig/ygot/experimental/ygotutils

i am not able to see the package experimental/ygotutils at location "https://github.com/openconfig/ygot" , then how the code at model.go inside /pkg/gnmi will be able to fetch it. import inside model.go is "github.com/openconfig/ygot/experimental/ygotutils"

wenovus commented 3 years ago

gnxi-simulators-master seems to be using an older version of ygot right now, so if you upgraded to the latest ygot it may break.

If you really need the latest ygot then perhaps this will help you convert: https://github.com/google/gnxi/pull/250

niranjan-83 commented 3 years ago

Hi @wenovus , thanks for earlier reply . I think another way i can solve my problem related to build is by creating the "pkg/gnmi" folder . Is it possible to create/update modeldata.go file with a new interface say "openconfig-bgp" , only have 4 interfaces there ? If i have to support any new "openconfig-xyz" interface , what will be way to go ahead? ( i see openconfig/ygot/genutil/names.go and /pkg/gnmi/modeldata/gostruct/command.sh , can they help?)

wenovus commented 3 years ago

I'm not sure if I understood your question, it sounds like you're asking a separate issue of how to add new modules to the generated code? If so you can just regenerate after providing the new YANG file to the generator.go program. It's unlikely to cause backwards compatibility issues.

niranjan-83 commented 3 years ago

Sorry for confusion here , let me elaborate the issue (In the process of finding the solution got the very first issue of ygotutils but this is actually i am looking for). Will use PATH instead of this "gnxi-simulators-master/pkg/gnmi/modeldata/gostruct/"

I want to add support for new module openconfig-bgp and other openconfig modules in gnxi-simulator . What could be possible way to do that ? I see "PATH/command.sh" using ygot generator and taking different yang files "openconfig-interfaces.yang" , "openconfig-openflow.yang" etc as parameter to generate the output file "PATH/generated.go" . I think "ygot/generator/generator.go" does the same. And once file is generated (PATH/generated.go) i can build gnxi-simulator-masters with "make all" . And its "typical_ofsw_config.json" file if updated with openconfig-bgp should support it.

wenovus commented 3 years ago

Unfortunately I'm not familiar with the "gnxi-simulators" repo. However, from your reference it looks like they're just calling generator.go: https://github.com/onosproject/gnxi-simulators/blob/afca416f49d51d10e47e51e07bf90e33faa711f3/pkg/gnmi/modeldata/gostruct/command.sh

So I think you can just add the module as another argument to the call, like here: https://github.com/openconfig/ygot/blob/f01913aa54675e818f97bf5a55692755e2b6ff10/exampleoc/update.sh