Skip to content

Commit

Permalink
Add support leaf-lists in paths->protobuf. (#926)
Browse files Browse the repository at this point in the history
* Add support leaf-lists in paths->protobuf.

 * (M) protomap/integration_tests/integration_test.go
  - Add test case for a failure that was causing a panic,
    where a leaf-list of union values was being handed to
    PathsToProto. Currently not yet implemented, but test
    checks error handling works as expected.
 * (M) protomap/proto(_test)?.go
  - Add support and testing for mapping of leaf-lists of
    YANG inbuilt types to protobufs.

* Add TODO.

* Throw an error for `repeated` in `makeWrapper`.

* Add support for mapping leaf-lists of unions to protobufs. (#927)

* Add support for mapping leaf-lists of unions to protobufs.

 * (M) integration_tests/integration_test.go
  - Reflect the fact that the gRIBI integration test cases is now
    implemented.
 * (M) protomap/proto.go
  - Add support for mapping both []any and gNMI TypedValue messages
    to fields within a protobuf from input gNMI paths.
 * (M) protomap/testdata/...
  - Additional fields in test protobufs.

* Add outdated file.

* Remove stale output.

* Improve test coverage - add handling for bool.
  • Loading branch information
robshakir authored Nov 7, 2023
1 parent 7172fd7 commit 2fe7c7f
Show file tree
Hide file tree
Showing 5 changed files with 1,474 additions and 344 deletions.
29 changes: 29 additions & 0 deletions protomap/integration_tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,35 @@ func TestGRIBIAFTToStruct(t *testing.T) {
SrcIp: &wpb.StringValue{Value: "1.1.1.1"},
},
},
}, {
desc: "pushed mpls label stack",
inPaths: map[*gpb.Path]interface{}{
mustPath("state/pushed-mpls-label-stack"): &gpb.TypedValue{
Value: &gpb.TypedValue_LeaflistVal{
LeaflistVal: &gpb.ScalarArray{
Element: []*gpb.TypedValue{
mustValue(t, uint64(20)),
mustValue(t, uint64(30)),
mustValue(t, uint64(40)),
mustValue(t, uint64(50)),
},
},
},
},
},
inProto: &gribi_aft.Afts_NextHop{},
inPrefix: mustPath("afts/next-hops/next-hop"),
wantProto: &gribi_aft.Afts_NextHop{
PushedMplsLabelStack: []*gribi_aft.Afts_NextHop_PushedMplsLabelStackUnion{{
PushedMplsLabelStackUint64: 20,
}, {
PushedMplsLabelStackUint64: 30,
}, {
PushedMplsLabelStackUint64: 40,
}, {
PushedMplsLabelStackUint64: 50,
}},
},
}}

for _, tt := range tests {
Expand Down
Loading

0 comments on commit 2fe7c7f

Please sign in to comment.