osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.66k stars 699 forks source link

Peer Description not available from WatchEventResponse #2807

Open nazevedo-equinix opened 6 months ago

nazevedo-equinix commented 6 months ago

I'm wanting to set a custom description on each peer that I configure. In my test app I have the following code:

    results, err := client.WatchEvent(context.Background(), &api.WatchEventRequest{
        Peer:  &api.WatchEventRequest_Peer{},
        Table: &api.WatchEventRequest_Table{},
    })

    go func(ctx context.Context, client api.GobgpApiClient, results api.GobgpApi_WatchEventClient) {
        for {
            r, err := results.Recv()
            if err != nil {
                fmt.Printf("there's an error: %+v", err)
                continue
            }
            parseStateChange(r)

        }
    }(context.Background(), client, results)

    for i := 0; i <= 10; i++ {
        client.AddPeer(context.Background(), &api.AddPeerRequest{Peer: &api.Peer{
            ApplyPolicy: nil,
            Conf: &api.PeerConf{
                AuthPassword:        "",
                Description:         "test-description",
                LocalAsn:            0,
                NeighborAddress:     fmt.Sprintf("1.1.1.%d", i),
                PeerAsn:             1234,

            },
        }})
    }
    <-done

}

When I log the event, I'm only getting the local_asn, neighbor_address and peer_asn in the peer config message.

EVENT &{type:STATE  peer:{conf:{local_asn:64512  neighbor_address:"1.1.1.4"  peer_asn:1234}  state:{local_asn:64512  neighbor_address:"1.1.1.4"  peer_asn:1234  session_state:IDLE  router_id:"<nil>"}  transport:{local_address:"<nil>"}}}

How can I get access to the description field?

I tried

description := event.Peer.Peer.Conf.Description

But that always returns an empty string.