Skip to content

Commit f15cbe3

Browse files
authored
Merge pull request #157 from sdcio/fixmodulelookup
Making it possible to also lookup modules
2 parents 1693ada + 1ede93b commit f15cbe3

File tree

7 files changed

+11
-46
lines changed

7 files changed

+11
-46
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/prometheus/client_golang v1.18.0
2424
github.com/scrapli/scrapligo v1.2.0
2525
github.com/sdcio/cache v0.0.34
26-
github.com/sdcio/schema-server v0.0.18
26+
github.com/sdcio/schema-server v0.0.19
2727
github.com/sdcio/sdc-protos v0.0.25
2828
github.com/sdcio/yang-parser v0.0.5
2929
github.com/sirupsen/logrus v1.9.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ github.com/scrapli/scrapligo v1.2.0 h1:jn83HPkKAPDzvth7i9V/70BAPuVgriU+/tHHv3eAt
230230
github.com/scrapli/scrapligo v1.2.0/go.mod h1:rRx/rT2oNPYztiT3/ik0FRR/Ro7AdzN/eR9AtF8A81Y=
231231
github.com/sdcio/cache v0.0.34 h1:mDxIPN9r339yHykCPJZFKX0va8RMoAscErbEkAcql7E=
232232
github.com/sdcio/cache v0.0.34/go.mod h1:u/rIbC03e6k+J19VWo8DwJdBWY0vzNZ25viXRmrS+5I=
233-
github.com/sdcio/schema-server v0.0.18 h1:/XOPFLlg6DQpzPREKRvZRvbGuBysq83I4vE4B3z27Jc=
234-
github.com/sdcio/schema-server v0.0.18/go.mod h1:XZ3331BOwLuX+ZXMIqfdpC98GPc6ojBiOAt2X5NLKk4=
233+
github.com/sdcio/schema-server v0.0.19 h1:Toql//LOttivzrlL1QBF2dhrbaA+e2wzdpG2ObwFjAA=
234+
github.com/sdcio/schema-server v0.0.19/go.mod h1:XZ3331BOwLuX+ZXMIqfdpC98GPc6ojBiOAt2X5NLKk4=
235235
github.com/sdcio/sdc-protos v0.0.25 h1:VYzuLv07y/kjSTD9x99Il46Uv4leKXjXWN0O/wsi7zI=
236236
github.com/sdcio/sdc-protos v0.0.25/go.mod h1:iVVPmQTRzoCV4abQ4QL5mJethvRVfdV8cHcVyDtSNs4=
237237
github.com/sdcio/yang-parser v0.0.5 h1:YwpgQt2/n3BHFrEa0n0sQ4Q2hLCrTFY2VDKO+2BgoVg=

pkg/datastore/data_rpc.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,11 +1130,7 @@ func getLeafList(s string, cs *sdcpb.SchemaElem_Container) (*sdcpb.LeafListSchem
11301130
}
11311131

11321132
func (d *Datastore) getChild(ctx context.Context, s string, cs *sdcpb.SchemaElem_Container) (string, bool) {
1133-
for _, c := range cs.Container.GetChildren() {
1134-
if c == s {
1135-
return c, true
1136-
}
1137-
}
1133+
11381134
if cs.Container.Name == "__root__" {
11391135
for _, c := range cs.Container.GetChildren() {
11401136
rsp, err := d.getValidationClient().GetSchema(ctx, &sdcpb.Path{Elem: []*sdcpb.PathElem{{Name: c}}})
@@ -1154,6 +1150,11 @@ func (d *Datastore) getChild(ctx context.Context, s string, cs *sdcpb.SchemaElem
11541150
}
11551151
}
11561152
}
1153+
for _, c := range cs.Container.GetChildren() {
1154+
if c == s {
1155+
return c, true
1156+
}
1157+
}
11571158
return "", false
11581159
}
11591160

pkg/datastore/intent_rpc_set_update_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,6 @@ func TestDatastore_populateTree(t *testing.T) {
653653
cacheClient := mockcacheclient.NewMockClient(controller)
654654
testhelper.ConfigureCacheClientMock(t, cacheClient, tt.intendedStoreUpdates, tt.expectedModify, tt.expectedDeletes)
655655

656-
// create a schema client mock
657-
// schemaClient := mockschema.NewMockClient(controller)
658-
// testhelper.ConfigureSchemaClientMock(t, schemaClient)
659-
660656
schemaClient, schema, err := testhelper.InitSDCIOSchema()
661657
if err != nil {
662658
t.Fatal(err)

pkg/tree/entry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ func (s *sharedEntryAttributes) populateChoiceCaseResolvers() {
622622
if val := s.treeContext.GetBranchesHighesPrecedence(s.Path(), CacheUpdateFilterExcludeOwner(s.treeContext.GetActualOwner())); val < math.MaxInt32 {
623623
choiceResolver.SetValue(elem, val, false)
624624
}
625+
625626
// set the value from the tree as well
626627
if childExists {
627628
v := child.getHighestPrecedenceValueOfBranch()

tests/schema/sdcio_model_doublekey.yang

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ module sdcio_model_doublekey {
33
namespace "urn:sdcio/model_doublekey";
44
prefix sdcio_model_doublekey;
55

6-
// import sdcio_model_common {
7-
// prefix sdcio_model_common;
8-
// }
9-
10-
116
description
127
"This is part of the test schema for sdcio";
138

@@ -42,34 +37,6 @@ module sdcio_model_doublekey {
4237
}
4338
}
4439

45-
// choice choicecase {
46-
// container case1 {
47-
// presence "case1 is active";
48-
// description
49-
// "case 1 of the choicecase";
50-
// leaf log {
51-
// type boolean;
52-
// default "false";
53-
// description "When this is true, a log is created for each packet matching the entry";
54-
// }
55-
// container case-elem {
56-
// leaf elem {
57-
// type string;
58-
// description "some element under the case";
59-
// }
60-
// }
61-
// }
62-
// container case2 {
63-
// presence "case1 is active";
64-
// description
65-
// "case 1 of the choicecase";
66-
// leaf log {
67-
// type boolean;
68-
// default "false";
69-
// description "When this is true, a log is created for each packet matching the entry";
70-
// }
71-
// }
72-
// }
7340
}
7441
}
7542
}

tests/sdcioygot/sdcio_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ of structs which represent a YANG schema. The generated schema can be
44
compressed by a series of transformations (compression was false
55
in this case).
66
7-
This package was generated by /home/mava/go/pkg/mod/github.com/openconfig/[email protected].19/genutil/names.go
7+
This package was generated by /home/mava/go/pkg/mod/github.com/openconfig/[email protected].20/genutil/names.go
88
using the following YANG input files:
99
- ./tests/schema/sdcio_model.yang
1010
- ./tests/schema/sdcio_model_choice.yang

0 commit comments

Comments
 (0)