From 888c3d3c8a48500b43cf62bd8d2cd1bac1264e3a Mon Sep 17 00:00:00 2001 From: Vladimir Lavor Date: Mon, 27 May 2019 09:29:40 +0200 Subject: [PATCH] add ABF to config data model (#1356) Signed-off-by: Vladimir Lavor --- api/models/vpp/vpp.pb.go | 94 ++++++++++++++++------------- api/models/vpp/vpp.proto | 2 + api/models/vpp/vpp_types.go | 2 + cmd/agentctl/utils/db_read_utils.go | 13 ++++ plugins/configurator/dump.go | 26 ++++++++ 5 files changed, 95 insertions(+), 42 deletions(-) diff --git a/api/models/vpp/vpp.pb.go b/api/models/vpp/vpp.pb.go index 5c42aba29a..4a6649fe02 100644 --- a/api/models/vpp/vpp.pb.go +++ b/api/models/vpp/vpp.pb.go @@ -6,6 +6,7 @@ package vpp import ( fmt "fmt" proto "github.com/gogo/protobuf/proto" + abf "github.com/ligato/vpp-agent/api/models/vpp/abf" acl "github.com/ligato/vpp-agent/api/models/vpp/acl" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" @@ -30,6 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type ConfigData struct { Interfaces []*interfaces.Interface `protobuf:"bytes,10,rep,name=interfaces,proto3" json:"interfaces,omitempty"` Acls []*acl.ACL `protobuf:"bytes,20,rep,name=acls,proto3" json:"acls,omitempty"` + Abfs []*abf.ABF `protobuf:"bytes,21,rep,name=abfs,proto3" json:"abfs,omitempty"` BridgeDomains []*l2.BridgeDomain `protobuf:"bytes,30,rep,name=bridge_domains,json=bridgeDomains,proto3" json:"bridge_domains,omitempty"` Fibs []*l2.FIBEntry `protobuf:"bytes,31,rep,name=fibs,proto3" json:"fibs,omitempty"` XconnectPairs []*l2.XConnectPair `protobuf:"bytes,32,rep,name=xconnect_pairs,json=xconnectPairs,proto3" json:"xconnect_pairs,omitempty"` @@ -86,6 +88,13 @@ func (m *ConfigData) GetAcls() []*acl.ACL { return nil } +func (m *ConfigData) GetAbfs() []*abf.ABF { + if m != nil { + return m.Abfs + } + return nil +} + func (m *ConfigData) GetBridgeDomains() []*l2.BridgeDomain { if m != nil { return m.BridgeDomains @@ -223,46 +232,47 @@ func init() { func init() { proto.RegisterFile("models/vpp/vpp.proto", fileDescriptor_60d3c66428a08eaa) } var fileDescriptor_60d3c66428a08eaa = []byte{ - // 646 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x5f, 0x6b, 0xdb, 0x3c, - 0x14, 0xc6, 0x29, 0x2d, 0x7d, 0x1b, 0x35, 0xfd, 0x83, 0x28, 0x7d, 0xd5, 0x30, 0xba, 0xb4, 0xac, - 0xd0, 0x6e, 0xd4, 0x19, 0x49, 0x61, 0x8c, 0x6e, 0x74, 0x69, 0xba, 0x76, 0x81, 0x51, 0x8c, 0xd2, - 0x8b, 0xb1, 0x1b, 0x23, 0xcb, 0x8e, 0x2b, 0x70, 0x25, 0x21, 0x29, 0xa5, 0xf9, 0x34, 0xfb, 0xaa, - 0x43, 0xc7, 0x76, 0xed, 0x40, 0x76, 0x61, 0xe3, 0xa3, 0xdf, 0xf3, 0x1c, 0x4b, 0x47, 0xe7, 0xa0, - 0xbd, 0x27, 0x95, 0xa4, 0xb9, 0xed, 0x3d, 0x6b, 0xed, 0x9f, 0x40, 0x1b, 0xe5, 0x14, 0x5e, 0x7d, - 0xd6, 0xba, 0x43, 0x1a, 0x88, 0xf1, 0xdc, 0x3f, 0x05, 0xee, 0x9c, 0x34, 0x88, 0x90, 0x2e, 0x35, - 0x53, 0xc6, 0x53, 0x5b, 0x7f, 0x96, 0xb2, 0xa3, 0xe5, 0x32, 0xeb, 0x98, 0xab, 0x24, 0x6f, 0x9a, - 0x12, 0x6d, 0x53, 0x5e, 0xbc, 0x97, 0x24, 0xc8, 0xfb, 0xbd, 0xd8, 0x88, 0x24, 0x4b, 0xcf, 0x13, - 0xf5, 0xc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c, 0x82, 0x69, 0xab, 0x30, 0x0d, 0x02, 0xea, - 0x57, 0x69, 0x09, 0xfd, 0x4e, 0x98, 0xd1, 0x96, 0x9c, 0x35, 0x77, 0x32, 0x08, 0x86, 0x34, 0x2c, - 0x77, 0xe2, 0x29, 0x3e, 0x47, 0x2d, 0x6d, 0xd4, 0xcb, 0x3c, 0x62, 0x46, 0x93, 0xf7, 0xdd, 0x95, - 0xa6, 0x34, 0xf4, 0x60, 0x48, 0x43, 0xba, 0x01, 0x92, 0xa1, 0xd1, 0xf8, 0x0a, 0xed, 0x08, 0x6d, - 0x39, 0x93, 0x91, 0x4c, 0x45, 0xf6, 0x18, 0x2b, 0x43, 0x3e, 0x80, 0x69, 0xbf, 0x32, 0x8d, 0xc3, - 0x09, 0x67, 0xf2, 0xbe, 0xa4, 0x74, 0xbb, 0x90, 0x57, 0x31, 0xfe, 0x84, 0xda, 0x92, 0xb9, 0x8b, - 0x8b, 0x28, 0xcb, 0x55, 0xcc, 0x72, 0xd2, 0x07, 0x77, 0x71, 0x6e, 0xdf, 0x0a, 0xf7, 0x1e, 0xde, - 0x01, 0xa3, 0x9b, 0xb2, 0x0e, 0xf0, 0x19, 0xfa, 0x2f, 0x81, 0xd8, 0x92, 0x01, 0x9c, 0x68, 0xe7, - 0xd5, 0x73, 0x03, 0x26, 0x5a, 0x71, 0xfc, 0x0d, 0x21, 0x98, 0x8b, 0xc8, 0xea, 0xc4, 0x92, 0x2f, - 0xa0, 0x3e, 0x2a, 0xba, 0x03, 0xc6, 0x65, 0x92, 0xf2, 0x99, 0x11, 0x6e, 0x1e, 0xaa, 0x5c, 0xf0, - 0xb9, 0x6f, 0xa8, 0x98, 0xd9, 0x94, 0xb6, 0x80, 0x4e, 0x74, 0xe2, 0xef, 0xa7, 0x55, 0x66, 0x60, - 0x96, 0x7c, 0x85, 0x04, 0x87, 0x4b, 0x12, 0x0c, 0xad, 0x55, 0x5c, 0x30, 0x27, 0x94, 0xa4, 0x1b, - 0x85, 0x9b, 0x59, 0x7c, 0x85, 0x76, 0x7d, 0xe7, 0x46, 0x42, 0x9b, 0x34, 0x11, 0x26, 0xe5, 0xce, - 0x92, 0xdb, 0xc6, 0xf5, 0x42, 0x5b, 0x8f, 0x43, 0x5a, 0x42, 0xba, 0xe3, 0x17, 0xc6, 0xb5, 0x18, - 0x0f, 0x50, 0x1b, 0x12, 0x38, 0xf5, 0xa8, 0xac, 0xb3, 0xe4, 0xae, 0x71, 0x83, 0x60, 0x7e, 0x50, - 0x3f, 0x94, 0x75, 0x74, 0xd3, 0x07, 0x0f, 0x85, 0xe8, 0x78, 0x82, 0xda, 0xf7, 0xca, 0x89, 0xa9, - 0xe0, 0xb0, 0x1f, 0x3c, 0x42, 0xad, 0xd7, 0xae, 0x27, 0x2b, 0x50, 0xe5, 0x93, 0x7f, 0x4e, 0x48, - 0xd3, 0x49, 0x6b, 0xdf, 0xf5, 0xc7, 0xdf, 0x41, 0x26, 0xdc, 0xe3, 0x2c, 0x0e, 0xb8, 0x7a, 0xea, - 0xe5, 0x22, 0x63, 0x4e, 0xf9, 0xf9, 0x3c, 0x67, 0x59, 0x2a, 0x5d, 0x8f, 0x69, 0xd1, 0xab, 0x87, - 0xf6, 0xf2, 0x59, 0xeb, 0x78, 0x1d, 0xe6, 0x75, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x73, - 0xb3, 0xef, 0x2a, 0x05, 0x00, 0x00, + // 666 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x6d, 0x4b, 0x1c, 0x3b, + 0x14, 0xc7, 0x11, 0xc5, 0xeb, 0xc6, 0xf5, 0x81, 0xe0, 0xf5, 0x46, 0xb9, 0xd8, 0x55, 0x2a, 0x68, + 0x8b, 0xb3, 0x65, 0x57, 0x28, 0xc5, 0x16, 0xbb, 0xbb, 0x56, 0xbb, 0x50, 0x64, 0xc9, 0xfa, 0xa2, + 0xf4, 0xcd, 0x90, 0xc9, 0x3c, 0x18, 0x18, 0x93, 0x90, 0x64, 0xc5, 0xfd, 0x78, 0xfd, 0x66, 0x25, + 0x67, 0x66, 0x9c, 0x59, 0xd8, 0xbe, 0xc8, 0x30, 0x27, 0xbf, 0xff, 0xff, 0x4c, 0xe6, 0x9c, 0x1c, + 0xb4, 0xf7, 0xa4, 0xe2, 0x24, 0xb7, 0xdd, 0x67, 0xad, 0xfd, 0x0a, 0xb4, 0x51, 0x4e, 0xe1, 0xd5, + 0x67, 0xad, 0x0f, 0x49, 0x03, 0xb1, 0x28, 0xf5, 0xab, 0xc0, 0x8b, 0x84, 0xe7, 0x7e, 0x95, 0xe4, + 0xb4, 0x41, 0x84, 0x74, 0x89, 0x49, 0x19, 0x4f, 0x6c, 0xfd, 0x5a, 0xca, 0x8e, 0x97, 0xcb, 0xac, + 0x63, 0xae, 0x92, 0xfc, 0xdf, 0x94, 0x68, 0x9b, 0xf0, 0xe2, 0xb9, 0x24, 0x41, 0xde, 0xeb, 0x46, + 0x46, 0xc4, 0x59, 0x72, 0x11, 0xab, 0x27, 0x26, 0x64, 0x29, 0xf9, 0x6f, 0x51, 0x92, 0x8a, 0x68, + 0x49, 0xe6, 0xbc, 0xd7, 0x7d, 0xe1, 0x4a, 0xca, 0x84, 0xbb, 0x65, 0xb6, 0x7e, 0x97, 0x99, 0xb2, + 0x26, 0x87, 0xfb, 0x8b, 0x20, 0xef, 0x97, 0xfb, 0x07, 0x8b, 0xfb, 0x46, 0xcd, 0x5e, 0xff, 0xa1, + 0x59, 0x27, 0xc9, 0x9c, 0x5f, 0x25, 0x39, 0x6c, 0x10, 0x3d, 0x93, 0x0e, 0x1e, 0x05, 0x3b, 0xf9, + 0xbd, 0x8e, 0xd0, 0x48, 0xc9, 0x54, 0x64, 0x37, 0xcc, 0x31, 0xfc, 0x09, 0xa1, 0xba, 0x44, 0x04, + 0x75, 0x56, 0xcf, 0x36, 0x7b, 0x07, 0x81, 0xef, 0x55, 0xbd, 0x1d, 0x8c, 0xab, 0x57, 0xda, 0x10, + 0xe3, 0x0e, 0x5a, 0x63, 0x3c, 0xb7, 0x64, 0x0f, 0x4c, 0x6d, 0x30, 0xf9, 0x5e, 0x0d, 0x46, 0x3f, + 0x28, 0x10, 0x50, 0x44, 0xa9, 0x25, 0xff, 0x36, 0x15, 0x51, 0x1a, 0x0c, 0x86, 0xb7, 0x14, 0x08, + 0xbe, 0x42, 0xdb, 0x45, 0x75, 0xc3, 0xa2, 0xba, 0x96, 0x1c, 0x81, 0x76, 0x0f, 0xb4, 0x79, 0x2f, + 0x18, 0x02, 0xbd, 0x01, 0x48, 0xb7, 0xa2, 0x46, 0x64, 0xf1, 0x5b, 0xb4, 0x96, 0x8a, 0xc8, 0x92, + 0x37, 0x60, 0xd9, 0xad, 0x2c, 0xb7, 0xe3, 0xe1, 0x37, 0xe9, 0xcc, 0x9c, 0x02, 0xf5, 0x9f, 0xa8, + 0x9a, 0x10, 0x6a, 0x26, 0x8c, 0x25, 0x9d, 0xc5, 0x4f, 0xfc, 0x1c, 0x15, 0x74, 0xc2, 0x84, 0xa1, + 0x5b, 0x95, 0xd6, 0x47, 0x16, 0x9f, 0xa2, 0x75, 0x28, 0xb9, 0x25, 0x67, 0x60, 0xda, 0x2a, 0x4c, + 0xfd, 0x80, 0xfa, 0x5d, 0x5a, 0x42, 0x7f, 0x12, 0x66, 0xb4, 0x25, 0xe7, 0xcd, 0x93, 0xf4, 0x83, + 0x01, 0x9d, 0x94, 0x27, 0xf1, 0x14, 0x5f, 0xa0, 0x96, 0x36, 0xea, 0x65, 0x1e, 0x32, 0xa3, 0xc9, + 0xbb, 0xce, 0x4a, 0x53, 0x3a, 0xf1, 0x60, 0x40, 0x27, 0x74, 0x03, 0x24, 0x03, 0xa3, 0xf1, 0x35, + 0xda, 0x11, 0xda, 0x72, 0x26, 0x43, 0x99, 0x88, 0xec, 0x31, 0x52, 0x86, 0xbc, 0x07, 0xd3, 0x7e, + 0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x0f, 0x1e, 0xa1, 0xd6, 0xeb, 0x5c, 0x90, 0x15, 0xa8, 0xf2, + 0xe9, 0x5f, 0x67, 0xa8, 0xe9, 0xa4, 0xb5, 0x6f, 0xf8, 0xe1, 0x57, 0x90, 0x09, 0xf7, 0x38, 0x8b, + 0x02, 0xae, 0x9e, 0xba, 0xb9, 0xc8, 0x98, 0x53, 0x7e, 0x82, 0x2f, 0x58, 0x96, 0x48, 0xd7, 0x65, + 0x5a, 0x74, 0xeb, 0xb1, 0xbe, 0x7a, 0xd6, 0x3a, 0x5a, 0x87, 0x89, 0xee, 0xff, 0x09, 0x00, 0x00, + 0xff, 0xff, 0xe2, 0x4d, 0x26, 0xe0, 0x66, 0x05, 0x00, 0x00, } diff --git a/api/models/vpp/vpp.proto b/api/models/vpp/vpp.proto index 22674703fc..7976ba5bba 100644 --- a/api/models/vpp/vpp.proto +++ b/api/models/vpp/vpp.proto @@ -4,6 +4,7 @@ package vpp; option go_package = "github.com/ligato/vpp-agent/api/models/vpp;vpp"; +import "models/vpp/abf/abf.proto"; import "models/vpp/acl/acl.proto"; import "models/vpp/interfaces/interface.proto"; import "models/vpp/interfaces/state.proto"; @@ -21,6 +22,7 @@ message ConfigData { repeated interfaces.Interface interfaces = 10; repeated acl.ACL acls = 20; + repeated abf.ABF abfs = 21; repeated l2.BridgeDomain bridge_domains = 30; repeated l2.FIBEntry fibs = 31; diff --git a/api/models/vpp/vpp_types.go b/api/models/vpp/vpp_types.go index 87915a743b..8795dd54f5 100644 --- a/api/models/vpp/vpp_types.go +++ b/api/models/vpp/vpp_types.go @@ -15,6 +15,7 @@ package vpp import ( + "github.com/ligato/vpp-agent/api/models/vpp/abf" "github.com/ligato/vpp-agent/api/models/vpp/acl" "github.com/ligato/vpp-agent/api/models/vpp/interfaces" "github.com/ligato/vpp-agent/api/models/vpp/ipsec" @@ -28,6 +29,7 @@ import ( type ( // ACL ACL = vpp_acl.ACL + ABF = vpp_abf.ABF // Interfaces Interface = vpp_interfaces.Interface diff --git a/cmd/agentctl/utils/db_read_utils.go b/cmd/agentctl/utils/db_read_utils.go index 4f4203835c..60836a460e 100644 --- a/cmd/agentctl/utils/db_read_utils.go +++ b/cmd/agentctl/utils/db_read_utils.go @@ -17,6 +17,7 @@ import ( "github.com/gogo/protobuf/proto" "github.com/ligato/cn-infra/db/keyval" + abf "github.com/ligato/vpp-agent/api/models/vpp/abf" acl "github.com/ligato/vpp-agent/api/models/vpp/acl" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" @@ -102,6 +103,8 @@ func (ed EtcdDump) ReadDataFromDb(db keyval.ProtoBroker, key string, switch { case strings.HasPrefix(key, acl.ModelACL.KeyPrefix()): ed[agent], err = readACLConfigFromDb(db, vd, key) + case strings.HasPrefix(key, abf.ModelABF.KeyPrefix()): + ed[agent], err = readABFConfigFromDb(db, vd, key) case strings.HasPrefix(key, interfaces.ModelInterface.KeyPrefix()): ed[agent], err = readInterfaceConfigFromDb(db, vd, key) case strings.HasPrefix(key, l2.ModelBridgeDomain.KeyPrefix()): @@ -165,6 +168,16 @@ func readACLConfigFromDb(db keyval.ProtoBroker, vd *VppData, key string) (*VppDa return vd, err } +func readABFConfigFromDb(db keyval.ProtoBroker, vd *VppData, key string) (*VppData, error) { + abf := &abf.ABF{} + + found, _, err := readDataFromDb(db, key, abf) + if found && err == nil { + vd.Config.VppConfig.Abfs = append(vd.Config.VppConfig.Abfs, abf) + } + return vd, err +} + func readInterfaceConfigFromDb(db keyval.ProtoBroker, vd *VppData, key string) (*VppData, error) { int := &interfaces.Interface{} diff --git a/plugins/configurator/dump.go b/plugins/configurator/dump.go index 380aaf3454..15ce77faf6 100644 --- a/plugins/configurator/dump.go +++ b/plugins/configurator/dump.go @@ -6,6 +6,7 @@ import ( "golang.org/x/net/context" rpc "github.com/ligato/vpp-agent/api/configurator" + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" vpp_acl "github.com/ligato/vpp-agent/api/models/vpp/acl" vpp_interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" @@ -14,6 +15,7 @@ import ( vpp_punt "github.com/ligato/vpp-agent/api/models/vpp/punt" iflinuxcalls "github.com/ligato/vpp-agent/plugins/linux/ifplugin/linuxcalls" l3linuxcalls "github.com/ligato/vpp-agent/plugins/linux/l3plugin/linuxcalls" + abfvppcalls "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" aclvppcalls "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" ifvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" ipsecvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" @@ -28,6 +30,7 @@ type dumpService struct { // VPP Handlers aclHandler aclvppcalls.ACLVppRead + abfHandler abfvppcalls.ABFVppRead ifHandler ifvppcalls.InterfaceVppRead natHandler natvppcalls.NatVppRead l2Handler l2vppcalls.L2VppAPI @@ -58,6 +61,11 @@ func (svc *dumpService) Dump(context.Context, *rpc.DumpRequest) (*rpc.DumpRespon svc.log.Errorf("DumpAcls failed: %v", err) return nil, err } + dump.VppConfig.Abfs, err = svc.DumpAbfs() + if err != nil { + svc.log.Errorf("DumpAbfs failed: %v", err) + return nil, err + } dump.VppConfig.IpsecSpds, err = svc.DumpIPSecSPDs() if err != nil { svc.log.Errorf("DumpIPSecSPDs failed: %v", err) @@ -130,6 +138,24 @@ func (svc *dumpService) DumpAcls() ([]*vpp_acl.ACL, error) { return acls, nil } +// DumpAbfs reads the ACL-based forwarding and returns data read as an *AbfResponse. If the reading ends up with +// an error, only the error is send back in the response +func (svc *dumpService) DumpAbfs() ([]*vpp_abf.ABF, error) { + var abfs []*vpp_abf.ABF + if svc.abfHandler == nil { + return nil, errors.New("abfHandler is not available") + } + abfPolicy, err := svc.abfHandler.DumpABFPolicy() + if err != nil { + return nil, err + } + for _, abfDetails := range abfPolicy { + abfs = append(abfs, abfDetails.ABF) + } + + return abfs, nil +} + // DumpInterfaces reads interfaces and returns them as an *InterfaceResponse. If reading ends up with error, // only error is send back in response func (svc *dumpService) DumpInterfaces() ([]*vpp_interfaces.Interface, error) {