Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include nh index in summary #252

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading