本文整理汇总了Golang中github.com/contiv/netplugin/netplugin/plugin.NetPlugin.DeleteBgpNeighbors方法的典型用法代码示例。如果您正苦于以下问题:Golang NetPlugin.DeleteBgpNeighbors方法的具体用法?Golang NetPlugin.DeleteBgpNeighbors怎么用?Golang NetPlugin.DeleteBgpNeighbors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/contiv/netplugin/netplugin/plugin.NetPlugin
的用法示例。
在下文中一共展示了NetPlugin.DeleteBgpNeighbors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: processBgpEvent
//processBgpEvent processes Bgp neighbor add/delete events
func processBgpEvent(netPlugin *plugin.NetPlugin, opts cliOpts, hostID string,
isDelete bool) (err error) {
if opts.hostLabel != hostID {
log.Errorf("Skipping deleting neighbor on this host")
return
}
netPlugin.Lock()
defer func() { netPlugin.Unlock() }()
operStr := ""
if isDelete {
err = netPlugin.DeleteBgpNeighbors(hostID)
operStr = "delete"
} else {
err = netPlugin.AddBgpNeighbors(hostID)
operStr = "create"
}
if err != nil {
log.Errorf("Bgp operation %s failed. Error: %s", operStr, err)
} else {
log.Infof("Bgp operation %s succeeded", operStr)
}
return
}