MCPcopy
hub / github.com/osrg/gobgp / EnableZebra

Method EnableZebra

pkg/server/server.go:2010–2031  ·  view source on GitHub ↗
(ctx context.Context, r *api.EnableZebraRequest)

Source from the content-addressed store, hash-verified

2008}
2009
2010func (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

Callers

nothing calls this directly

Calls 4

mgmtOperationMethod · 0.95
NewSoftwareFunction · 0.92
RouteTypeFromStringFunction · 0.92
newZebraClientFunction · 0.85

Tested by

no test coverage detected