Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
d9d48818
Commit
d9d48818
authored
2 years ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
fix compile errors due to update of ygot in generator
parent
889bb7e6
No related branches found
No related tags found
1 merge request
!441
[renovate] Update module github.com/openconfig/ygot to v0.27.0
Pipeline
#138754
failed
2 years ago
Stage: build
Stage: test
Stage: analyze
Stage: integration-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
csbi/generate.go
+16
-16
16 additions, 16 deletions
csbi/generate.go
with
16 additions
and
16 deletions
csbi/generate.go
+
16
−
16
View file @
d9d48818
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
spb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
spb
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
"github.com/google/uuid"
"github.com/google/uuid"
gpb
"github.com/openconfig/gnmi/proto/gnmi"
gpb
"github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ygot/gogen"
"github.com/openconfig/ygot/ygen"
"github.com/openconfig/ygot/ygen"
log
"github.com/sirupsen/logrus"
log
"github.com/sirupsen/logrus"
)
)
...
@@ -49,10 +50,8 @@ func Generate(ctx context.Context, models []*gpb.ModelData, repository Repositor
...
@@ -49,10 +50,8 @@ func Generate(ctx context.Context, models []*gpb.ModelData, repository Repositor
}
else
if
len
(
yangFiles
)
!=
len
(
models
)
{
}
else
if
len
(
yangFiles
)
!=
len
(
models
)
{
log
.
Warn
(
"could not find all models"
)
log
.
Warn
(
"could not find all models"
)
}
}
cfg
:=
&
ygen
.
GeneratorConfig
{
PackageName
:
"main"
,
generator
:=
gogen
.
New
(
"GoCodeGenerator"
,
ygen
.
IROptions
{
GenerateJSONSchema
:
true
,
StoreRawSchema
:
true
,
ParseOptions
:
ygen
.
ParseOpts
{
ParseOptions
:
ygen
.
ParseOpts
{
YANGParseOptions
:
yang
.
Options
{
YANGParseOptions
:
yang
.
Options
{
IgnoreSubmoduleCircularDependencies
:
true
,
IgnoreSubmoduleCircularDependencies
:
true
,
...
@@ -63,39 +62,40 @@ func Generate(ctx context.Context, models []*gpb.ModelData, repository Repositor
...
@@ -63,39 +62,40 @@ func Generate(ctx context.Context, models []*gpb.ModelData, repository Repositor
GenerateFakeRoot
:
true
,
GenerateFakeRoot
:
true
,
FakeRootName
:
"Device"
,
FakeRootName
:
"Device"
,
},
},
GoOptions
:
ygen
.
GoOpts
{
},
gogen
.
GoOpts
{
IncludeModelData
:
true
,
PackageName
:
"main"
,
GenerateSimpleUnions
:
true
,
GenerateJSONSchema
:
true
,
ValidateFunctionName
:
"Validate"
,
IncludeModelData
:
true
,
},
GenerateSimpleUnions
:
true
,
}
ValidateFunctionName
:
"Validate"
,
})
lock
.
Lock
()
lock
.
Lock
()
generator
:=
ygen
.
NewYANGCodeGenerator
(
cfg
)
searchpath
,
err
:=
repository
.
YANGPathsWithSuffix
()
searchpath
,
err
:=
repository
.
YANGPathsWithSuffix
()
if
err
!=
nil
{
if
err
!=
nil
{
return
Deployment
{},
promHandleError
(
labels
,
err
,
codeGenerationErrorsTotal
)
return
Deployment
{},
promHandleError
(
labels
,
err
,
codeGenerationErrorsTotal
)
}
}
code
,
errs
:=
generator
.
GenerateGoCode
(
yangFiles
,
searchpath
)
code
,
errs
:=
generator
.
Generate
(
yangFiles
,
searchpath
)
for
_
,
e
:=
range
errs
{
for
_
,
e
:=
range
errs
{
if
strings
.
Contains
(
e
.
Error
(),
"duplicate entry interfaces at the root"
)
{
if
strings
.
Contains
(
e
.
Error
(),
"duplicate entry interfaces at the root"
)
{
if
strings
.
Contains
(
e
.
Error
(),
"ietf-interfaces"
)
{
if
strings
.
Contains
(
e
.
Error
(),
"ietf-interfaces"
)
{
generator
.
Config
.
ParseOptions
.
ExcludeModules
=
append
(
generator
.
Config
.
ParseOptions
.
ExcludeModules
,
"ietf-interfaces"
)
generator
.
IROptions
.
ParseOptions
.
ExcludeModules
=
append
(
generator
.
IROptions
.
ParseOptions
.
ExcludeModules
,
"ietf-interfaces"
)
}
else
{
}
else
{
splitted
:=
strings
.
SplitAfter
(
e
.
Error
(),
"new: "
)
splitted
:=
strings
.
SplitAfter
(
e
.
Error
(),
"new: "
)
model
:=
strings
.
Split
(
splitted
[
0
],
"/"
)[
1
]
model
:=
strings
.
Split
(
splitted
[
0
],
"/"
)[
1
]
generator
.
Config
.
ParseOptions
.
ExcludeModules
=
append
(
generator
.
Config
.
ParseOptions
.
ExcludeModules
,
model
)
generator
.
IROptions
.
ParseOptions
.
ExcludeModules
=
append
(
generator
.
IROptions
.
ParseOptions
.
ExcludeModules
,
model
)
}
}
}
}
log
.
Warnf
(
"error during first round %v"
,
promHandleError
(
labels
,
e
,
codeGenerationErrorsTotal
))
log
.
Warnf
(
"error during first round %v"
,
promHandleError
(
labels
,
e
,
codeGenerationErrorsTotal
))
}
}
log
.
Infof
(
"excluded models: %v"
,
generator
.
Config
.
ParseOptions
.
ExcludeModules
)
log
.
Infof
(
"excluded models: %v"
,
generator
.
IROptions
.
ParseOptions
.
ExcludeModules
)
if
code
==
nil
{
if
code
==
nil
{
log
.
Info
(
"running second round"
)
log
.
Info
(
"running second round"
)
code
,
errs
=
generator
.
Generate
GoCode
(
yangFiles
,
searchpath
)
code
,
errs
=
generator
.
Generate
(
yangFiles
,
searchpath
)
}
}
lock
.
Unlock
()
lock
.
Unlock
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment