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:
@@ -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
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user