Skip to content

Commit

Permalink
Merge branch 'main' into container-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robshakir authored Jan 29, 2025
2 parents 5d5ea38 + 4cc32a1 commit 6589c7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions afthelper/afthelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type NextHopSummary struct {
Address string `json:"address"`
// NetworkInstance is the network instance within which the address was resolved.
NetworkInstance string `json:"network-instance"`
// Index is the gRIBI index of the next hop.
Index uint64 `json:"index"`
}

// NextHopAddrsForPrefix unrolls the prefix specified within the network-instance netInst from the
Expand Down Expand Up @@ -96,6 +98,7 @@ func NextHopAddrsForPrefix(rib map[string]*aft.RIB, netinst, prefix string) (map
Address: nh,
Weight: weights[nhID],
NetworkInstance: nhNI,
Index: nhID,
}
}

Expand Down
8 changes: 8 additions & 0 deletions afthelper/afthelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestNextHopAddrsForPrefix(t *testing.T) {
Weight: 1,
Address: "1.1.1.1",
NetworkInstance: defName,
Index: 1,
},
},
}, {
Expand All @@ -74,11 +75,13 @@ func TestNextHopAddrsForPrefix(t *testing.T) {
Address: "1.1.1.1",
Weight: 1,
NetworkInstance: defName,
Index: 1,
},
"2.2.2.2": {
Address: "2.2.2.2",
Weight: 1,
NetworkInstance: defName,
Index: 2,
},
},
}, {
Expand All @@ -101,11 +104,13 @@ func TestNextHopAddrsForPrefix(t *testing.T) {
Address: "1000:10:10::10",
Weight: 1,
NetworkInstance: defName,
Index: 1,
},
"2.2.2.2": {
Address: "2.2.2.2",
Weight: 1,
NetworkInstance: defName,
Index: 2,
},
},
}, {
Expand Down Expand Up @@ -144,6 +149,7 @@ func TestNextHopAddrsForPrefix(t *testing.T) {
Weight: 2,
Address: "2.2.2.2",
NetworkInstance: "VRF-1",
Index: 2,
},
},
}, {
Expand Down Expand Up @@ -172,11 +178,13 @@ func TestNextHopAddrsForPrefix(t *testing.T) {
Address: "1000:10:10::10",
Weight: 1,
NetworkInstance: "VRF-1",
Index: 1,
},
"2.2.2.2": {
Address: "2.2.2.2",
Weight: 1,
NetworkInstance: "VRF-1",
Index: 2,
},
},
}}
Expand Down
2 changes: 2 additions & 0 deletions rib/rib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4382,6 +4382,7 @@ func TestResolvedEntryHook(t *testing.T) {
Weight: 32,
Address: "1.1.1.1",
NetworkInstance: "DEFAULT",
Index: 1,
},
}
if diff := cmp.Diff(got, want); diff != "" {
Expand Down Expand Up @@ -4429,6 +4430,7 @@ func TestResolvedEntryHook(t *testing.T) {
Weight: 32,
Address: "1000:10:10::10",
NetworkInstance: "DEFAULT",
Index: 10,
},
}
if diff := cmp.Diff(got, want); diff != "" {
Expand Down

0 comments on commit 6589c7f

Please sign in to comment.