1
0
mirror of https://gitee.com/willfree/mlsr.git synced 2026-06-15 18:44:53 +08:00

将minlib分支重新切换回para,再修复hello协议及fibcontroller的报错

This commit is contained in:
free will
2022-07-15 22:35:50 +08:00
parent 18ea8b406f
commit 55e67d53f7
2 changed files with 21 additions and 4 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ func (hp *HelloProtocol) Init(face *logicface.LogicFace,
return
}
// 设置监听前缀
err = hp.m_face.RegisterIdentifier(name, 3000)
err = hp.m_face.RegisterPullIdentifier(name, 3000)
if err != nil {
common2.LogFatal("HelloProtocol Setting interest filter for Hello interest error, identifier register wrong.", err)
return
@@ -136,7 +136,7 @@ func (hp *HelloProtocol) SendHelloInterest(neighbor *component.Identifier) {
// 如果找到了,且有对应的faceID,则发送一个hello探测包
if adjInfo.LogicFaceId() != 0 {
// interest name: /<neighbor>/NLSR/INFO/<router>
name, err := component.CreateIdentifierByString(adjInfo.GetNeighborRouterIdentifier().ToString() +
name, err := component.CreateIdentifierByString(adjInfo.GetNeighborRouterIdentifier().ToUri() +
"/" + MLSR_COMPONENT + "/" + INFO_COMPONENT +
"/" + GetSinglePrefixForHelloProtocol(hp.mlsrConfig.GetRouterPrefix()))
if err != nil {
+19 -2
View File
@@ -152,13 +152,29 @@ func DelFib(prefix string, logicFaceId uint64) error {
return nil
}
func NewReadControlParameters() (*component.ControlParameters, error) {
semantics := "pull"
parameters := &component.ControlParameters{}
parameters.SetSemantics(component.GetSemanticsEnumByString(semantics))
if !component.CheckSemanticsSupport(parameters.Semantics()) {
/* Not Support for this semantics */
return nil, errors.New("not support semantics: pull")
}
return parameters, nil
}
// ListFib
// @Description:显示所有前缀对应的所有下一跳信息
// @return error
//
func ListFib() error {
/* Create Control Parameters */
parameters, err := NewReadControlParameters()
if err != nil {
return err
}
//Create Command Executor
commnadExecutor, err := controller.PrepareCommandExecutor(mgmt.CreateFibListCommand(TopPrefix))
commnadExecutor, err := controller.PrepareCommandExecutor(mgmt.CreateFibListCommand(TopPrefix, parameters))
if err != nil {
return err
}
@@ -178,7 +194,8 @@ func ListFib() error {
table := tablewriter.NewWriter(os.Stdout)
for _, fibInfo := range fibInfoList {
for _, nextHopInfo := range fibInfo.NextHopsInfo {
table.Append([]string{fibInfo.Identifier, strconv.FormatUint(nextHopInfo.LogicFaceId, 10), strconv.FormatUint(nextHopInfo.Cost, 10)})
table.Append([]string{fibInfo.Identifier, strconv.FormatUint(nextHopInfo.LogicFaceId, 10),
strconv.FormatUint(nextHopInfo.Cost, 10)})
}
}
table.SetHeader([]string{"Prefix", "LogicFaceId", "Cost"})