From 3814f0f980c6ba25dd6cde5e4ab2adb52329031b Mon Sep 17 00:00:00 2001 From: Andrii Date: Mon, 2 Sep 2019 11:54:05 +0300 Subject: [PATCH] API for GRE (#1445) * Add GRE VPP calls. Add GRE type and link to inteface message * add basic validation and support of create and delete operations for GRE * Rename things. Store addresses as net.IP * add GRE to interfaces dump * Add UNKNOWN to types of GRE tunnel * Support vpp1901 and vpp1908 * Test also removing of GRE tunnel --- api/models/vpp/interfaces/interface.pb.go | 390 +++++++++---- api/models/vpp/interfaces/interface.proto | 16 + plugins/vpp/binapi/vpp1901/gen.go | 1 + plugins/vpp/binapi/vpp1901/gre/gre.ba.go | 182 ++++++ plugins/vpp/binapi/vpp1904/gen.go | 1 + plugins/vpp/binapi/vpp1904/gre/gre.ba.go | 184 ++++++ plugins/vpp/binapi/vpp1908/gen.go | 1 + plugins/vpp/binapi/vpp1908/gre/gre.ba.go | 532 ++++++++++++++++++ plugins/vpp/ifplugin/descriptor/interface.go | 27 + .../vpp/ifplugin/descriptor/interface_crud.go | 9 + plugins/vpp/ifplugin/vppcalls/if_vppcalls.go | 15 + .../vpp1901/dump_interface_vppcalls.go | 57 ++ .../ifplugin/vppcalls/vpp1901/gre_vppcalls.go | 90 +++ .../vpp1904/dump_interface_vppcalls.go | 57 ++ .../ifplugin/vppcalls/vpp1904/gre_vppcalls.go | 90 +++ .../vpp1908/dump_interface_vppcalls.go | 69 +++ .../ifplugin/vppcalls/vpp1908/gre_vppcalls.go | 123 ++++ tests/integration/vpp/080_gre_test.go | 165 ++++++ 18 files changed, 1888 insertions(+), 121 deletions(-) create mode 100644 plugins/vpp/binapi/vpp1901/gre/gre.ba.go create mode 100644 plugins/vpp/binapi/vpp1904/gre/gre.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/gre/gre.ba.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1901/gre_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1904/gre_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/gre_vppcalls.go create mode 100644 tests/integration/vpp/080_gre_test.go diff --git a/api/models/vpp/interfaces/interface.pb.go b/api/models/vpp/interfaces/interface.pb.go index e83fb8b505..5db5c1723b 100644 --- a/api/models/vpp/interfaces/interface.pb.go +++ b/api/models/vpp/interfaces/interface.pb.go @@ -5,11 +5,10 @@ package vpp_interfaces import ( fmt "fmt" - math "math" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -37,6 +36,7 @@ const ( Interface_IPSEC_TUNNEL Interface_Type = 8 Interface_VMXNET3_INTERFACE Interface_Type = 9 Interface_BOND_INTERFACE Interface_Type = 10 + Interface_GRE_TUNNEL Interface_Type = 11 ) var Interface_Type_name = map[int32]string{ @@ -51,6 +51,7 @@ var Interface_Type_name = map[int32]string{ 8: "IPSEC_TUNNEL", 9: "VMXNET3_INTERFACE", 10: "BOND_INTERFACE", + 11: "GRE_TUNNEL", } var Interface_Type_value = map[string]int32{ @@ -65,6 +66,7 @@ var Interface_Type_value = map[string]int32{ "IPSEC_TUNNEL": 8, "VMXNET3_INTERFACE": 9, "BOND_INTERFACE": 10, + "GRE_TUNNEL": 11, } func (x Interface_Type) String() string { @@ -249,6 +251,37 @@ func (BondLink_LoadBalance) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1ac7cab935c1dc4d, []int{8, 1} } +type GreLink_Type int32 + +const ( + GreLink_UNKNOWN GreLink_Type = 0 + GreLink_L3 GreLink_Type = 1 + GreLink_TEB GreLink_Type = 2 + GreLink_ERSPAN GreLink_Type = 3 +) + +var GreLink_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "L3", + 2: "TEB", + 3: "ERSPAN", +} + +var GreLink_Type_value = map[string]int32{ + "UNKNOWN": 0, + "L3": 1, + "TEB": 2, + "ERSPAN": 3, +} + +func (x GreLink_Type) String() string { + return proto.EnumName(GreLink_Type_name, int32(x)) +} + +func (GreLink_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1ac7cab935c1dc4d, []int{9, 0} +} + type Interface struct { // Name is mandatory field representing logical name for the interface. // It must be unique across all configured interfaces. @@ -285,6 +318,7 @@ type Interface struct { // *Interface_Ipsec // *Interface_VmxNet3 // *Interface_Bond + // *Interface_Gre Link isInterface_Link `protobuf_oneof:"link"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -343,6 +377,9 @@ type Interface_VmxNet3 struct { type Interface_Bond struct { Bond *BondLink `protobuf:"bytes,107,opt,name=bond,proto3,oneof"` } +type Interface_Gre struct { + Gre *GreLink `protobuf:"bytes,108,opt,name=gre,proto3,oneof"` +} func (*Interface_Sub) isInterface_Link() {} func (*Interface_Memif) isInterface_Link() {} @@ -352,6 +389,7 @@ func (*Interface_Vxlan) isInterface_Link() {} func (*Interface_Ipsec) isInterface_Link() {} func (*Interface_VmxNet3) isInterface_Link() {} func (*Interface_Bond) isInterface_Link() {} +func (*Interface_Gre) isInterface_Link() {} func (m *Interface) GetLink() isInterface_Link { if m != nil { @@ -493,6 +531,13 @@ func (m *Interface) GetBond() *BondLink { return nil } +func (m *Interface) GetGre() *GreLink { + if x, ok := m.GetLink().(*Interface_Gre); ok { + return x.Gre + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*Interface) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _Interface_OneofMarshaler, _Interface_OneofUnmarshaler, _Interface_OneofSizer, []interface{}{ @@ -504,6 +549,7 @@ func (*Interface) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) err (*Interface_Ipsec)(nil), (*Interface_VmxNet3)(nil), (*Interface_Bond)(nil), + (*Interface_Gre)(nil), } } @@ -551,6 +597,11 @@ func _Interface_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { if err := b.EncodeMessage(x.Bond); err != nil { return err } + case *Interface_Gre: + _ = b.EncodeVarint(108<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Gre); err != nil { + return err + } case nil: default: return fmt.Errorf("Interface.Link has unexpected type %T", x) @@ -625,6 +676,14 @@ func _Interface_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buff err := b.DecodeMessage(msg) m.Link = &Interface_Bond{msg} return true, err + case 108: // link.gre + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GreLink) + err := b.DecodeMessage(msg) + m.Link = &Interface_Gre{msg} + return true, err default: return false, nil } @@ -674,6 +733,11 @@ func _Interface_OneofSizer(msg proto.Message) (n int) { n += 2 // tag and wire n += proto.SizeVarint(uint64(s)) n += s + case *Interface_Gre: + s := proto.Size(x.Gre) + n += 2 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -1556,6 +1620,80 @@ func (m *BondLink_BondedInterface) GetIsLongTimeout() bool { func (*BondLink_BondedInterface) XXX_MessageName() string { return "vpp.interfaces.BondLink.BondedInterface" } + +type GreLink struct { + TunnelType GreLink_Type `protobuf:"varint,1,opt,name=tunnel_type,json=tunnelType,proto3,enum=vpp.interfaces.GreLink_Type" json:"tunnel_type,omitempty"` + SrcAddr string `protobuf:"bytes,2,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"` + DstAddr string `protobuf:"bytes,3,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + OuterFibId uint32 `protobuf:"varint,4,opt,name=outer_fib_id,json=outerFibId,proto3" json:"outer_fib_id,omitempty"` + SessionId uint32 `protobuf:"varint,5,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GreLink) Reset() { *m = GreLink{} } +func (m *GreLink) String() string { return proto.CompactTextString(m) } +func (*GreLink) ProtoMessage() {} +func (*GreLink) Descriptor() ([]byte, []int) { + return fileDescriptor_1ac7cab935c1dc4d, []int{9} +} +func (m *GreLink) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GreLink.Unmarshal(m, b) +} +func (m *GreLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GreLink.Marshal(b, m, deterministic) +} +func (m *GreLink) XXX_Merge(src proto.Message) { + xxx_messageInfo_GreLink.Merge(m, src) +} +func (m *GreLink) XXX_Size() int { + return xxx_messageInfo_GreLink.Size(m) +} +func (m *GreLink) XXX_DiscardUnknown() { + xxx_messageInfo_GreLink.DiscardUnknown(m) +} + +var xxx_messageInfo_GreLink proto.InternalMessageInfo + +func (m *GreLink) GetTunnelType() GreLink_Type { + if m != nil { + return m.TunnelType + } + return GreLink_UNKNOWN +} + +func (m *GreLink) GetSrcAddr() string { + if m != nil { + return m.SrcAddr + } + return "" +} + +func (m *GreLink) GetDstAddr() string { + if m != nil { + return m.DstAddr + } + return "" +} + +func (m *GreLink) GetOuterFibId() uint32 { + if m != nil { + return m.OuterFibId + } + return 0 +} + +func (m *GreLink) GetSessionId() uint32 { + if m != nil { + return m.SessionId + } + return 0 +} + +func (*GreLink) XXX_MessageName() string { + return "vpp.interfaces.GreLink" +} func init() { proto.RegisterEnum("vpp.interfaces.Interface_Type", Interface_Type_name, Interface_Type_value) proto.RegisterEnum("vpp.interfaces.Interface_RxMode_Type", Interface_RxMode_Type_name, Interface_RxMode_Type_value) @@ -1563,6 +1701,7 @@ func init() { proto.RegisterEnum("vpp.interfaces.MemifLink_MemifMode", MemifLink_MemifMode_name, MemifLink_MemifMode_value) proto.RegisterEnum("vpp.interfaces.BondLink_Mode", BondLink_Mode_name, BondLink_Mode_value) proto.RegisterEnum("vpp.interfaces.BondLink_LoadBalance", BondLink_LoadBalance_name, BondLink_LoadBalance_value) + proto.RegisterEnum("vpp.interfaces.GreLink_Type", GreLink_Type_name, GreLink_Type_value) proto.RegisterType((*Interface)(nil), "vpp.interfaces.Interface") proto.RegisterType((*Interface_Unnumbered)(nil), "vpp.interfaces.Interface.Unnumbered") proto.RegisterType((*Interface_RxMode)(nil), "vpp.interfaces.Interface.RxMode") @@ -1576,6 +1715,7 @@ func init() { proto.RegisterType((*VmxNet3Link)(nil), "vpp.interfaces.VmxNet3Link") proto.RegisterType((*BondLink)(nil), "vpp.interfaces.BondLink") proto.RegisterType((*BondLink_BondedInterface)(nil), "vpp.interfaces.BondLink.BondedInterface") + proto.RegisterType((*GreLink)(nil), "vpp.interfaces.GreLink") } func init() { @@ -1583,123 +1723,131 @@ func init() { } var fileDescriptor_1ac7cab935c1dc4d = []byte{ - // 1878 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x57, 0xcd, 0x72, 0xe3, 0xc6, - 0x11, 0x16, 0x7f, 0x24, 0x02, 0xcd, 0x1f, 0x61, 0x27, 0xb6, 0x83, 0x95, 0x77, 0x6d, 0x85, 0xc9, - 0xc6, 0xaa, 0xa4, 0x2c, 0xad, 0x28, 0x57, 0xc5, 0x89, 0x4f, 0xa0, 0x08, 0x79, 0xb9, 0x4b, 0x81, - 0x0c, 0x08, 0xee, 0xae, 0x53, 0xa9, 0x42, 0x81, 0xc0, 0x10, 0x44, 0x04, 0x02, 0x58, 0xcc, 0x90, - 0x4b, 0xb9, 0x2a, 0xcf, 0x90, 0x7b, 0x9e, 0x26, 0x47, 0x1f, 0x72, 0xc9, 0x31, 0xe7, 0x1c, 0x73, - 0xcc, 0x0b, 0xa4, 0xe6, 0x07, 0x14, 0xa5, 0x95, 0xec, 0x8b, 0x34, 0xf3, 0x75, 0x7f, 0x3d, 0x8d, - 0x9e, 0xee, 0x9e, 0x26, 0x3c, 0x5b, 0xa4, 0x01, 0x8e, 0xc9, 0xc9, 0x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 0x73, 0x47, 0x2b, 0xb7, 0xff, 0x0a, 0xea, 0xa6, 0x65, 0x33, 0xdf, 0x48, 0xee, 0x6f, 0x46, 0x01, - 0x99, 0xcd, 0x24, 0xf7, 0x8b, 0x49, 0xe0, 0x73, 0xa8, 0x07, 0x84, 0x6e, 0x14, 0xca, 0x42, 0x21, - 0x20, 0xb4, 0x50, 0x60, 0x73, 0x40, 0x12, 0xc9, 0x60, 0xb2, 0x25, 0x7a, 0x02, 0xea, 0x62, 0x19, - 0xd3, 0xc8, 0xf7, 0x08, 0x95, 0x71, 0xbc, 0x01, 0xda, 0xcf, 0xa1, 0xb1, 0xfd, 0x2e, 0xa1, 0x43, - 0x68, 0xcc, 0x53, 0x42, 0xdd, 0x68, 0x76, 0xab, 0xa0, 0x18, 0xd6, 0x9f, 0xb1, 0x82, 0x6a, 0xff, - 0xab, 0x04, 0x35, 0xf9, 0x26, 0xb1, 0xa9, 0x66, 0x85, 0x73, 0xc2, 0xea, 0x47, 0xb4, 0xaa, 0x62, - 0xfb, 0x81, 0x9d, 0xf2, 0x5d, 0x3b, 0xec, 0x96, 0x69, 0xea, 0x2e, 0x22, 0x3f, 0x4f, 0x09, 0xce, - 0x57, 0x91, 0x2f, 0xba, 0xac, 0x6a, 0xb7, 0x68, 0x7a, 0xb9, 0x85, 0x32, 0x53, 0xf9, 0xda, 0xbd, - 0xb9, 0xd0, 0xaa, 0xb8, 0xb1, 0x7c, 0x6d, 0x17, 0x57, 0x7a, 0x08, 0x0d, 0xba, 0xad, 0x21, 0x2a, - 0x0c, 0xe8, 0x8d, 0xc6, 0x53, 0x00, 0x31, 0x6f, 0xb9, 0x21, 0x49, 0x79, 0x4a, 0x28, 0xb6, 0x2a, - 0x90, 0x6f, 0x49, 0xda, 0xfe, 0x6f, 0x05, 0xd4, 0xcd, 0x2b, 0xc8, 0x62, 0x88, 0x49, 0x22, 0x93, - 0x94, 0x2d, 0x59, 0xd8, 0xbd, 0x84, 0x46, 0x6e, 0x8e, 0x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0x6e, 0x0f, 0x27, 0x56, 0xcf, 0xb5, 0x87, 0xdd, 0xbe, 0xa5, 0x95, 0xd8, - 0x24, 0x63, 0x9c, 0xb3, 0xe9, 0xca, 0x65, 0x03, 0xcb, 0x64, 0xa4, 0x95, 0xd9, 0x74, 0xf2, 0x76, - 0x68, 0x6b, 0x15, 0x36, 0x9d, 0x74, 0xed, 0xa1, 0xd1, 0x3b, 0x37, 0xc6, 0x8e, 0x56, 0x65, 0xcf, - 0xe3, 0xc0, 0x38, 0x1f, 0x69, 0xbb, 0xed, 0x2f, 0xa0, 0xbe, 0x15, 0x32, 0xd6, 0xa6, 0x07, 0x1d, - 0x6d, 0x87, 0x11, 0x07, 0x67, 0x5f, 0x69, 0x25, 0xbe, 0xe8, 0x9c, 0x69, 0xe5, 0xee, 0xcb, 0x1f, - 0xfe, 0xf3, 0x59, 0xe9, 0x4f, 0xbd, 0xad, 0x5f, 0x9a, 0x71, 0x14, 0x7a, 0x34, 0x65, 0xbf, 0x22, - 0xbf, 0xf4, 0x42, 0x9c, 0xd0, 0x13, 0x2f, 0x8b, 0x4e, 0xee, 0xfd, 0x01, 0xfb, 0xcd, 0x2a, 0xcb, - 0xb6, 0xe2, 0x3f, 0xdd, 0xe3, 0xbf, 0x34, 0xcf, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xba, 0x96, - 0x18, 0x73, 0xef, 0x0e, 0x00, 0x00, + // 2007 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x57, 0x5b, 0x73, 0xdb, 0xc6, + 0x15, 0x16, 0x2f, 0xe2, 0xe5, 0xf0, 0x22, 0x78, 0x9b, 0xa4, 0xb0, 0x62, 0x27, 0x2a, 0x5b, 0x37, + 0x9a, 0x76, 0x22, 0x59, 0x54, 0x66, 0x9a, 0x36, 0xd3, 0x07, 0x50, 0x84, 0x6c, 0xda, 0x14, 0xc9, + 0x82, 0x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, 0xe0, 0x2b, + 0xf3, 0xd8, 0x59, 0x04, 0xb3, 0x34, 0x66, 0x34, 0xbd, 0x0c, 0x66, 0x32, 0xeb, 0x56, 0xad, 0x26, + 0x8f, 0xcf, 0x36, 0x50, 0x5c, 0x2a, 0x5d, 0x39, 0x37, 0x0f, 0x5a, 0x94, 0x2f, 0x96, 0xae, 0xac, + 0xec, 0x49, 0xf7, 0xa0, 0xce, 0x37, 0x35, 0x64, 0x84, 0x01, 0xbf, 0xd1, 0x78, 0x0a, 0x20, 0x9b, + 0x35, 0xc7, 0x67, 0xb1, 0x70, 0x89, 0x8a, 0x55, 0x95, 0xc8, 0x0b, 0x16, 0xb7, 0xfe, 0x53, 0x80, + 0xea, 0xba, 0x84, 0xa2, 0x0d, 0x29, 0x8b, 0x94, 0x93, 0xe2, 0x10, 0xcd, 0xee, 0x46, 0x3c, 0x70, + 0x52, 0x9a, 0x84, 0xee, 0x75, 0x96, 0x72, 0x11, 0xb2, 0x04, 0x42, 0x1e, 0x43, 0x25, 0x8c, 0x67, + 0x6e, 0x88, 0xe5, 0x4b, 0xda, 0xb8, 0x2c, 0xe6, 0xbd, 0x44, 0xb8, 0x13, 0x5d, 0xc4, 0x9c, 0xa2, + 0x4c, 0xfa, 0x69, 0x45, 0x02, 0x52, 0x28, 0x79, 0x2c, 0x09, 0x32, 0x4f, 0x15, 0xc0, 0x38, 0x09, + 0xf0, 0xd0, 0x8a, 0x89, 0x52, 0xe9, 0xa8, 0x6a, 0x2d, 0x14, 0x1f, 0x03, 0xcc, 0xd2, 0xeb, 0x84, + 0xc7, 0x8e, 0x1b, 0xfa, 0xc2, 0x51, 0x9b, 0xed, 0x8f, 0x64, 0x34, 0x8a, 0x5e, 0xf8, 0x44, 0x08, + 0x8d, 0xd0, 0xb7, 0xaa, 0xb3, 0x6c, 0x48, 0xf6, 0x41, 0x93, 0x1b, 0x2a, 0xea, 0x05, 0xbd, 0x16, + 0x6e, 0x5c, 0xb5, 0x9a, 0x02, 0x97,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xec, 0x31, 0x54, 0xb2, 0x2c, 0xaf, 0xf2, 0x62, 0x59, 0xa5, 0x78, 0x14, 0x65, + 0xf9, 0x5d, 0x65, 0xc3, 0xb2, 0x4a, 0xee, 0x98, 0xe4, 0xe2, 0x25, 0xa7, 0xa9, 0x33, 0x0f, 0x44, + 0x3b, 0xa3, 0xd2, 0xa0, 0xc0, 0x4e, 0x03, 0xec, 0x69, 0x9e, 0x02, 0x30, 0xca, 0x30, 0xfd, 0xa2, + 0x5c, 0x26, 0xc1, 0xaa, 0x42, 0x7a, 0x5e, 0xeb, 0xf9, 0x7d, 0x0d, 0x2c, 0x5e, 0xf8, 0x58, 0xde, + 0xd3, 0x36, 0x3b, 0x5a, 0x9e, 0x00, 0x94, 0x4c, 0x6b, 0x3c, 0x32, 0x06, 0x5a, 0xa1, 0xf3, 0xea, + 0xfb, 0x7f, 0x7f, 0x96, 0xfb, 0x63, 0x77, 0xe3, 0xd3, 0x3c, 0x0c, 0x7c, 0x97, 0xc7, 0xf8, 0xd9, + 0xfd, 0xa5, 0xeb, 0xd3, 0x88, 0x1f, 0xba, 0x49, 0x70, 0x78, 0xef, 0x17, 0xff, 0x37, 0x97, 0x49, + 0xb2, 0xe1, 0x73, 0xd3, 0x92, 0xf8, 0x34, 0x3f, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa6, + 0x04, 0xf7, 0xaa, 0x20, 0x10, 0x00, 0x00, } diff --git a/api/models/vpp/interfaces/interface.proto b/api/models/vpp/interfaces/interface.proto index 629ec8b804..6d943cd4c6 100644 --- a/api/models/vpp/interfaces/interface.proto +++ b/api/models/vpp/interfaces/interface.proto @@ -22,6 +22,7 @@ message Interface { IPSEC_TUNNEL = 8; VMXNET3_INTERFACE = 9; BOND_INTERFACE = 10; + GRE_TUNNEL = 11; }; // Name is mandatory field representing logical name for the interface. @@ -97,6 +98,7 @@ message Interface { IPSecLink ipsec = 105; VmxNet3Link vmx_net3 = 106; BondLink bond = 107; + GreLink gre = 108; }; }; @@ -226,3 +228,17 @@ message BondLink { } repeated BondedInterface bonded_interfaces = 12; } + +message GreLink { + enum Type { + UNKNOWN = 0; + L3 = 1; // L3 GRE (i.e. this tunnel is in L3 mode) + TEB = 2; // Transparent Ethernet Bridging - the tunnel is in L2 mode + ERSPAN = 3; // ERSPAN - the tunnel is for port mirror SPAN output + }; + Type tunnel_type = 1; + string src_addr = 2; + string dst_addr = 3; + uint32 outer_fib_id = 4; + uint32 session_id = 5; +} diff --git a/plugins/vpp/binapi/vpp1901/gen.go b/plugins/vpp/binapi/vpp1901/gen.go index f674581db9..75a84f5e0e 100644 --- a/plugins/vpp/binapi/vpp1901/gen.go +++ b/plugins/vpp/binapi/vpp1901/gen.go @@ -22,6 +22,7 @@ package vpp1901 //go:generate binapi-generator --input-file=/usr/share/vpp/api/bfd.api.json //go:generate binapi-generator --input-file=/usr/share/vpp/api/bond.api.json //go:generate binapi-generator --input-file=/usr/share/vpp/api/dhcp.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/gre.api.json //go:generate binapi-generator --input-file=/usr/share/vpp/api/interface.api.json //go:generate binapi-generator --input-file=/usr/share/vpp/api/ip.api.json //go:generate binapi-generator --input-file=/usr/share/vpp/api/ipsec.api.json diff --git a/plugins/vpp/binapi/vpp1901/gre/gre.ba.go b/plugins/vpp/binapi/vpp1901/gre/gre.ba.go new file mode 100644 index 0000000000..3866aa7317 --- /dev/null +++ b/plugins/vpp/binapi/vpp1901/gre/gre.ba.go @@ -0,0 +1,182 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/gre.api.json + +/* +Package gre is a generated VPP binary API for 'gre' module. + +It consists of: + 4 messages + 2 services +*/ +package gre + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "gre" + // VersionCrc is the CRC of this module. + VersionCrc = 0x83d2c14f +) + +// GreAddDelTunnel represents VPP binary API message 'gre_add_del_tunnel'. +type GreAddDelTunnel struct { + IsAdd uint8 + IsIPv6 uint8 + TunnelType uint8 + Instance uint32 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + OuterFibID uint32 + SessionID uint16 +} + +func (*GreAddDelTunnel) GetMessageName() string { + return "gre_add_del_tunnel" +} +func (*GreAddDelTunnel) GetCrcString() string { + return "9f03ede2" +} +func (*GreAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GreAddDelTunnelReply represents VPP binary API message 'gre_add_del_tunnel_reply'. +type GreAddDelTunnelReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*GreAddDelTunnelReply) GetMessageName() string { + return "gre_add_del_tunnel_reply" +} +func (*GreAddDelTunnelReply) GetCrcString() string { + return "fda5941f" +} +func (*GreAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDetails represents VPP binary API message 'gre_tunnel_details'. +type GreTunnelDetails struct { + SwIfIndex uint32 + Instance uint32 + IsIPv6 uint8 + TunnelType uint8 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + OuterFibID uint32 + SessionID uint16 +} + +func (*GreTunnelDetails) GetMessageName() string { + return "gre_tunnel_details" +} +func (*GreTunnelDetails) GetCrcString() string { + return "1a12b8c1" +} +func (*GreTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDump represents VPP binary API message 'gre_tunnel_dump'. +type GreTunnelDump struct { + SwIfIndex uint32 +} + +func (*GreTunnelDump) GetMessageName() string { + return "gre_tunnel_dump" +} +func (*GreTunnelDump) GetCrcString() string { + return "529cb13f" +} +func (*GreTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*GreAddDelTunnel)(nil), "gre.GreAddDelTunnel") + api.RegisterMessage((*GreAddDelTunnelReply)(nil), "gre.GreAddDelTunnelReply") + api.RegisterMessage((*GreTunnelDetails)(nil), "gre.GreTunnelDetails") + api.RegisterMessage((*GreTunnelDump)(nil), "gre.GreTunnelDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GreAddDelTunnel)(nil), + (*GreAddDelTunnelReply)(nil), + (*GreTunnelDetails)(nil), + (*GreTunnelDump)(nil), + } +} + +// RPCService represents RPC service API for gre module. +type RPCService interface { + DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) + GreAddDelTunnel(ctx context.Context, in *GreAddDelTunnel) (*GreAddDelTunnelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpGreTunnelClient{stream} + return x, nil +} + +type RPCService_DumpGreTunnelClient interface { + Recv() (*GreTunnelDetails, error) +} + +type serviceClient_DumpGreTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpGreTunnelClient) Recv() (*GreTunnelDetails, error) { + m := new(GreTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) GreAddDelTunnel(ctx context.Context, in *GreAddDelTunnel) (*GreAddDelTunnelReply, error) { + out := new(GreAddDelTunnelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/gen.go b/plugins/vpp/binapi/vpp1904/gen.go index 0a38ba5476..af32940c58 100644 --- a/plugins/vpp/binapi/vpp1904/gen.go +++ b/plugins/vpp/binapi/vpp1904/gen.go @@ -20,6 +20,7 @@ package vpp1904 //go:generate binapigen --input-file=/usr/share/vpp/api/core/bfd.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/bond.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/dhcp.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/gre.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/interface.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/ip.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/ipsec.api.json diff --git a/plugins/vpp/binapi/vpp1904/gre/gre.ba.go b/plugins/vpp/binapi/vpp1904/gre/gre.ba.go new file mode 100644 index 0000000000..95240992d2 --- /dev/null +++ b/plugins/vpp/binapi/vpp1904/gre/gre.ba.go @@ -0,0 +1,184 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/gre.api.json + +/* +Package gre is a generated VPP binary API for 'gre' module. + +It consists of: + 4 messages + 2 services +*/ +package gre + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "gre" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x83d2c14f +) + +// GreAddDelTunnel represents VPP binary API message 'gre_add_del_tunnel'. +type GreAddDelTunnel struct { + IsAdd uint8 + IsIPv6 uint8 + TunnelType uint8 + Instance uint32 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + OuterFibID uint32 + SessionID uint16 +} + +func (*GreAddDelTunnel) GetMessageName() string { + return "gre_add_del_tunnel" +} +func (*GreAddDelTunnel) GetCrcString() string { + return "9f03ede2" +} +func (*GreAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GreAddDelTunnelReply represents VPP binary API message 'gre_add_del_tunnel_reply'. +type GreAddDelTunnelReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*GreAddDelTunnelReply) GetMessageName() string { + return "gre_add_del_tunnel_reply" +} +func (*GreAddDelTunnelReply) GetCrcString() string { + return "fda5941f" +} +func (*GreAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDetails represents VPP binary API message 'gre_tunnel_details'. +type GreTunnelDetails struct { + SwIfIndex uint32 + Instance uint32 + IsIPv6 uint8 + TunnelType uint8 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + OuterFibID uint32 + SessionID uint16 +} + +func (*GreTunnelDetails) GetMessageName() string { + return "gre_tunnel_details" +} +func (*GreTunnelDetails) GetCrcString() string { + return "1a12b8c1" +} +func (*GreTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDump represents VPP binary API message 'gre_tunnel_dump'. +type GreTunnelDump struct { + SwIfIndex uint32 +} + +func (*GreTunnelDump) GetMessageName() string { + return "gre_tunnel_dump" +} +func (*GreTunnelDump) GetCrcString() string { + return "529cb13f" +} +func (*GreTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*GreAddDelTunnel)(nil), "gre.GreAddDelTunnel") + api.RegisterMessage((*GreAddDelTunnelReply)(nil), "gre.GreAddDelTunnelReply") + api.RegisterMessage((*GreTunnelDetails)(nil), "gre.GreTunnelDetails") + api.RegisterMessage((*GreTunnelDump)(nil), "gre.GreTunnelDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GreAddDelTunnel)(nil), + (*GreAddDelTunnelReply)(nil), + (*GreTunnelDetails)(nil), + (*GreTunnelDump)(nil), + } +} + +// RPCService represents RPC service API for gre module. +type RPCService interface { + DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) + GreAddDelTunnel(ctx context.Context, in *GreAddDelTunnel) (*GreAddDelTunnelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpGreTunnelClient{stream} + return x, nil +} + +type RPCService_DumpGreTunnelClient interface { + Recv() (*GreTunnelDetails, error) +} + +type serviceClient_DumpGreTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpGreTunnelClient) Recv() (*GreTunnelDetails, error) { + m := new(GreTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) GreAddDelTunnel(ctx context.Context, in *GreAddDelTunnel) (*GreAddDelTunnelReply, error) { + out := new(GreAddDelTunnelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/gen.go b/plugins/vpp/binapi/vpp1908/gen.go index 8beeb335c4..fe6e81de71 100644 --- a/plugins/vpp/binapi/vpp1908/gen.go +++ b/plugins/vpp/binapi/vpp1908/gen.go @@ -20,6 +20,7 @@ package vpp1908 //go:generate binapigen --input-file=/usr/share/vpp/api/core/bfd.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/bond.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/dhcp.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/gre.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/interface.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/ip.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/core/ipsec.api.json diff --git a/plugins/vpp/binapi/vpp1908/gre/gre.ba.go b/plugins/vpp/binapi/vpp1908/gre/gre.ba.go new file mode 100644 index 0000000000..aad5eebf72 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/gre/gre.ba.go @@ -0,0 +1,532 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/gre.api.json + +/* +Package gre is a generated VPP binary API for 'gre' module. + +It consists of: + 5 enums + 3 aliases + 7 types + 1 union + 4 messages + 2 services +*/ +package gre + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "gre" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xed1d2d72 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// GreTunnelType represents VPP binary API enum 'gre_tunnel_type'. +type GreTunnelType uint32 + +const ( + GRE_API_TUNNEL_TYPE_L3 GreTunnelType = 0 + GRE_API_TUNNEL_TYPE_TEB GreTunnelType = 1 + GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2 +) + +var GreTunnelType_name = map[uint32]string{ + 0: "GRE_API_TUNNEL_TYPE_L3", + 1: "GRE_API_TUNNEL_TYPE_TEB", + 2: "GRE_API_TUNNEL_TYPE_ERSPAN", +} + +var GreTunnelType_value = map[string]uint32{ + "GRE_API_TUNNEL_TYPE_L3": 0, + "GRE_API_TUNNEL_TYPE_TEB": 1, + "GRE_API_TUNNEL_TYPE_ERSPAN": 2, +} + +func (x GreTunnelType) String() string { + s, ok := GreTunnelType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// GreTunnel represents VPP binary API type 'gre_tunnel'. +type GreTunnel struct { + ClientIndex uint32 + Context uint32 + SessionID uint16 + Type GreTunnelType + Instance uint32 + OuterFibID uint32 + SwIfIndex InterfaceIndex + Src Address + Dst Address +} + +func (*GreTunnel) GetTypeName() string { + return "gre_tunnel" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// GreTunnelAddDel represents VPP binary API message 'gre_tunnel_add_del'. +type GreTunnelAddDel struct { + IsAdd bool + Tunnel GreTunnel +} + +func (*GreTunnelAddDel) GetMessageName() string { + return "gre_tunnel_add_del" +} +func (*GreTunnelAddDel) GetCrcString() string { + return "04199f47" +} +func (*GreTunnelAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GreTunnelAddDelReply represents VPP binary API message 'gre_tunnel_add_del_reply'. +type GreTunnelAddDelReply struct { + Retval int32 + SwIfIndex InterfaceIndex +} + +func (*GreTunnelAddDelReply) GetMessageName() string { + return "gre_tunnel_add_del_reply" +} +func (*GreTunnelAddDelReply) GetCrcString() string { + return "903324db" +} +func (*GreTunnelAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDetails represents VPP binary API message 'gre_tunnel_details'. +type GreTunnelDetails struct { + Tunnel GreTunnel +} + +func (*GreTunnelDetails) GetMessageName() string { + return "gre_tunnel_details" +} +func (*GreTunnelDetails) GetCrcString() string { + return "fd0e1d36" +} +func (*GreTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GreTunnelDump represents VPP binary API message 'gre_tunnel_dump'. +type GreTunnelDump struct { + SwIfIndex InterfaceIndex +} + +func (*GreTunnelDump) GetMessageName() string { + return "gre_tunnel_dump" +} +func (*GreTunnelDump) GetCrcString() string { + return "d85aab0d" +} +func (*GreTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*GreTunnelAddDel)(nil), "gre.GreTunnelAddDel") + api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre.GreTunnelAddDelReply") + api.RegisterMessage((*GreTunnelDetails)(nil), "gre.GreTunnelDetails") + api.RegisterMessage((*GreTunnelDump)(nil), "gre.GreTunnelDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GreTunnelAddDel)(nil), + (*GreTunnelAddDelReply)(nil), + (*GreTunnelDetails)(nil), + (*GreTunnelDump)(nil), + } +} + +// RPCService represents RPC service API for gre module. +type RPCService interface { + DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) + GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpGreTunnel(ctx context.Context, in *GreTunnelDump) (RPCService_DumpGreTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpGreTunnelClient{stream} + return x, nil +} + +type RPCService_DumpGreTunnelClient interface { + Recv() (*GreTunnelDetails, error) +} + +type serviceClient_DumpGreTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpGreTunnelClient) Recv() (*GreTunnelDetails, error) { + m := new(GreTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) { + out := new(GreTunnelAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/ifplugin/descriptor/interface.go b/plugins/vpp/ifplugin/descriptor/interface.go index b6b7ba3dfb..4bd9d259da 100644 --- a/plugins/vpp/ifplugin/descriptor/interface.go +++ b/plugins/vpp/ifplugin/descriptor/interface.go @@ -109,6 +109,15 @@ var ( // ErrBondInterfaceIDExists is returned when the bond interface uses existing ID value ErrBondInterfaceIDExists = errors.Errorf("Bond interface ID already exists") + + // ErrGreBadTunnelType is returned when tunnel type for GRE was not set or set to UNKNOWN + ErrGreBadTunnelType = errors.Errorf("bad tunnel type for GRE") + + // ErrGreSrcAddrMissing is returned when source address was not set or set to an empty string. + ErrGreSrcAddrMissing = errors.Errorf("missing source address for GRE tunnel") + + // ErrGreDstAddrMissing is returned when destination address was not set or set to an empty string. + ErrGreDstAddrMissing = errors.Errorf("missing destination address for GRE tunnel") ) // InterfaceDescriptor teaches KVScheduler how to configure VPP interfaces. @@ -277,6 +286,10 @@ func (d *InterfaceDescriptor) equivalentTypeSpecificConfig(oldIntf, newIntf *int if !d.equivalentBond(oldIntf.GetBond(), newIntf.GetBond()) { return false } + case interfaces.Interface_GRE_TUNNEL: + if !proto.Equal(oldIntf.GetGre(), newIntf.GetGre()) { + return false + } } return true } @@ -399,6 +412,10 @@ func (d *InterfaceDescriptor) Validate(key string, intf *interfaces.Interface) e if intf.Type != interfaces.Interface_IPSEC_TUNNEL { return linkMismatchErr } + case *interfaces.Interface_Gre: + if intf.Type != interfaces.Interface_GRE_TUNNEL { + return linkMismatchErr + } case nil: if intf.Type != interfaces.Interface_SOFTWARE_LOOPBACK && intf.Type != interfaces.Interface_DPDK { @@ -424,6 +441,16 @@ func (d *InterfaceDescriptor) Validate(key string, intf *interfaces.Interface) e if name, ok := d.bondIDs[intf.GetBond().GetId()]; ok && name != intf.GetName() { return kvs.NewInvalidValueError(ErrBondInterfaceIDExists, "link.bond.id") } + case interfaces.Interface_GRE_TUNNEL: + if intf.GetGre().TunnelType == interfaces.GreLink_UNKNOWN { + return kvs.NewInvalidValueError(ErrGreBadTunnelType, "link.gre.tunnel_type") + } + if intf.GetGre().SrcAddr == "" { + return kvs.NewInvalidValueError(ErrGreSrcAddrMissing, "link.gre.src_addr") + } + if intf.GetGre().DstAddr == "" { + return kvs.NewInvalidValueError(ErrGreDstAddrMissing, "link.gre.dst_addr") + } } // validate unnumbered diff --git a/plugins/vpp/ifplugin/descriptor/interface_crud.go b/plugins/vpp/ifplugin/descriptor/interface_crud.go index 9803727316..50d7794934 100644 --- a/plugins/vpp/ifplugin/descriptor/interface_crud.go +++ b/plugins/vpp/ifplugin/descriptor/interface_crud.go @@ -140,6 +140,13 @@ func (d *InterfaceDescriptor) Create(key string, intf *interfaces.Interface) (me return nil, err } d.bondIDs[intf.GetBond().GetId()] = intf.GetName() + + case interfaces.Interface_GRE_TUNNEL: + ifIdx, err = d.ifHandler.AddGreTunnel(intf.Name, intf.GetGre()) + if err != nil { + d.log.Error(err) + return nil, err + } } // MAC address. Note: physical interfaces cannot have the MAC address changed. The bond interface uses its own @@ -237,6 +244,8 @@ func (d *InterfaceDescriptor) Delete(key string, intf *interfaces.Interface, met case interfaces.Interface_BOND_INTERFACE: err = d.ifHandler.DeleteBondInterface(intf.Name, ifIdx) delete(d.bondIDs, intf.GetBond().GetId()) + case interfaces.Interface_GRE_TUNNEL: + _, err = d.ifHandler.DelGreTunnel(intf.Name, intf.GetGre()) } if err != nil { err = errors.Errorf("failed to remove interface %s, index %d: %v", intf.Name, ifIdx, err) diff --git a/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go index 8083e185da..faef72e662 100644 --- a/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go @@ -108,6 +108,17 @@ type InterfaceSpanDetails struct { IsL2 uint8 } +// GreTunnelDetails is something +type GreTunnelDetails struct { + SwIfIndex uint32 + Instance uint32 + TunnelType uint8 + SrcAddress net.IP + DstAddress net.IP + OuterFibID uint32 + SessionID uint16 +} + // InterfaceVppAPI provides methods for creating and managing interface plugin type InterfaceVppAPI interface { InterfaceVppRead @@ -196,6 +207,10 @@ type InterfaceVppAPI interface { AddSpan(ifIdxFrom, ifIdxTo uint32, direction uint8, isL2 uint8) error // DelSpan removes new span record DelSpan(ifIdxFrom, ifIdxTo uint32, isL2 uint8) error + // AddGreTunnel adds new GRE interface. + AddGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) + // DelGreTunnel removes GRE interface. + DelGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) } // InterfaceVppRead provides read methods for interface plugin diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go index f085bf9d1a..7eccff04e4 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go @@ -21,6 +21,7 @@ import ( "strings" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/bond" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/gre" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" @@ -245,6 +246,11 @@ func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDe return nil, err } + err = h.dumpGreDetails(ifs) + if err != nil { + return nil, err + } + // Rx-placement dump is last since it uses interface type-specific data err = h.dumpRxPlacement(ifs) if err != nil { @@ -804,6 +810,41 @@ func (h *InterfaceVppHandler) dumpBondDetails(ifs map[uint32]*vppcalls.Interface return nil } +func (h *InterfaceVppHandler) dumpGreDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + reqCtx := h.callsChannel.SendMultiRequest(&gre.GreTunnelDump{SwIfIndex: ^uint32(0)}) + for { + greDetails := &gre.GreTunnelDetails{} + stop, err := reqCtx.ReceiveReply(greDetails) + if stop { + break + } + if err != nil { + return fmt.Errorf("failed to dump span: %v", err) + } + + var srcAddr, dstAddr net.IP + if greDetails.IsIPv6 == 1 { + srcAddr = net.IP(greDetails.SrcAddress) + dstAddr = net.IP(greDetails.DstAddress) + } else { + srcAddr = net.IP(greDetails.SrcAddress[:4]) + dstAddr = net.IP(greDetails.DstAddress[:4]) + } + + ifs[greDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Gre{ + Gre: &interfaces.GreLink{ + TunnelType: getGreTunnelType(greDetails.TunnelType), + SrcAddr: srcAddr.String(), + DstAddr: dstAddr.String(), + OuterFibId: greDetails.OuterFibID, + SessionId: uint32(greDetails.SessionID), + }, + } + ifs[greDetails.SwIfIndex].Interface.Type = interfaces.Interface_GRE_TUNNEL + } + return nil +} + // dumpUnnumberedDetails returns a map of unnumbered interface indexes, every with interface index of element with IP func (h *InterfaceVppHandler) dumpUnnumberedDetails() (map[uint32]uint32, error) { unIfMap := make(map[uint32]uint32) // unnumbered/ip-interface @@ -897,6 +938,9 @@ func guessInterfaceType(ifName string) interfaces.Interface_Type { case strings.HasPrefix(ifName, "Bond"): return interfaces.Interface_BOND_INTERFACE + case strings.HasPrefix(ifName, "gre"): + return interfaces.Interface_GRE_TUNNEL + default: return interfaces.Interface_DPDK } @@ -984,6 +1028,19 @@ func getTagRwOption(op uint32) interfaces.SubInterface_TagRewriteOptions { } } +func getGreTunnelType(tt uint8) interfaces.GreLink_Type { + switch tt { + case 0: + return interfaces.GreLink_L3 + case 1: + return interfaces.GreLink_TEB + case 2: + return interfaces.GreLink_ERSPAN + default: + return interfaces.GreLink_UNKNOWN + } +} + func uintToBool(value uint8) bool { if value == 0 { return false diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/gre_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/gre_vppcalls.go new file mode 100644 index 0000000000..7be2a31ce8 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/gre_vppcalls.go @@ -0,0 +1,90 @@ +package vpp1901 + +import ( + "errors" + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/gre" +) + +func (h *InterfaceVppHandler) greAddDelTunnel(isAdd uint8, greLink *interfaces.GreLink) (uint32, error) { + if greLink.TunnelType == interfaces.GreLink_UNKNOWN { + err := errors.New("bad GRE tunnel type") + return 0, err + } + + greSource := net.ParseIP(greLink.SrcAddr) + if greSource == nil { + err := errors.New("bad source address for GRE tunnel") + return 0, err + } + greDestination := net.ParseIP(greLink.DstAddr) + if greDestination == nil { + err := errors.New("bad destination address for GRE tunnel") + return 0, err + } + + if greLink.SrcAddr == greLink.DstAddr { + err := errors.New("source and destination are the same") + return 0, err + } + + if greLink.TunnelType == interfaces.GreLink_ERSPAN && greLink.SessionId > 1023 { + err := errors.New("set session id for ERSPAN tunnel type") + return 0, err + } + req := &gre.GreAddDelTunnel{ + IsAdd: isAdd, + TunnelType: uint8(greLink.TunnelType - 1), + Instance: ^uint32(0), + OuterFibID: greLink.OuterFibId, + SessionID: uint16(greLink.SessionId), + } + + var isSrcIPv6, isDstIPv6 bool + + if greSource.To4() == nil { + isSrcIPv6 = true + } + if greDestination.To4() == nil { + isDstIPv6 = true + } + if isSrcIPv6 != isDstIPv6 { + return 0, errors.New("source and destination addresses must be both either in IPv4 or IPv6") + } + + if isSrcIPv6 { + req.SrcAddress = []byte(greSource.To16()) + req.DstAddress = []byte(greDestination.To16()) + req.IsIPv6 = 1 + } else { + req.SrcAddress = []byte(greSource.To4()) + req.DstAddress = []byte(greDestination.To4()) + } + + reply := &gre.GreAddDelTunnelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + return reply.SwIfIndex, nil +} + +// AddGreTunnel adds new GRE interface. +func (h *InterfaceVppHandler) AddGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(1, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.SetInterfaceTag(ifName, swIfIndex) +} + +// DelGreTunnel removes GRE interface. +func (h *InterfaceVppHandler) DelGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(0, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.RemoveInterfaceTag(ifName, swIfIndex) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go index 896d1dd1c1..c64bef77c3 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go @@ -25,6 +25,7 @@ import ( vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/bond" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/gre" binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/interfaces" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/ip" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/ipsec" @@ -244,6 +245,11 @@ func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDe return nil, err } + err = h.dumpGreDetails(ifs) + if err != nil { + return nil, err + } + // Rx-placement dump is last since it uses interface type-specific data err = h.dumpRxPlacement(ifs) if err != nil { @@ -820,6 +826,41 @@ func (h *InterfaceVppHandler) dumpBondDetails(ifs map[uint32]*vppcalls.Interface return nil } +func (h *InterfaceVppHandler) dumpGreDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + reqCtx := h.callsChannel.SendMultiRequest(&gre.GreTunnelDump{SwIfIndex: ^uint32(0)}) + for { + greDetails := &gre.GreTunnelDetails{} + stop, err := reqCtx.ReceiveReply(greDetails) + if stop { + break + } + if err != nil { + return fmt.Errorf("failed to dump span: %v", err) + } + + var srcAddr, dstAddr net.IP + if greDetails.IsIPv6 == 1 { + srcAddr = net.IP(greDetails.SrcAddress) + dstAddr = net.IP(greDetails.DstAddress) + } else { + srcAddr = net.IP(greDetails.SrcAddress[:4]) + dstAddr = net.IP(greDetails.DstAddress[:4]) + } + + ifs[greDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Gre{ + Gre: &interfaces.GreLink{ + TunnelType: getGreTunnelType(greDetails.TunnelType), + SrcAddr: srcAddr.String(), + DstAddr: dstAddr.String(), + OuterFibId: greDetails.OuterFibID, + SessionId: uint32(greDetails.SessionID), + }, + } + ifs[greDetails.SwIfIndex].Interface.Type = interfaces.Interface_GRE_TUNNEL + } + return nil +} + // dumpUnnumberedDetails returns a map of unnumbered interface indexes, every with interface index of element with IP func (h *InterfaceVppHandler) dumpUnnumberedDetails() (map[uint32]uint32, error) { unIfMap := make(map[uint32]uint32) // unnumbered/ip-interface @@ -913,6 +954,9 @@ func guessInterfaceType(ifName string) interfaces.Interface_Type { case strings.HasPrefix(ifName, "Bond"): return interfaces.Interface_BOND_INTERFACE + case strings.HasPrefix(ifName, "gre"): + return interfaces.Interface_GRE_TUNNEL + default: return interfaces.Interface_DPDK } @@ -1000,6 +1044,19 @@ func getTagRwOption(op uint32) interfaces.SubInterface_TagRewriteOptions { } } +func getGreTunnelType(tt uint8) interfaces.GreLink_Type { + switch tt { + case 0: + return interfaces.GreLink_L3 + case 1: + return interfaces.GreLink_TEB + case 2: + return interfaces.GreLink_ERSPAN + default: + return interfaces.GreLink_UNKNOWN + } +} + func uintToBool(value uint8) bool { if value == 0 { return false diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/gre_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/gre_vppcalls.go new file mode 100644 index 0000000000..31ae680634 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/gre_vppcalls.go @@ -0,0 +1,90 @@ +package vpp1904 + +import ( + "errors" + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/gre" +) + +func (h *InterfaceVppHandler) greAddDelTunnel(isAdd uint8, greLink *interfaces.GreLink) (uint32, error) { + if greLink.TunnelType == interfaces.GreLink_UNKNOWN { + err := errors.New("bad GRE tunnel type") + return 0, err + } + + greSource := net.ParseIP(greLink.SrcAddr) + if greSource == nil { + err := errors.New("bad source address for GRE tunnel") + return 0, err + } + greDestination := net.ParseIP(greLink.DstAddr) + if greDestination == nil { + err := errors.New("bad destination address for GRE tunnel") + return 0, err + } + + if greLink.SrcAddr == greLink.DstAddr { + err := errors.New("source and destination are the same") + return 0, err + } + + if greLink.TunnelType == interfaces.GreLink_ERSPAN && greLink.SessionId > 1023 { + err := errors.New("set session id for ERSPAN tunnel type") + return 0, err + } + req := &gre.GreAddDelTunnel{ + IsAdd: isAdd, + TunnelType: uint8(greLink.TunnelType - 1), + Instance: ^uint32(0), + OuterFibID: greLink.OuterFibId, + SessionID: uint16(greLink.SessionId), + } + + var isSrcIPv6, isDstIPv6 bool + + if greSource.To4() == nil { + isSrcIPv6 = true + } + if greDestination.To4() == nil { + isDstIPv6 = true + } + if isSrcIPv6 != isDstIPv6 { + return 0, errors.New("source and destination addresses must be both either in IPv4 or IPv6") + } + + if isSrcIPv6 { + req.SrcAddress = []byte(greSource.To16()) + req.DstAddress = []byte(greDestination.To16()) + req.IsIPv6 = 1 + } else { + req.SrcAddress = []byte(greSource.To4()) + req.DstAddress = []byte(greDestination.To4()) + } + + reply := &gre.GreAddDelTunnelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + return reply.SwIfIndex, nil +} + +// AddGreTunnel adds new GRE interface. +func (h *InterfaceVppHandler) AddGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(1, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.SetInterfaceTag(ifName, swIfIndex) +} + +// DelGreTunnel removes GRE interface. +func (h *InterfaceVppHandler) DelGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(0, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.RemoveInterfaceTag(ifName, swIfIndex) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go index 123dca2402..03450ee938 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go @@ -25,6 +25,7 @@ import ( vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/bond" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/gre" binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" @@ -256,6 +257,11 @@ func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDe return nil, err } + err = h.dumpGreDetails(ifs) + if err != nil { + return nil, err + } + // Rx-placement dump is last since it uses interface type-specific data err = h.dumpRxPlacement(ifs) if err != nil { @@ -830,6 +836,53 @@ func (h *InterfaceVppHandler) dumpBondDetails(ifs map[uint32]*vppcalls.Interface return nil } +func (h *InterfaceVppHandler) dumpGreDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + msg := &gre.GreTunnelDump{SwIfIndex: gre.InterfaceIndex(^uint32(0))} + reqCtx := h.callsChannel.SendMultiRequest(msg) + for { + greDetails := &gre.GreTunnelDetails{} + stop, err := reqCtx.ReceiveReply(greDetails) + if stop { + break + } + if err != nil { + return fmt.Errorf("failed to dump span: %v", err) + } + + tunnel := greDetails.Tunnel + swIfIndex := uint32(tunnel.SwIfIndex) + + var srcAddr, dstAddr net.IP + + if tunnel.Src.Af == gre.ADDRESS_IP4 { + srcAddrArr := tunnel.Src.Un.GetIP4() + srcAddr = net.IP(srcAddrArr[:]) + } else { + srcAddrArr := tunnel.Src.Un.GetIP6() + srcAddr = net.IP(srcAddrArr[:]) + } + if tunnel.Dst.Af == gre.ADDRESS_IP4 { + dstAddrArr := tunnel.Dst.Un.GetIP4() + dstAddr = net.IP(dstAddrArr[:]) + } else { + dstAddrArr := tunnel.Dst.Un.GetIP6() + dstAddr = net.IP(dstAddrArr[:]) + } + + ifs[swIfIndex].Interface.Link = &interfaces.Interface_Gre{ + Gre: &interfaces.GreLink{ + TunnelType: getGreTunnelType(tunnel.Type), + SrcAddr: srcAddr.String(), + DstAddr: dstAddr.String(), + OuterFibId: tunnel.OuterFibID, + SessionId: uint32(tunnel.SessionID), + }, + } + ifs[swIfIndex].Interface.Type = interfaces.Interface_GRE_TUNNEL + } + return nil +} + // dumpUnnumberedDetails returns a map of unnumbered interface indexes, every with interface index of element with IP func (h *InterfaceVppHandler) dumpUnnumberedDetails() (map[uint32]uint32, error) { unIfMap := make(map[uint32]uint32) // unnumbered/ip-interface @@ -923,6 +976,9 @@ func guessInterfaceType(ifName string) interfaces.Interface_Type { case strings.HasPrefix(ifName, "Bond"): return interfaces.Interface_BOND_INTERFACE + case strings.HasPrefix(ifName, "gre"): + return interfaces.Interface_GRE_TUNNEL + default: return interfaces.Interface_DPDK } @@ -1010,6 +1066,19 @@ func getTagRwOption(op uint32) interfaces.SubInterface_TagRewriteOptions { } } +func getGreTunnelType(tt gre.GreTunnelType) interfaces.GreLink_Type { + switch tt { + case gre.GRE_API_TUNNEL_TYPE_L3: + return interfaces.GreLink_L3 + case gre.GRE_API_TUNNEL_TYPE_TEB: + return interfaces.GreLink_TEB + case gre.GRE_API_TUNNEL_TYPE_ERSPAN: + return interfaces.GreLink_ERSPAN + default: + return interfaces.GreLink_UNKNOWN + } +} + func uintToBool(value uint8) bool { if value == 0 { return false diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/gre_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/gre_vppcalls.go new file mode 100644 index 0000000000..8858e59b97 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/gre_vppcalls.go @@ -0,0 +1,123 @@ +package vpp1908 + +import ( + "errors" + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/gre" +) + +func (h *InterfaceVppHandler) greAddDelTunnel(isAdd bool, greLink *interfaces.GreLink) (uint32, error) { + if greLink.TunnelType == interfaces.GreLink_UNKNOWN { + err := errors.New("bad GRE tunnel type") + return 0, err + } + + greSource := net.ParseIP(greLink.SrcAddr) + if greSource == nil { + err := errors.New("bad source address for GRE tunnel") + return 0, err + } + greDestination := net.ParseIP(greLink.DstAddr) + if greDestination == nil { + err := errors.New("bad destination address for GRE tunnel") + return 0, err + } + + if greLink.SrcAddr == greLink.DstAddr { + err := errors.New("source and destination are the same") + return 0, err + } + + if greLink.TunnelType == interfaces.GreLink_ERSPAN && greLink.SessionId > 1023 { + err := errors.New("set session id for ERSPAN tunnel type") + return 0, err + } + + var tt gre.GreTunnelType + switch uint8(greLink.TunnelType - 1) { + case 0: + tt = gre.GRE_API_TUNNEL_TYPE_L3 + case 1: + tt = gre.GRE_API_TUNNEL_TYPE_TEB + case 2: + tt = gre.GRE_API_TUNNEL_TYPE_ERSPAN + default: + return 0, errors.New("bad GRE tunnel type") + } + + tunnel := gre.GreTunnel{ + Type: tt, + Instance: ^uint32(0), + OuterFibID: greLink.OuterFibId, + SessionID: uint16(greLink.SessionId), + } + + var isSrcIPv6, isDstIPv6 bool + + if greSource.To4() == nil { + isSrcIPv6 = true + } + if greDestination.To4() == nil { + isDstIPv6 = true + } + if isSrcIPv6 != isDstIPv6 { + return 0, errors.New("source and destination addresses must be both either in IPv4 or IPv6") + } + + if isSrcIPv6 { + var src, dst [16]uint8 + copy(src[:], []byte(greSource.To16())) + copy(dst[:], []byte(greDestination.To16())) + tunnel.Src = gre.Address{ + Af: gre.ADDRESS_IP6, + Un: gre.AddressUnionIP6(gre.IP6Address(src)), + } + tunnel.Dst = gre.Address{ + Af: gre.ADDRESS_IP6, + Un: gre.AddressUnionIP6(gre.IP6Address(dst)), + } + } else { + var src, dst [4]uint8 + copy(src[:], []byte(greSource.To4())) + copy(dst[:], []byte(greDestination.To4())) + tunnel.Src = gre.Address{ + Af: gre.ADDRESS_IP4, + Un: gre.AddressUnionIP4(gre.IP4Address(src)), + } + tunnel.Dst = gre.Address{ + Af: gre.ADDRESS_IP4, + Un: gre.AddressUnionIP4(gre.IP4Address(dst)), + } + } + + req := &gre.GreTunnelAddDel{ + IsAdd: isAdd, + Tunnel: tunnel, + } + reply := &gre.GreTunnelAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + return uint32(reply.SwIfIndex), nil +} + +// AddGreTunnel adds new GRE interface. +func (h *InterfaceVppHandler) AddGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(true, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.SetInterfaceTag(ifName, swIfIndex) +} + +// DelGreTunnel removes GRE interface. +func (h *InterfaceVppHandler) DelGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error) { + swIfIndex, err := h.greAddDelTunnel(false, greLink) + if err != nil { + return 0, err + } + return swIfIndex, h.RemoveInterfaceTag(ifName, swIfIndex) +} diff --git a/tests/integration/vpp/080_gre_test.go b/tests/integration/vpp/080_gre_test.go new file mode 100644 index 0000000000..141c441bb1 --- /dev/null +++ b/tests/integration/vpp/080_gre_test.go @@ -0,0 +1,165 @@ +package vpp + +import ( + "fmt" + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + ifplugin_vppcalls "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +func TestGre(t *testing.T) { + ctx := setupVPP(t) + defer ctx.teardownVPP() + + h := ifplugin_vppcalls.CompatibleInterfaceVppHandler(ctx.vppBinapi, logrus.NewLogger("test")) + + tests := []struct { + name string + greLink *interfaces.GreLink + isFail bool + }{ + { + name: "create UNKNOWN GRE tunnel with IPv4", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_UNKNOWN, + SrcAddr: "2000::8:13", + DstAddr: "2019::8:13", + }, + isFail: true, + }, + { + name: "create L3 GRE tunnel with IPv4", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_L3, + SrcAddr: "2000::8:23", + DstAddr: "2019::8:23", + }, + isFail: false, + }, + { + name: "create TEB GRE tunnel with IPv4", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_TEB, + SrcAddr: "2000::8:33", + DstAddr: "2019::8:33", + }, + isFail: false, + }, + { + name: "create ERSPAN GRE tunnel with IPv4", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "2000::8:43", + DstAddr: "2019::8:43", + }, + isFail: false, + }, + + { + name: "create ERSPAN GRE tunnel with out of range session id", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "10.10.10.10", + DstAddr: "20.20.20.20", + SessionId: 1024, + }, + isFail: true, + }, + { + name: "create GRE tunnel with bad source address", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "badip", + DstAddr: "20.20.20.20", + }, + isFail: true, + }, + { + name: "create GRE tunnel with destination address not set", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "10.10.10.10", + }, + isFail: true, + }, + + { + name: "create GRE tunnel with equal source and destination addresses", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "10.10.10.10", + DstAddr: "10.10.10.10", + }, + isFail: true, + }, + { + name: "create GRE tunnel with addresses in IPv4 and IPv6", + greLink: &interfaces.GreLink{ + TunnelType: interfaces.GreLink_ERSPAN, + SrcAddr: "10.10.10.10", + DstAddr: "2019::8:23", + }, + isFail: true, + }, + } + for i, test := range tests { + t.Run(test.name, func(t *testing.T) { + ifName := fmt.Sprintf("test%d", i) + ifIdx, err := h.AddGreTunnel(ifName, test.greLink) + + if err != nil { + if test.isFail { + return + } + t.Fatalf("create GRE tunnel failed: %v\n", err) + } else { + if test.isFail { + t.Fatal("create GRE tunnel must fail, but it's not") + } + } + + ifaces, err := h.DumpInterfaces() + if err != nil { + t.Fatalf("dumping interfaces failed: %v", err) + } + iface, ok := ifaces[ifIdx] + if !ok { + t.Fatalf("GRE interface not found in dump") + } + + gre := iface.Interface.GetGre() + + if test.greLink.TunnelType != gre.TunnelType { + t.Fatalf("expected tunnel type <%s>, got: <%s>", test.greLink.TunnelType, gre.TunnelType) + } + if test.greLink.SrcAddr != gre.SrcAddr { + t.Fatalf("expected source address <%s>, got: <%s>", test.greLink.SrcAddr, gre.SrcAddr) + } + if test.greLink.DstAddr != gre.DstAddr { + t.Fatalf("expected destination address <%s>, got: <%s>", test.greLink.DstAddr, gre.DstAddr) + } + if test.greLink.OuterFibId != gre.OuterFibId { + t.Fatalf("expected outer FIB id <%d>, got: <%d>", test.greLink.OuterFibId, gre.OuterFibId) + } + if test.greLink.SessionId != gre.SessionId { + t.Fatalf("expected session id <%d>, got: <%d>", test.greLink.SessionId, gre.SessionId) + } + + ifIdx, err = h.DelGreTunnel(ifName, test.greLink) + if err != nil { + t.Fatalf("delete GRE tunnel failed: %v\n", err) + } + + ifaces, err = h.DumpInterfaces() + if err != nil { + t.Fatalf("dumping interfaces failed: %v", err) + } + iface, ok = ifaces[ifIdx] + if ok { + t.Fatalf("GRE interface was found in dump") + } + }) + } +}