diff options
author | Hitoshi Irino <irino@sfc.wide.ad.jp> | 2019-08-11 15:54:20 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-21 08:58:25 +0900 |
commit | 82f6a7c6995b12d765acf08e08106925a7d9846f (patch) | |
tree | fae4fb9ccf2e1c2fdc4e3e5ea4ed24754048e0b9 /internal/pkg/zebra/zapi.go | |
parent | 43a2d404b9f4e46b03ddcc0643555a7ac5a9c14d (diff) |
Support connecting zebra of cumulus linux
Diffstat (limited to 'internal/pkg/zebra/zapi.go')
-rw-r--r-- | internal/pkg/zebra/zapi.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/pkg/zebra/zapi.go b/internal/pkg/zebra/zapi.go index fd308a6d..2094c8f6 100644 --- a/internal/pkg/zebra/zapi.go +++ b/internal/pkg/zebra/zapi.go @@ -1063,7 +1063,7 @@ func NewClient(network, address string, typ ROUTE_TYPE, version uint8, software if ((version == 2 || version == 3) && software != "" && software != "quagga") || (version == 4 && software != "" && software != "frr3") || - (version == 5 && software != "" && software != "frr4" && software != "frr5") || + (version == 5 && software != "" && software != "frr4" && software != "frr5" && software != "cumulus") || (version == 6 && software != "" && software != "frr6" && software != "frr7" && software != "frr7.1") { isAllowableSoftware = false } @@ -1244,6 +1244,12 @@ func (c *Client) SendCommand(command API_TYPE, vrfId uint32, body Body) error { } else { return err } + } else if c.Version == 5 && c.SoftwareName == "cumulus" { + if cumulusCommand, err := cumulusZapi5Command(command, c.SoftwareName, false); err == nil { + command = cumulusCommand + } else { + return err + } } m := &Message{ Header: Header{ @@ -3164,6 +3170,12 @@ func (m *Message) parseFrrZapi5Message(data []byte, software string) error { } else { return err } + } else if software == "cumulus" { + if c, err := cumulusZapi5Command(command, software, true); err == nil { + command = c + } else { + return err + } } switch command { case FRR_ZAPI5_INTERFACE_ADD, FRR_ZAPI5_INTERFACE_DELETE, FRR_ZAPI5_INTERFACE_UP, FRR_ZAPI5_INTERFACE_DOWN: |