Skip to content

Commit

Permalink
Implement IP6 ND autoconfig for VPP 20.01
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
  • Loading branch information
ondrej-fabry committed Jul 6, 2020
1 parent 1d33d2e commit 6607c30
Show file tree
Hide file tree
Showing 8 changed files with 590 additions and 10 deletions.
405 changes: 405 additions & 0 deletions plugins/vpp/binapi/vpp2001/ip6_nd/ip6_nd.ba.go

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions plugins/vpp/binapi/vpp2001/rd_cp/rd_cp.ba.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions plugins/vpp/binapi/vpp2001/vpp2001.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import (
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/abf"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/acl"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/af_packet"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/arp"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/bond"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/dhcp"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/flowprobe"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/gre"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/gtpu"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/interfaces"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip6_nd"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ipfix_export"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ipip"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ipsec"
Expand All @@ -36,6 +38,7 @@ import (
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/memif"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/nat"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/punt"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/rd_cp"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/span"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/sr"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/stn"
Expand All @@ -47,33 +50,36 @@ import (
)

// Version is used to identify VPP binapi version
const Version = "20.01-rc2~11"
const Version = "20.01-45"

func init() {
binapi.Versions[Version] = binapi.VersionMsgs{
Core: vpp.Messages(
af_packet.AllMessages,
arp.AllMessages,
bond.AllMessages,
dhcp.AllMessages,
gre.AllMessages,
interfaces.AllMessages,
ip.AllMessages,
ip6_nd.AllMessages,
ipfix_export.AllMessages,
ipip.AllMessages,
ipsec.AllMessages,
l2.AllMessages,
memclnt.AllMessages,
punt.AllMessages,
rd_cp.AllMessages,
span.AllMessages,
sr.AllMessages,
tapv2.AllMessages,
vpe.AllMessages,
vxlan.AllMessages,
vxlan_gpe.AllMessages,
ipip.AllMessages,
),
Plugins: vpp.Messages(
abf.AllMessages,
acl.AllMessages,
dhcp.AllMessages,
flowprobe.AllMessages,
gtpu.AllMessages,
l3xc.AllMessages,
Expand All @@ -100,19 +106,21 @@ func init() {
//go:generate binapigen --input-file=$VPP_API_DIR/core/gre.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/interface.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ip.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ip6_nd.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ip_neighbor.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ipfix_export.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ipip.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ipsec.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/l2.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/memclnt.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/punt.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/rd_cp.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/span.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/sr.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/tapv2.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/vpe.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/vxlan.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/vxlan_gpe.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/core/ipip.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/plugins/abf.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/plugins/acl.api.json
//go:generate binapigen --input-file=$VPP_API_DIR/plugins/flowprobe.api.json
Expand Down
2 changes: 1 addition & 1 deletion plugins/vpp/binapi/vpp2005/vpp2005.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import (
)

// Version is used to identify VPP binapi version
const Version = "20.05-rc1~1"
const Version = "20.05-14"

func init() {
binapi.Versions[Version] = binapi.VersionMsgs{
Expand Down
23 changes: 20 additions & 3 deletions plugins/vpp/l3plugin/vppcalls/vpp2001/ip6nd_vppcalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,25 @@ package vpp2001
import (
"context"
"fmt"

"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/interface_types"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/rd_cp"
)

func (h *L3VppHandler) SetIP6ndAutoconfig(ctx context.Context, iface string, enable, installDefaultRoutes bool) error {
return fmt.Errorf("not supported for this VPP version")
}

func (h *IP6ndHandler) SetIP6ndAutoconfig(ctx context.Context, iface string, enable, installDefaultRoutes bool) error {
meta, found := h.ifIndexes.LookupByName(iface)
if !found {
return fmt.Errorf("interface %s not found", iface)
}

_, err := h.rpcRdCp.IP6NdAddressAutoconfig(ctx, &rd_cp.IP6NdAddressAutoconfig{
SwIfIndex: interface_types.InterfaceIndex(meta.SwIfIndex),
Enable: enable,
InstallDefaultRoutes: installDefaultRoutes,
})
if err != nil {
return err
}
return nil
}
28 changes: 28 additions & 0 deletions plugins/vpp/l3plugin/vppcalls/vpp2001/vppcalls_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import (
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001"
vpp_dhcp "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/dhcp"
vpp_ip "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip6_nd"
vpp_ip_neighbor "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip_neighbor"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/ip_types"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/l3xc"
"go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/rd_cp"
vpp_vpe "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2001/vpe"
"go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/ifaceidx"
"go.ligato.io/vpp-agent/v3/plugins/vpp/l3plugin/vppcalls"
Expand All @@ -59,6 +61,7 @@ type L3VppHandler struct {
*DHCPProxyHandler
*L3XCHandler
*TeibHandlerUnsupported
*IP6ndHandler
}

func NewL3VppHandler(
Expand All @@ -82,6 +85,7 @@ func NewL3VppHandler(
DHCPProxyHandler: NewDHCPProxyHandler(ch, log),
L3XCHandler: NewL3XCHandler(c, ifIdx, log),
TeibHandlerUnsupported: &TeibHandlerUnsupported{},
IP6ndHandler: NewIP6ndVppHandler(ch, ifIdx, log),
}
}

Expand Down Expand Up @@ -127,6 +131,16 @@ type VrfTableHandler struct {
log logging.Logger
}

// IP6ndHandler is accessor for IP6ND-related vppcalls methods
type IP6ndHandler struct {
rpcIP6nd ip6_nd.RPCService
rpcRdCp rd_cp.RPCService
callsChannel govppapi.Channel
ifIndexes ifaceidx.IfaceMetadataIndex
log logging.Logger
}


// NewArpVppHandler creates new instance of IPsec vppcalls handler
func NewArpVppHandler(callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) *ArpVppHandler {
if log == nil {
Expand Down Expand Up @@ -226,6 +240,20 @@ func NewL3XCHandler(c vpp.Client, ifIndexes ifaceidx.IfaceMetadataIndex, log log
return h
}


func NewIP6ndVppHandler(ch govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) *IP6ndHandler {
if log == nil {
log = logrus.NewLogger("ip6nd-handler")
}
return &IP6ndHandler{
rpcIP6nd: ip6_nd.NewServiceClient(ch),
rpcRdCp: rd_cp.NewServiceClient(ch),
callsChannel: ch,
ifIndexes: ifIndexes,
log: log,
}
}

type TeibHandlerUnsupported struct{}

func (h *TeibHandlerUnsupported) VppAddTeibEntry(ctx context.Context, entry *l3.TeibEntry) error {
Expand Down
3 changes: 3 additions & 0 deletions plugins/vpp/l3plugin/vppcalls/vpp2005/vppcalls_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func init() {
msgs = append(msgs, vpp_ip_neighbor.AllMessages()...)
msgs = append(msgs, vpp_vpe.AllMessages()...)
msgs = append(msgs, vpp_dhcp.AllMessages()...)
msgs = append(msgs, ip6_nd.AllMessages()...)
msgs = append(msgs, rd_cp.AllMessages()...)
msgs = append(msgs, l3xc.AllMessages()...)

vppcalls.AddHandlerVersion(vpp2005.Version, msgs, NewL3VppHandler)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/vpp/032_ip6nd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func TestIP6ND(t *testing.T) {
test := setupVPP(t)
defer test.teardownVPP()

if test.versionInfo.Release() < "20.05" {
t.Skipf("SKIP for VPP %s<20.05", test.versionInfo.Release())
if test.versionInfo.Release() < "20.01" {
t.Skipf("SKIP for VPP %s<20.01", test.versionInfo.Release())
}

ih := ifplugin_vppcalls.CompatibleInterfaceVppHandler(test.vppClient, logrus.NewLogger("test"))
Expand Down

0 comments on commit 6607c30

Please sign in to comment.