Skip to content

Commit 8a416f4

Browse files
authored
Release 2.5.0 (#1574)
Release 2.5.0
2 parents d0a642b + b76cbed commit 8a416f4

30 files changed

+1161
-596
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## Release Notes
66

7+
- [v2.5.0](#v2.5.0)
78
- [v2.4.0](#v2.4.0)
89
- [v2.3.0](#v2.3.0)
910
- [v2.2.0](#v2.2.0)
@@ -47,6 +48,21 @@ RELEASE CHANGELOG TEMPLATE:
4748
### Documentation
4849
-->
4950

51+
<a name="v2.5.0"></a>
52+
# [2.5.0](https://github.com/ligato/vpp-agent/compare/v2.4.0...v2.5.0) (2019-11-29)
53+
- **VPP 20.01-379** (`20.01-rc0~379-ga6b93eac5`)
54+
- **VPP 20.01-324** (`20.01-rc0~324-g66a332cf1`)
55+
- **VPP 19.08.1** (default)
56+
- **VPP 19.04** (backward compatible)
57+
- cn-infra v2.2
58+
59+
### New Features
60+
* SRv6 global config (encap source address)
61+
* Support for Linux configuration dumping
62+
63+
### Bug Fixes
64+
* Update GoVPP with fix for stats conversion panic
65+
5066
<a name="v2.4.0"></a>
5167
# [2.4.0](https://github.com/ligato/vpp-agent/compare/v2.3.0...v2.4.0) (2019-10-21)
5268
- **VPP 20.01-379** (`20.01-rc0~379-ga6b93eac5`)

plugins/configurator/dump.go

+57-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
// Copyright (c) 2019 Cisco and/or its affiliates.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at:
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package configurator
216

317
import (
418
"errors"
519

20+
linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces"
21+
linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3"
22+
623
"github.com/ligato/cn-infra/logging"
724
"golang.org/x/net/context"
825

@@ -132,8 +149,23 @@ func (svc *dumpService) Dump(context.Context, *rpc.DumpRequest) (*rpc.DumpRespon
132149
return nil, err
133150
}
134151

135-
// FIXME: linux interfaces should return known proto instead of netlink
136-
// state.LinuxData.Interfaces, _ = svc.DumpLinuxInterfaces()
152+
dump.LinuxConfig.Interfaces, err = svc.DumpLinuxInterfaces()
153+
if err != nil {
154+
svc.log.Errorf("DumpLinuxInterfaces failed: %v", err)
155+
return nil, err
156+
}
157+
158+
dump.LinuxConfig.ArpEntries, err = svc.DumpLinuxARPs()
159+
if err != nil {
160+
svc.log.Errorf("DumpLinuxARPs failed: %v", err)
161+
return nil, err
162+
}
163+
164+
dump.LinuxConfig.Routes, err = svc.DumpLinuxRoutes()
165+
if err != nil {
166+
svc.log.Errorf("DumpLinuxRoutes failed: %v", err)
167+
return nil, err
168+
}
137169

138170
return &rpc.DumpResponse{Dump: dump}, nil
139171
}
@@ -388,38 +420,47 @@ func (svc *dumpService) DumpPuntExceptions() (punts []*vpp_punt.Exception, err e
388420

389421
// DumpLinuxInterfaces reads linux interfaces and returns them as an *LinuxInterfaceResponse. If reading ends up with error,
390422
// only error is send back in response
391-
/*func (svc *dumpService) DumpLinuxInterfaces() ([]*linux_interfaces.Interface, error) {
392-
var linuxIfs []*linux_interfaces.Interface
393-
ifDetails, err := svc.linuxIfHandler.GetLinkList()
423+
func (svc *dumpService) DumpLinuxInterfaces() (linuxIfs []*linux_interfaces.Interface, err error) {
424+
if svc.linuxIfHandler == nil {
425+
return nil, errors.New("linuxIfHandler is not available")
426+
}
427+
428+
ifDetails, err := svc.linuxIfHandler.DumpInterfaces()
394429
if err != nil {
395430
return nil, err
396431
}
397-
for _, iface := range ifDetails {
398-
linuxIfs = append(linuxIfs, )
432+
for _, ifDetail := range ifDetails {
433+
linuxIfs = append(linuxIfs, ifDetail.Interface)
399434
}
400435

401436
return linuxIfs, nil
402437
}
403438

404439
// DumpLinuxARPs reads linux ARPs and returns them as an *LinuxARPsResponse. If reading ends up with error,
405440
// only error is send back in response
406-
func (svc *dumpService) DumpLinuxARPs(ctx context.Context, request *rpc.DumpRequest) (*rpc.LinuxARPsResponse, error) {
407-
var linuxArps []*linuxL3.LinuxStaticArpEntries_ArpEntry
408-
arpDetails, err := svc.linuxL3Handler.DumpArpEntries()
441+
func (svc *dumpService) DumpLinuxARPs() (linuxARPs []*linux_l3.ARPEntry, err error) {
442+
if svc.linuxL3Handler == nil {
443+
return nil, errors.New("linuxL3Handler is not available")
444+
}
445+
446+
arpDetails, err := svc.linuxL3Handler.DumpARPEntries()
409447
if err != nil {
410448
return nil, err
411449
}
412-
for _, arp := range arpDetails {
413-
linuxArps = append(linuxArps, arp.Arp)
450+
for _, arpDetail := range arpDetails {
451+
linuxARPs = append(linuxARPs, arpDetail.ARP)
414452
}
415453

416-
return &rpc.LinuxARPsResponse{LinuxArpEntries: linuxArps}, nil
454+
return linuxARPs, nil
417455
}
418456

419457
// DumpLinuxRoutes reads linux routes and returns them as an *LinuxRoutesResponse. If reading ends up with error,
420458
// only error is send back in response
421-
func (svc *dumpService) DumpLinuxRoutes(ctx context.Context, request *rpc.DumpRequest) (*rpc.LinuxRoutesResponse, error) {
422-
var linuxRoutes []*linuxL3.LinuxStaticRoutes_Route
459+
func (svc *dumpService) DumpLinuxRoutes() (linuxRoutes []*linux_l3.Route, err error) {
460+
if svc.linuxL3Handler == nil {
461+
return nil, errors.New("linuxL3Handler is not available")
462+
}
463+
423464
rtDetails, err := svc.linuxL3Handler.DumpRoutes()
424465
if err != nil {
425466
return nil, err
@@ -428,6 +469,5 @@ func (svc *dumpService) DumpLinuxRoutes(ctx context.Context, request *rpc.DumpRe
428469
linuxRoutes = append(linuxRoutes, rt.Route)
429470
}
430471

431-
return &rpc.LinuxRoutesResponse{LinuxRoutes: linuxRoutes}, nil
472+
return linuxRoutes, nil
432473
}
433-
*/

plugins/configurator/options.go

+7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ package configurator
1616

1717
import (
1818
"github.com/ligato/cn-infra/rpc/grpc"
19+
"github.com/ligato/cn-infra/servicelabel"
20+
1921
"github.com/ligato/vpp-agent/plugins/govppmux"
22+
linuxifplugin "github.com/ligato/vpp-agent/plugins/linux/ifplugin"
23+
"github.com/ligato/vpp-agent/plugins/linux/nsplugin"
2024
"github.com/ligato/vpp-agent/plugins/netalloc"
2125
"github.com/ligato/vpp-agent/plugins/orchestrator"
2226
"github.com/ligato/vpp-agent/plugins/vpp/aclplugin"
@@ -36,11 +40,14 @@ func NewPlugin(opts ...Option) *Plugin {
3640
p.GRPCServer = &grpc.DefaultPlugin
3741
p.Dispatch = &orchestrator.DefaultPlugin
3842
p.GoVppmux = &govppmux.DefaultPlugin
43+
p.ServiceLabel = &servicelabel.DefaultPlugin
3944
p.AddrAlloc = &netalloc.DefaultPlugin
4045
p.VPPACLPlugin = &aclplugin.DefaultPlugin
4146
p.VPPIfPlugin = &ifplugin.DefaultPlugin
4247
p.VPPL2Plugin = &l2plugin.DefaultPlugin
4348
p.VPPL3Plugin = &l3plugin.DefaultPlugin
49+
p.LinuxIfPlugin = &linuxifplugin.DefaultPlugin
50+
p.NsPlugin = &nsplugin.DefaultPlugin
4451

4552
for _, o := range opts {
4653
o(p)

plugins/configurator/plugin.go

+33-18
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ import (
1919

2020
"github.com/ligato/cn-infra/infra"
2121
"github.com/ligato/cn-infra/rpc/grpc"
22+
"github.com/ligato/cn-infra/servicelabel"
2223
"github.com/ligato/cn-infra/utils/safeclose"
2324

2425
rpc "github.com/ligato/vpp-agent/api/configurator"
2526
"github.com/ligato/vpp-agent/api/models/vpp"
2627
"github.com/ligato/vpp-agent/plugins/govppmux"
28+
iflinuxplugin "github.com/ligato/vpp-agent/plugins/linux/ifplugin"
2729
iflinuxcalls "github.com/ligato/vpp-agent/plugins/linux/ifplugin/linuxcalls"
2830
l3linuxcalls "github.com/ligato/vpp-agent/plugins/linux/l3plugin/linuxcalls"
31+
"github.com/ligato/vpp-agent/plugins/linux/nsplugin"
2932
"github.com/ligato/vpp-agent/plugins/netalloc"
3033
"github.com/ligato/vpp-agent/plugins/orchestrator"
3134
abfvppcalls "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls"
@@ -42,6 +45,9 @@ import (
4245
puntvppcalls "github.com/ligato/vpp-agent/plugins/vpp/puntplugin/vppcalls"
4346
)
4447

48+
// Default Go routine count for linux configuration retrieval
49+
const defaultGoRoutineCount = 10
50+
4551
// Plugin registers VPP GRPC services in *grpc.Server.
4652
type Plugin struct {
4753
Deps
@@ -55,14 +61,17 @@ type Plugin struct {
5561
// Deps - dependencies of Plugin
5662
type Deps struct {
5763
infra.PluginDeps
58-
GRPCServer grpc.Server
59-
Dispatch orchestrator.Dispatcher
60-
GoVppmux govppmux.StatsAPI
61-
AddrAlloc netalloc.AddressAllocator
62-
VPPACLPlugin aclplugin.API
63-
VPPIfPlugin ifplugin.API
64-
VPPL2Plugin *l2plugin.L2Plugin
65-
VPPL3Plugin l3plugin.API
64+
GRPCServer grpc.Server
65+
Dispatch orchestrator.Dispatcher
66+
GoVppmux govppmux.StatsAPI
67+
ServiceLabel servicelabel.ReaderAPI
68+
AddrAlloc netalloc.AddressAllocator
69+
VPPACLPlugin aclplugin.API
70+
VPPIfPlugin ifplugin.API
71+
VPPL2Plugin *l2plugin.L2Plugin
72+
VPPL3Plugin l3plugin.API
73+
LinuxIfPlugin iflinuxplugin.API
74+
NsPlugin nsplugin.API
6675
}
6776

6877
// Init sets plugin child loggers
@@ -82,18 +91,20 @@ func (p *Plugin) Init() error {
8291
}
8392

8493
if p.VPPIfPlugin != nil {
85-
p.VPPIfPlugin.SetNotifyService(func(vppNotification *vpp.Notification) {
86-
p.configurator.notifyService.pushNotification(&rpc.Notification{
87-
Notification: &rpc.Notification_VppNotification{
88-
VppNotification: vppNotification,
89-
},
90-
})
91-
})
94+
p.VPPIfPlugin.SetNotifyService(p.sendVppNotification)
9295
}
9396

9497
return nil
9598
}
9699

100+
func (p *Plugin) sendVppNotification(vppNotification *vpp.Notification) {
101+
p.configurator.notifyService.pushNotification(&rpc.Notification{
102+
Notification: &rpc.Notification_VppNotification{
103+
VppNotification: vppNotification,
104+
},
105+
})
106+
}
107+
97108
// Close does nothing.
98109
func (p *Plugin) Close() error {
99110
return safeclose.Close(p.vppChan)
@@ -113,6 +124,9 @@ func (p *Plugin) initHandlers() (err error) {
113124
aclIndexes := p.VPPACLPlugin.GetACLIndex() // TODO: make ACL optional
114125
vrfIndexes := p.VPPL3Plugin.GetVRFIndex()
115126

127+
// Linux Indexes
128+
linuxIfIndexes := p.LinuxIfPlugin.GetInterfaceIndex()
129+
116130
// VPP handlers
117131

118132
// core
@@ -151,9 +165,10 @@ func (p *Plugin) initHandlers() (err error) {
151165
p.Log.Info("VPP Punt handler is not available, it will be skipped")
152166
}
153167

154-
// Linux indexes and handlers
155-
p.configurator.linuxIfHandler = iflinuxcalls.NewNetLinkHandler()
156-
p.configurator.linuxL3Handler = l3linuxcalls.NewNetLinkHandler()
168+
// Linux handlers
169+
p.configurator.linuxIfHandler = iflinuxcalls.NewNetLinkHandler(p.NsPlugin, linuxIfIndexes,
170+
p.ServiceLabel.GetAgentPrefix(), defaultGoRoutineCount, p.Log)
171+
p.configurator.linuxL3Handler = l3linuxcalls.NewNetLinkHandler(p.NsPlugin, linuxIfIndexes, defaultGoRoutineCount, p.Log)
157172

158173
return nil
159174
}

0 commit comments

Comments
 (0)