Skip to content

Commit

Permalink
Merge pull request #164 from zbud-msft/cherry-pick-state-db-202305
Browse files Browse the repository at this point in the history
Cherry pick prepare state db 202305
  • Loading branch information
StormLiangMS authored Oct 19, 2023
2 parents f1ea212 + c2b090d commit a2a518d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,20 @@ func prepareConfigDb(t *testing.T, namespace string) {
mpi_pfcwd_map := loadConfig(t, "", configPfcwdByte)
loadConfigDB(t, rclient, mpi_pfcwd_map)
}

func prepareStateDb(t *testing.T, namespace string) {
rclient := getRedisClientN(t, 6, namespace)
defer rclient.Close()
rclient.FlushDB()
rclient.HSet("SWITCH_CAPABILITY|switch", "test_field", "test_value")
fileName := "../testdata/NEIGH_STATE_TABLE.txt"
neighStateTableByte, err := ioutil.ReadFile(fileName)
if err != nil {
t.Fatalf("read file %v err: %v", fileName, err)
}
mpi_neigh := loadConfig(t, "", neighStateTableByte)
loadDB(t, rclient, mpi_neigh)

}

func prepareDb(t *testing.T, namespace string) {
Expand Down
34 changes: 34 additions & 0 deletions testdata/NEIGH_STATE_TABLE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"NEIGH_STATE_TABLE|10.0.0.57": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|10.0.0.59": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|10.0.0.61": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|10.0.0.63": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|fc00::72": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|fc00::76": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|fc00::7a": {
"peerType": "e-BGP",
"state": "Established"
},
"NEIGH_STATE_TABLE|fc00::7e": {
"peerType": "e-BGP",
"state": "Established"
}
}

0 comments on commit a2a518d

Please sign in to comment.