Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer Description not available from WatchEventResponse #2807

Open
nazevedo-equinix opened this issue May 8, 2024 · 0 comments
Open

Peer Description not available from WatchEventResponse #2807

nazevedo-equinix opened this issue May 8, 2024 · 0 comments

Comments

@nazevedo-equinix
Copy link

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.

@nazevedo-equinix nazevedo-equinix changed the title Peer Description not available when WatchEvent Peer Description not available from WatchEventResponse May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant