Skip to content

Commit

Permalink
Multi-ip testing including IPv4 and IPv6 (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwarnicke authored May 9, 2021
1 parent 4414fb1 commit baf2759
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
11 changes: 7 additions & 4 deletions internal/tests/suite_combinatronics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,26 @@ import (
)

func (f *ForwarderTestSuite) TestCombinations() {
_, prefix, err := net.ParseCIDR("10.0.0.0/24")
_, prefix1, err := net.ParseCIDR("10.0.0.0/24")
f.Require().NoError(err)
_, prefix2, err := net.ParseCIDR("fc00::/7")
f.Require().NoError(err)
endpoints := map[string]func(ctx context.Context) verifiableEndpoint{
kernel.MECHANISM: func(ctx context.Context) verifiableEndpoint {
return newKernelVerifiableEndpoint(ctx,
prefix,
prefix1,
prefix2,
spiffejwt.TokenGeneratorFunc(f.x509source, f.config.MaxTokenLifetime),
)
},
memif.MECHANISM: func(ctx context.Context) verifiableEndpoint {
return newMemifVerifiableEndpoint(ctx, prefix,
return newMemifVerifiableEndpoint(ctx, prefix1, prefix2,
spiffejwt.TokenGeneratorFunc(f.x509source, f.config.MaxTokenLifetime),
f.vppServerConn,
)
},
vxlan.MECHANISM: func(ctx context.Context) verifiableEndpoint {
return newVxlanVerifiableEndpoint(ctx, prefix,
return newVxlanVerifiableEndpoint(ctx, prefix1, prefix2,
spiffejwt.TokenGeneratorFunc(f.x509source, f.config.MaxTokenLifetime),
f.vppServerConn,
)
Expand Down
8 changes: 4 additions & 4 deletions internal/tests/suite_kernel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net"
"os"

"github.com/edwarnicke/exechelper"
"github.com/pkg/errors"
"github.com/vishvananda/netlink"
"github.com/vishvananda/netns"
Expand All @@ -33,8 +34,6 @@ import (
"github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/cls"
"github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/kernel"

"github.com/edwarnicke/exechelper"

"github.com/networkservicemesh/sdk/pkg/networkservice/chains/client"
"github.com/networkservicemesh/sdk/pkg/networkservice/chains/endpoint"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/authorize"
Expand Down Expand Up @@ -72,7 +71,7 @@ type kernelVerifiableEndpoint struct {
}

func newKernelVerifiableEndpoint(ctx context.Context,
prefix *net.IPNet,
prefix1, prefix2 *net.IPNet,
tokenGenerator token.GeneratorFunc,
) verifiableEndpoint {
rootNSHandle, err := netns.Get()
Expand All @@ -97,7 +96,8 @@ func newKernelVerifiableEndpoint(ctx context.Context,
endpoint.WithName("kernelVerifiableEndpoint"),
endpoint.WithAuthorizeServer(authorize.NewServer()),
endpoint.WithAdditionalFunctionality(
point2pointipam.NewServer(prefix),
point2pointipam.NewServer(prefix1),
point2pointipam.NewServer(prefix2),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
kernel.MECHANISM: chain.NewNetworkServiceServer(
kernelmechanism.NewServer(),
Expand Down
5 changes: 3 additions & 2 deletions internal/tests/suite_memif_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type memifVerifiableEndpoint struct {
}

func newMemifVerifiableEndpoint(ctx context.Context,
prefix *net.IPNet,
prefix1, prefix2 *net.IPNet,
tokenGenerator token.GeneratorFunc,
vppConn vpphelper.Connection,
) verifiableEndpoint {
Expand All @@ -74,7 +74,8 @@ func newMemifVerifiableEndpoint(ctx context.Context,
endpoint.WithAuthorizeServer(authorize.NewServer()),
endpoint.WithAdditionalFunctionality(
sendfd.NewServer(),
point2pointipam.NewServer(prefix),
point2pointipam.NewServer(prefix1),
point2pointipam.NewServer(prefix2),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
memif.MECHANISM: chain.NewNetworkServiceServer(
metadata.NewServer(),
Expand Down
2 changes: 1 addition & 1 deletion internal/tests/suite_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

const (
contextTimeout = 100 * time.Second
contextTimeout = 1000 * time.Second
forwarderIP = "10.0.2.1"
clientIP = "10.0.2.2"
serverIP = "10.0.2.3"
Expand Down
5 changes: 3 additions & 2 deletions internal/tests/suite_vxlan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type vxlanVerifiableEndpoint struct {
}

func newVxlanVerifiableEndpoint(ctx context.Context,
prefix *net.IPNet,
prefix1, prefix2 *net.IPNet,
tokenGenerator token.GeneratorFunc,
vppConn api.Connection) verifiableEndpoint {
rv := &vxlanVerifiableEndpoint{
Expand All @@ -59,7 +59,8 @@ func newVxlanVerifiableEndpoint(ctx context.Context,
endpoint.WithAuthorizeServer(authorize.NewServer()),
endpoint.WithAdditionalFunctionality(
metadata.NewServer(),
point2pointipam.NewServer(prefix),
point2pointipam.NewServer(prefix1),
point2pointipam.NewServer(prefix2),
connectioncontext.NewServer(vppConn),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
vxlan.MECHANISM: vxlan.NewServer(vppConn, net.ParseIP(serverIP)),
Expand Down

0 comments on commit baf2759

Please sign in to comment.