Skip to content

Commit ab6cef1

Browse files
committed
docs: set default routing policy
Add an example to set default import policy. Signed-off-by: FUJITA Tomonori <[email protected]>
1 parent e0f16a8 commit ab6cef1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/sources/lib.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ func main() {
4242
log.Error("failed to start BGP", slog.String("Error", err.Error()))
4343
}
4444

45+
// set default import policy
46+
s.SetPolicyAssignment(context.Background(), &api.SetPolicyAssignmentRequest{
47+
Assignment: &api.PolicyAssignment{
48+
Direction: api.PolicyDirection_POLICY_DIRECTION_IMPORT,
49+
DefaultAction: api.RouteAction_ROUTE_ACTION_REJECT,
50+
},
51+
})
52+
4553
// monitor the change of the peer state
4654
if err := s.WatchEvent(context.Background(), server.WatchEventMessageCallbacks{
4755
OnPeerUpdate: func(peer *apiutil.WatchEventMessage_PeerEvent, _ time.Time) {

0 commit comments

Comments
 (0)