-
Notifications
You must be signed in to change notification settings - Fork 83
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
prefix handling is incomplete #5
Comments
In our present usages, one area we've run into a concern with not having prefixes is for type names - since types are often pulled in from other modules (e.g., common prefix It thus seems preferable for users who do care about prefixes to get back the fully qualified type name (i.e., that with the source module prefix) from things like |
Just FYI. I got this error when parsing openconfig-bgp: "../policy/openconfig-policy-types.yang:123:7: unknown prefix: yang for type hex-string". pyang didn't complain about this. |
I believe pull request 60 may resolve this. |
Can you provide instructions on how to reproduce this, including where all the .yang files have come from and what version? It would be great if you could just say mkdir foo So I can reproduce exactly what you are seeing. |
Thanks Again! I discovered on my script the policy-types.yang file appear twice. It was my bad. |
Looks like leafs (and maybe leaft-lists and uses leaf-lists) don't have prefixes set, because ToEntry() doesn't set a prefix in these cases. Here is a snipper that shows that:
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/openconfig/goyang/pkg/yang"
)
func main() {
yangDir := "/tmp/public/release/models"
ms := yang.NewModules()
filepath.Walk(yangDir, func(path string, info os.FileInfo, err error) error {
if !strings.HasSuffix(path, ".yang") {
return nil
}
return ms.Read(path)
})
for _, k := range ms.Modules["openconfig-isis"].Grouping {
if k.Name == "isis-overload-bit-reset-config" {
e := yang.ToEntry(k)
fmt.Printf("Prefixes:\n%s:%s\n%#v\n", e.Prefix.Name, e.Name, e.Dir["delay"].Prefix)
}
}
} Results in:
Maybe adding a
in these three cases is the right thing to do? edit by wenovus: #70 resolves this issue. |
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 text was updated successfully, but these errors were encountered: