Newer
Older
package server
import (
log "github.com/sirupsen/logrus"
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/protocols/bgp/packet"
"github.com/bio-routing/bio-rd/route"
"github.com/bio-routing/bio-rd/routingtable"
)
// UpdateSenderAddPath converts table changes into BGP update messages with add path
type UpdateSenderAddPath struct {
routingtable.ClientManager
func newUpdateSenderAddPath(fsm *FSM) *UpdateSenderAddPath {
// AddPath serializes a new path and sends out a BGP update message
func (u *UpdateSenderAddPath) AddPath(pfx net.Prefix, p *route.Path) error {
log.Errorf("Unable to create BGP Update: %v", err)
return nil
Christoph Petrausch
committed
update := &packet.BGPUpdateAddPath{
Christoph Petrausch
committed
NLRI: &packet.NLRIAddPath{
PathIdentifier: p.BGPPath.PathIdentifier,
IP: pfx.Addr(),
Pfxlen: pfx.Pfxlen(),
Christoph Petrausch
committed
return serializeAndSendUpdate(u.fsm.con, update)
func (u *UpdateSenderAddPath) RemovePath(pfx net.Prefix, p *route.Path) bool {
err := withDrawPrefixesAddPath(u.fsm.con, pfx, p)
return err == nil
func (u *UpdateSenderAddPath) UpdateNewClient(client routingtable.RouteTableClient) error {
log.Warningf("BGP Update Sender: UpdateNewClient not implemented")