Skip to content

Commit 2012775

Browse files
authored
Update goyang dep to v0.4.0. (#617)
Upate usages of `yang.Number`, which had a backwards-incompatible change in order to solve an inheritance bug. This PR can be used as a reference for other dependers of goyang who need to make the same changes.
1 parent e9501f8 commit 2012775

23 files changed

+113174
-96835
lines changed

exampleoc/oc.go

Lines changed: 37563 additions & 32129 deletions
Large diffs are not rendered by default.

exampleoc/ocpath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package exampleoc is a generated package which contains definitions
33
of structs which generate gNMI paths for a YANG schema. The generated paths are
44
based on a compressed form of the schema.
55

6-
This package was generated by /usr/local/google/home/robjs/go/src/github.com/openconfig/ygot/genutil/names.go
6+
This package was generated by /usr/local/google/home/wenbli/gocode/src/github.com/openconfig/ygot/genutil/names.go
77
using the following YANG input files:
88
- public/release/models/network-instance/openconfig-network-instance.yang
99
- public/release/models/optical-transport/openconfig-optical-amplifier.yang

exampleoc/opstateoc/oc.go

Lines changed: 37592 additions & 32113 deletions
Large diffs are not rendered by default.

exampleoc/wrapperunionoc/oc.go

Lines changed: 37566 additions & 32129 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/google/go-cmp v0.5.5
99
github.com/kylelemons/godebug v1.1.0
1010
github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be
11-
github.com/openconfig/goyang v0.2.9
11+
github.com/openconfig/goyang v0.4.0
1212
github.com/openconfig/gribi v0.1.1-0.20210423184541-ce37eb4ba92f
1313
github.com/pmezard/go-difflib v1.0.0
1414
google.golang.org/grpc v1.37.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be h1:VEK8utxoyZu/hkp
4444
github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A=
4545
github.com/openconfig/goyang v0.0.0-20200115183954-d0a48929f0ea/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU=
4646
github.com/openconfig/goyang v0.2.2/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
47-
github.com/openconfig/goyang v0.2.9 h1:Z95LskKYk6nBYOxHtmJCu3YEKlr3pJLWG1tYAaNh3yU=
48-
github.com/openconfig/goyang v0.2.9/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
47+
github.com/openconfig/goyang v0.4.0 h1:e6oGwpXXirSzQa0tmvwgp4L8jc3RvfzqroJFyC5uZXE=
48+
github.com/openconfig/goyang v0.4.0/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
4949
github.com/openconfig/gribi v0.1.1-0.20210423184541-ce37eb4ba92f h1:8vRtC+y0xh9BYPrEGf/jG/paYXiDUJ6P8iYt5rCVols=
5050
github.com/openconfig/gribi v0.1.1-0.20210423184541-ce37eb4ba92f/go.mod h1:OoH46A2kV42cIXGyviYmAlGmn6cHjGduyC2+I9d/iVs=
5151
github.com/openconfig/ygot v0.6.0/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs=

util/debug_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,17 @@ func TestYangTypeToDebugString(t *testing.T) {
185185
Kind: yang.Ystring,
186186
Pattern: []string{"abc"},
187187
POSIXPattern: []string{"^abc$"},
188-
Range: yang.YangRange{yang.YRange{Min: YangMinNumber, Max: YangMaxNumber}},
188+
Range: yang.Uint64Range,
189189
},
190-
wantStr: `(TypeKind: string, Sanitized pattern (POSIX: true): ^abc$, Range: min..max)`,
190+
wantStr: `(TypeKind: string, Sanitized pattern (POSIX: true): ^abc$, Range: 0..18446744073709551615)`,
191191
}, {
192192
desc: "non-POSIX",
193193
inType: &yang.YangType{
194194
Kind: yang.Ystring,
195195
Pattern: []string{"abc"},
196-
Range: yang.YangRange{yang.YRange{Min: YangMinNumber, Max: YangMaxNumber}},
196+
Range: yang.Uint64Range,
197197
},
198-
wantStr: `(TypeKind: string, Sanitized pattern (POSIX: false): ^(abc)$, Range: min..max)`,
198+
wantStr: `(TypeKind: string, Sanitized pattern (POSIX: false): ^(abc)$, Range: 0..18446744073709551615)`,
199199
}}
200200

201201
for _, tt := range tests {

util/yang.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ import (
2424
"github.com/openconfig/goyang/pkg/yang"
2525
)
2626

27-
var (
28-
// YangMaxNumber represents the maximum value for any integer type.
29-
YangMaxNumber = yang.Number{Kind: yang.MaxNumber}
30-
// YangMinNumber represents the minimum value for any integer type.
31-
YangMinNumber = yang.Number{Kind: yang.MinNumber}
32-
)
33-
3427
// CompressedSchemaAnnotation stores the name of the annotation indicating
3528
// whether a set of structs were built with -compress_path. It is appended
3629
// to the yang.Entry struct of the root entity of the structs within the

ygen/testdata/schema/openconfig-options-compress-fakeroot-schema.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
"Range": [
7474
{
7575
"Min": {
76-
"Kind": 0,
7776
"Value": 0,
78-
"FractionDigits": 0
77+
"FractionDigits": 0,
78+
"Negative": false
7979
},
8080
"Max": {
81-
"Kind": 0,
8281
"Value": 4294967295,
83-
"FractionDigits": 0
82+
"FractionDigits": 0,
83+
"Negative": false
8484
}
8585
}
8686
]
@@ -201,14 +201,14 @@
201201
"Range": [
202202
{
203203
"Min": {
204-
"Kind": 0,
205204
"Value": 0,
206-
"FractionDigits": 0
205+
"FractionDigits": 0,
206+
"Negative": false
207207
},
208208
"Max": {
209-
"Kind": 0,
210209
"Value": 4294967295,
211-
"FractionDigits": 0
210+
"FractionDigits": 0,
211+
"Negative": false
212212
}
213213
}
214214
]
@@ -239,14 +239,14 @@
239239
"Range": [
240240
{
241241
"Min": {
242-
"Kind": 0,
243242
"Value": 0,
244-
"FractionDigits": 0
243+
"FractionDigits": 0,
244+
"Negative": false
245245
},
246246
"Max": {
247-
"Kind": 0,
248247
"Value": 4294967295,
249-
"FractionDigits": 0
248+
"FractionDigits": 0,
249+
"Negative": false
250250
}
251251
}
252252
]
@@ -344,4 +344,4 @@
344344
"schemapath": "/",
345345
"structname": "Device"
346346
}
347-
}
347+
}

0 commit comments

Comments
 (0)