Skip to content

Commit

Permalink
Merge branch 'main' into gue-test-order-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Nov 30, 2023
2 parents b1707b2 + b22a398 commit d581af5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
12 changes: 9 additions & 3 deletions dataplane/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@

package config

import (
"github.com/spf13/viper"

fwdpb "github.com/openconfig/lemming/proto/forwarding"
)

const (
// NetDevForwardingType configures the forwarding type of a SAI netdev hostif. Options are (KERNEL and TAP).
NetDevForwardingType = "dataplane.netDevType"
)

// func init() {
// viper.Set(NetDevForwardingType, fwdpb.PortType_name[int32(fwdpb.PortType_PORT_TYPE_KERNEL)])
// }
func init() {
viper.Set(NetDevForwardingType, fwdpb.PortType_name[int32(fwdpb.PortType_PORT_TYPE_KERNEL)])
}
8 changes: 3 additions & 5 deletions dataplane/dplanerc/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (ni *Reconciler) StartRoute(ctx context.Context, client *ygnmi.Client) erro
log.Warningf("failed to parse cidr: %v", err)
return ygnmi.Continue
}
log.Infof("got route update entry: %v", prefix)
ipBytes := prefix.Masked().Addr().AsSlice()
mask := net.CIDRMask(prefix.Bits(), len(ipBytes)*8)

Expand All @@ -87,7 +86,6 @@ func (ni *Reconciler) StartRoute(ctx context.Context, client *ygnmi.Client) erro
}
return ygnmi.Continue
}
log.Infof("starting route add: %v", prefix)
rReq := saipb.CreateRouteEntryRequest{
Entry: entry,
PacketAction: saipb.PacketAction_PACKET_ACTION_FORWARD.Enum(),
Expand All @@ -101,7 +99,7 @@ func (ni *Reconciler) StartRoute(ctx context.Context, client *ygnmi.Client) erro
if _, err := ni.routeClient.CreateRouteEntry(ctx, &rReq); err != nil {
log.Warningf("failed to create route: %v", err)
}
log.Infof("done connected route add: %v", &rReq)
log.Infof("added connected route: %v", &rReq)
return ygnmi.Continue
}
var hopID uint64
Expand Down Expand Up @@ -174,7 +172,7 @@ func (ni *Reconciler) createNextHop(ctx context.Context, hop *dpb.NextHop) (uint
if err != nil {
return 0, err
}
log.Infof("created next hop add: %v", &hopReq)
log.Infof("created next hop: %v", &hopReq)
if hop.GetGue() != nil {
acts, err := gueActions(hop.GetGue())
if err != nil {
Expand All @@ -198,7 +196,7 @@ func (ni *Reconciler) createNextHop(ctx context.Context, hop *dpb.NextHop) (uint
if err != nil {
return 0, err
}
log.Infof("created gue actions add: %v", actReq)
log.Infof("created gue actions: %v", actReq)
}
return resp.Oid, nil
}
Expand Down
11 changes: 9 additions & 2 deletions sysrib/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{42, 42, 42, 42},
DstIp: []byte{192, 168, 1, 42},
DstPort: 8,
IsV6: !v4,
},
},
}},
Expand Down Expand Up @@ -1345,6 +1346,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{43, 43, 43, 43},
DstIp: []byte{10, 10, 10, 10},
DstPort: 9,
IsV6: !v4,
},
},
}},
Expand Down Expand Up @@ -1549,6 +1551,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{8, 8, 8, 8},
DstIp: []byte{10, 10, 10, 10},
DstPort: 8,
IsV6: !v4,
},
},
}},
Expand All @@ -1572,6 +1575,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{8, 8, 8, 8},
DstIp: []byte{10, 10, 20, 20},
DstPort: 8,
IsV6: !v4,
},
},
}},
Expand Down Expand Up @@ -1640,6 +1644,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{8, 8, 8, 8},
DstIp: []byte{10, 10, 10, 10},
DstPort: 8,
IsV6: !v4,
},
},
}},
Expand All @@ -1663,6 +1668,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{16, 16, 16, 16},
DstIp: []byte{10, 10, 20, 20},
DstPort: 16,
IsV6: !v4,
},
},
}},
Expand Down Expand Up @@ -1740,6 +1746,7 @@ func TestBGPGUEPolicy(t *testing.T) {
SrcIp: []byte{16, 16, 16, 16},
DstIp: []byte{10, 10, 20, 20},
DstPort: 16,
IsV6: !v4,
},
},
}},
Expand Down Expand Up @@ -1850,8 +1857,8 @@ func TestBGPGUEPolicy(t *testing.T) {
},
Encap: &dpb.NextHop_Gue{
Gue: &dpb.GUE{
SrcIp: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
DstIp: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
SrcIp: []byte{16, 16, 16, 16},
DstIp: []byte{10, 10, 20, 30},
DstPort: 32,
},
},
Expand Down

0 comments on commit d581af5

Please sign in to comment.