Skip to content

Commit

Permalink
Fixes to enable vxlan testing in cmd-forwarder-vpp. (#120)
Browse files Browse the repository at this point in the history
Add NextNode  ethernet-input for vxlan:

  This allows assignment of an IP address to vxlan in a way
  that responds to arp.  It is used for testing.

Set route to IsMultipath == false:
  Fixes a bug in adding an deleting the same route repeatedly
  for vxlan interfaces

Signed-off-by: Ed Warnicke <hagbard@gmail.com>
  • Loading branch information
edwarnicke authored Mar 7, 2021
1 parent 2404707 commit fc1f027
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func routeAddDel(ctx context.Context, vppConn api.Connection, swIfIndex interfac
now := time.Now()
if _, err := ip.NewServiceClient(vppConn).IPRouteAddDel(ctx, &ip.IPRouteAddDel{
IsAdd: isAdd,
IsMultipath: true,
IsMultipath: false,
Route: route,
}); err != nil {
return errors.WithStack(err)
Expand Down
21 changes: 20 additions & 1 deletion pkg/networkservice/mechanisms/vxlan/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"git.fd.io/govpp.git/api"
"git.fd.io/govpp.git/binapi/vpe"
"github.com/edwarnicke/govpp/binapi/vxlan"
"github.com/pkg/errors"

Expand Down Expand Up @@ -49,12 +50,30 @@ func addDel(ctx context.Context, conn *networkservice.Connection, vppConn api.Co
}

now := time.Now()

addNextNode := &vpe.AddNodeNext{
NodeName: "vxlan4-input",
NextName: "ethernet-input",
}

addNextNodeRsp, err := vpe.NewServiceClient(vppConn).AddNodeNext(ctx, addNextNode)
if err != nil {
return errors.WithStack(err)
}
log.FromContext(ctx).
WithField("NextIndex", addNextNodeRsp.NextIndex).
WithField("NodeName", addNextNode.NodeName).
WithField("NextName", addNextNode.NextName).
WithField("duration", time.Since(now)).
WithField("vppapi", "AddNodeNext").Debug("completed")

now = time.Now()
vxlanAddDelTunnel := &vxlan.VxlanAddDelTunnel{
IsAdd: isAdd,
Instance: ^uint32(0),
SrcAddress: types.ToVppAddress(mechanism.SrcIP()),
DstAddress: types.ToVppAddress(mechanism.DstIP()),
DecapNextIndex: ^uint32(0),
DecapNextIndex: addNextNodeRsp.NextIndex,
Vni: mechanism.VNI(),
}
if !isClient {
Expand Down

0 comments on commit fc1f027

Please sign in to comment.