(ctx context.Context, r *api.EnableZebraRequest)
| 2008 | } |
| 2009 | |
| 2010 | func (s *BgpServer) EnableZebra(ctx context.Context, r *api.EnableZebraRequest) error { |
| 2011 | if r == nil { |
| 2012 | return fmt.Errorf("nil request") |
| 2013 | } |
| 2014 | return s.mgmtOperation(func() error { |
| 2015 | if s.zclient != nil { |
| 2016 | return fmt.Errorf("already connected to Zebra") |
| 2017 | } |
| 2018 | software := zebra.NewSoftware(uint8(r.Version), r.SoftwareName) |
| 2019 | for _, p := range r.RouteTypes { |
| 2020 | if _, err := zebra.RouteTypeFromString(p, uint8(r.Version), software); err != nil { |
| 2021 | return err |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | protos := make([]string, 0, len(r.RouteTypes)) |
| 2026 | protos = append(protos, r.RouteTypes...) |
| 2027 | var err error |
| 2028 | s.zclient, err = newZebraClient(s, r.Url, protos, uint8(r.Version), r.NexthopTriggerEnable, uint8(r.NexthopTriggerDelay), r.MplsLabelRangeSize, software) |
| 2029 | return err |
| 2030 | }, false) |
| 2031 | } |
| 2032 | |
| 2033 | // bmpMonitoringPolicyFromAPI maps gRPC enum values to OpenConfig string policies. |
| 2034 | // Do not use oc.IntToBmpRouteMonitoringPolicyTypeMap[int(policy)]: protobuf assigns |
nothing calls this directly
no test coverage detected