mirror of
https://gitee.com/willfree/mlsr.git
synced 2026-06-06 15:09:27 +08:00
对LsaContainer进行存取邻接LSA的测试,测试通过
This commit is contained in:
@@ -102,6 +102,68 @@ func TestLsaContainer_BuntDB_Emplace_Get_Erase_Adj_Lsa(t *testing.T) {
|
||||
common2.LogInfo("lsaContainer存入邻接lsa失败:", err.Error())
|
||||
}
|
||||
common2.LogInfo("lsaContainer存入邻接lsa成功")
|
||||
|
||||
// 尝试获取lsa
|
||||
origin, _ := component.CreateIdentifierByString("/min/pku")
|
||||
lsa, err := lsaContainer.GetLSAByNameAndType(origin, 2) // 2表示namelsa
|
||||
if err != nil {
|
||||
common2.LogInfo("lsaContainer取出名称lsa失败:", err.Error())
|
||||
} else {
|
||||
ss, _ := lsa.GetJsonString()
|
||||
common2.LogInfo("lsa取出来:", string(ss))
|
||||
}
|
||||
|
||||
// 尝试获取邻接LSA
|
||||
lsa, err = lsaContainer.GetLSAByNameAndType(origin, 1)
|
||||
if err != nil {
|
||||
common2.LogInfo("lsaContainer取出邻接lsa失败:", err.Error())
|
||||
} else {
|
||||
ss, _ := lsa.GetJsonString()
|
||||
common2.LogInfo("lsa取出来:", string(ss))
|
||||
}
|
||||
|
||||
// 再放入一个不同来源路由的邻接lsa
|
||||
base.LsaOriginRouterIdentifier, _ = component.CreateIdentifierByString("/min/thu")
|
||||
err = lsaContainer.Emplace(base)
|
||||
if err != nil {
|
||||
common2.LogInfo("lsaContainer存入邻接lsa失败:", err.Error())
|
||||
}
|
||||
common2.LogInfo("lsaContainer存入邻接lsa成功")
|
||||
|
||||
// 取出所有namelsa
|
||||
lsas, _ := lsaContainer.GetLSAsByType(2)
|
||||
common2.LogInfo("取出所有namelsa:")
|
||||
for i := 0; i < len(lsas); i++ {
|
||||
common2.LogInfo(lsas[i].ToString())
|
||||
}
|
||||
common2.LogInfo("")
|
||||
|
||||
// 取出所有邻接lsa
|
||||
lsas, _ = lsaContainer.GetLSAsByType(1)
|
||||
common2.LogInfo("取出所有adjlsa:")
|
||||
for i := 0; i < len(lsas); i++ {
|
||||
common2.LogInfo(lsas[i].ToString())
|
||||
}
|
||||
common2.LogInfo("")
|
||||
|
||||
// 取出所有Namelsa的key
|
||||
keys, _ := lsaContainer.GetLSAKeysByType(2)
|
||||
common2.LogInfo("取出所有namelsa的key:", keys)
|
||||
common2.LogInfo("")
|
||||
|
||||
// 取出所有邻接lsa的key
|
||||
keys, _ = lsaContainer.GetLSAKeysByType(1)
|
||||
common2.LogInfo("取出所有邻接lsa的key:", keys)
|
||||
common2.LogInfo("")
|
||||
|
||||
// 删除base2
|
||||
_ = lsaContainer.EraseLsa(base)
|
||||
lsas, _ = lsaContainer.GetLSAsByType(1)
|
||||
common2.LogInfo("删除一个后,取出所有邻接LSA:")
|
||||
for i := 0; i < len(lsas); i++ {
|
||||
common2.LogInfo(lsas[i].ToString())
|
||||
}
|
||||
common2.LogInfo("")
|
||||
}
|
||||
|
||||
//
|
||||
@@ -136,12 +198,6 @@ func TestLsaContainer_BuntDB_Emplace_Get_Erase_Name_Lsa(t *testing.T) {
|
||||
}
|
||||
common2.LogInfo("lsaContainer存入名称lsa成功")
|
||||
|
||||
common2.LogInfo("fuck")
|
||||
|
||||
//for true {
|
||||
// time.Sleep(20000)
|
||||
//}
|
||||
|
||||
// 获取lsa
|
||||
origin, _ := component.CreateIdentifierByString("/min/pku")
|
||||
lsa, err := lsaContainer.GetLSAByNameAndType(origin, 2) // 2表示namelsa
|
||||
|
||||
Reference in New Issue
Block a user