//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 }