diff --git a/extensions/base/suite.go b/extensions/base/suite.go index c10c7f12ae..55a7697f01 100644 --- a/extensions/base/suite.go +++ b/extensions/base/suite.go @@ -48,7 +48,7 @@ func (s *Suite) TearDownSuite() { } const ( - sha = "31f27aa67914a2d7b5d6ec6790937b89717d10ed" + sha = "cc426f4d2de1424e1b986f4376ee1b6ca454a67e" ) // SetupSuite runs all extensions diff --git a/suites/afxdp/suite.gen.go b/suites/afxdp/suite.gen.go new file mode 100755 index 0000000000..bb44538b2d --- /dev/null +++ b/suites/afxdp/suite.gen.go @@ -0,0 +1,142 @@ +// Code generated by gotestmd DO NOT EDIT. +package afxdp + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/afxdp") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/afxdp?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestKernel2ip2kernel_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Kernel2IP2Kernel_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2kernel-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Kernel2IP2Kernel_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel-ipv6`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel-ipv6 -- ping -c 4 2001:db8::`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel-ipv6 -- ping -c 4 2001:db8::1`) +} +func (s *Suite) TestMemif2ip2memif_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Memif2IP2Memif_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2memif-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Memif2IP2Memif_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2memif-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ip2memif-ipv6`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2memif-ipv6" -- vppctl ping 2001:db8:: repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ip2memif-ipv6" -- vppctl ping 2001:db8::1 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestKernel2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ethernet2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ethernet2memif`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2memif -- ping -c 4 172.16.1.100`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestKernel2ip2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ip2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ip2memif`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2memif -- ping -c 4 172.16.1.100`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ethernet2kernel`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestMemif2ethernet2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ethernet2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ethernet2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2ip2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ip2kernel`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ip2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestMemif2ip2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ip2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} diff --git a/suites/basic/suite.gen.go b/suites/basic/suite.gen.go new file mode 100755 index 0000000000..3749fcda32 --- /dev/null +++ b/suites/basic/suite.gen.go @@ -0,0 +1,164 @@ +// Code generated by gotestmd DO NOT EDIT. +package basic + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/basic") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/basic?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestKernel2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ethernet2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ethernet2memif`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2memif -- ping -c 4 172.16.1.100`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestKernel2ip2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ip2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ip2memif`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2memif -- ping -c 4 172.16.1.100`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestKernel2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2memif`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2memif -- ping -c 4 172.16.1.100`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ethernet2kernel`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestMemif2ethernet2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ethernet2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ethernet2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2ip2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ip2kernel`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ip2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestMemif2ip2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ip2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2kernel`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestMemif2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} diff --git a/suites/features/jaeger/suite.gen.go b/suites/features/jaeger/suite.gen.go new file mode 100755 index 0000000000..6b8c6535a2 --- /dev/null +++ b/suites/features/jaeger/suite.gen.go @@ -0,0 +1,25 @@ +// Code generated by gotestmd DO NOT EDIT. +package jaeger + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) Test() {} diff --git a/suites/features/suite.gen.go b/suites/features/suite.gen.go new file mode 100755 index 0000000000..54bfd144df --- /dev/null +++ b/suites/features/suite.gen.go @@ -0,0 +1,313 @@ +// Code generated by gotestmd DO NOT EDIT. +package features + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/basic" +) + +type Suite struct { + base.Suite + basicSuite basic.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.basicSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) TestAnnotated_namespace() { + r := s.Runner("../deployments-k8s/examples/features/annotated-namespace") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-annotated-namespace`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/annotated-namespace?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-annotated-namespace`) + r.Run(`kubectl annotate ns ns-annotated-namespace networkservicemesh.io=kernel://annotated-namespace/nsm-1`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/features/annotated-namespace/client.yaml`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-annotated-namespace`) + r.Run(`kubectl logs deployments/alpine -n ns-annotated-namespace -c cmd-nsc-init | grep -c '\[id:alpine-.*-0\]'`) + r.Run(`kubectl exec deployments/alpine -n ns-annotated-namespace -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-annotated-namespace -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestDns() { + r := s.Runner("../deployments-k8s/examples/features/dns") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-dns`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/dns?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod dnsutils -n ns-dns`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod -l app=nse-kernel -n ns-dns`) + r.Run(`kubectl exec pods/dnsutils -c dnsutils -n ns-dns -- nslookup -norec -nodef my.coredns.service`) + r.Run(`kubectl exec pods/dnsutils -c dnsutils -n ns-dns -- ping -c 4 my.coredns.service`) + r.Run(`kubectl exec pods/dnsutils -c dnsutils -n ns-dns -- dig kubernetes.default A kubernetes.default AAAA | grep "kubernetes.default.svc.cluster.local"`) +} +func (s *Suite) TestKernel2ip2kernel_dual_stack() { + r := s.Runner("../deployments-k8s/examples/features/dual-stack/Kernel2IP2Kernel_dual_stack") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2kernel-dual-stack`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/dual-stack/Kernel2IP2Kernel_dual_stack?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel-dual-stack`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel-dual-stack`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel-dual-stack -- ping -c 4 2001:db8::`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel-dual-stack -- ping -c 4 2001:db8::1`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel-dual-stack -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel-dual-stack -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2kernel_dual_stack() { + r := s.Runner("../deployments-k8s/examples/features/dual-stack/Kernel2Kernel_dual_stack") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel-dual-stack`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/dual-stack/Kernel2Kernel_dual_stack?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel-dual-stack`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel-dual-stack`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel-dual-stack -- ping -c 4 2001:db8::`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel-dual-stack -- ping -c 4 2001:db8::1`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel-dual-stack -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel-dual-stack -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestExclude_prefixes() { + r := s.Runner("../deployments-k8s/examples/features/exclude-prefixes") + s.T().Cleanup(func() { + r.Run(`kubectl delete configmap excluded-prefixes-config` + "\n" + `kubectl delete ns ns-exclude-prefixes`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/exclude-prefixes/configmap?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/exclude-prefixes?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-exclude-prefixes`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-exclude-prefixes`) + r.Run(`kubectl exec pods/alpine -n ns-exclude-prefixes -- ping -c 4 172.16.1.200`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-exclude-prefixes -- ping -c 4 172.16.1.203`) +} +func (s *Suite) TestExclude_prefixes_client() { + r := s.Runner("../deployments-k8s/examples/features/exclude-prefixes-client") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-exclude-prefixes-client`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/exclude-prefixes-client?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-exclude-prefixes-client`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-1 -n ns-exclude-prefixes-client`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-2 -n ns-exclude-prefixes-client`) + r.Run(`kubectl exec pods/alpine -n ns-exclude-prefixes-client -- ping -c 4 172.16.1.96`) + r.Run(`kubectl exec pods/alpine -n ns-exclude-prefixes-client -- ping -c 4 172.16.1.98`) + r.Run(`kubectl exec deployments/nse-kernel-1 -n ns-exclude-prefixes-client -- ping -c 4 172.16.1.97`) + r.Run(`kubectl exec deployments/nse-kernel-2 -n ns-exclude-prefixes-client -- ping -c 4 172.16.1.99`) +} +func (s *Suite) TestKernel2ip2kernel_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Kernel2IP2Kernel_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2kernel-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Kernel2IP2Kernel_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel-ipv6`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel-ipv6 -- ping -c 4 2001:db8::`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel-ipv6 -- ping -c 4 2001:db8::1`) +} +func (s *Suite) TestKernel2ip2memif_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Kernel2IP2Memif_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ip2memif-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Kernel2IP2Memif_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2memif-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ip2memif-ipv6`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2memif-ipv6 -- ping -c 4 2001:db8::`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ip2memif-ipv6" -- vppctl ping 2001:db8::1 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestKernel2kernel_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Kernel2Kernel_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Kernel2Kernel_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel-ipv6`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel-ipv6 -- ping -c 4 2001:db8::`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel-ipv6 -- ping -c 4 2001:db8::1`) +} +func (s *Suite) TestMemif2ip2kernel_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Memif2IP2Kernel_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2kernel-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Memif2IP2Kernel_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2kernel-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ip2kernel-ipv6`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2kernel-ipv6" -- vppctl ping 2001:db8:: repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ip2kernel-ipv6 -- ping -c 4 2001:db8::1`) +} +func (s *Suite) TestMemif2ip2memif_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Memif2IP2Memif_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2ip2memif-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Memif2IP2Memif_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2memif-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ip2memif-ipv6`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2memif-ipv6" -- vppctl ping 2001:db8:: repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ip2memif-ipv6" -- vppctl ping 2001:db8::1 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMemif2memif_ipv6() { + r := s.Runner("../deployments-k8s/examples/features/ipv6/Memif2Memif_ipv6") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2memif-ipv6`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/ipv6/Memif2Memif_ipv6?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif-ipv6`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif-ipv6`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2memif-ipv6" -- vppctl ping ipv6 2001:db8:: repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2memif-ipv6" -- vppctl ping ipv6 2001:db8::1 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestMultiple_services() { + r := s.Runner("../deployments-k8s/examples/features/multiple-services") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-multiple-services`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/multiple-services?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-multiple-services`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-1 -n ns-multiple-services`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-2 -n ns-multiple-services`) + r.Run(`kubectl exec pods/alpine -n ns-multiple-services -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec pods/nse-kernel-1 -n ns-multiple-services -- ping -c 4 172.16.1.101`) + r.Run(`kubectl exec pods/alpine -n ns-multiple-services -- ping -c 4 172.16.2.100`) + r.Run(`kubectl exec pods/nse-kernel-2 -n ns-multiple-services -- ping -c 4 172.16.2.101`) +} +func (s *Suite) TestMutually_aware_nses() { + r := s.Runner("../deployments-k8s/examples/features/mutually-aware-nses") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-mutually-aware-nses`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/mutually-aware-nses?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ns-mutually-aware-nses`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-1 -n ns-mutually-aware-nses`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel-2 -n ns-mutually-aware-nses`) + r.Run(`kubectl exec deployments/nsc-kernel -n ns-mutually-aware-nses -- apk update` + "\n" + `kubectl exec deployments/nsc-kernel -n ns-mutually-aware-nses -- apk add iproute2`) + r.Run(`result=$(kubectl exec deployments/nsc-kernel -n ns-mutually-aware-nses -- ip r get 172.16.1.100 from 172.16.1.101 ipproto tcp dport 6666)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.1.100 from 172.16.1.101 dev nsm-1"`) + r.Run(`result=$(kubectl exec deployments/nsc-kernel -n ns-mutually-aware-nses -- ip r get 172.16.1.100 from 172.16.1.101 ipproto udp dport 5555)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.1.100 from 172.16.1.101 dev nsm-2"`) +} +func (s *Suite) TestNse_composition() { + r := s.Runner("../deployments-k8s/examples/features/nse-composition") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-nse-composition`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/nse-composition?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod -l app=alpine -n ns-nse-composition`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-nse-composition`) + r.Run(`kubectl exec pods/alpine -n ns-nse-composition -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec pods/alpine -n ns-nse-composition -- wget -O /dev/null --timeout 5 "172.16.1.100:8080"`) + r.Run(`kubectl exec pods/alpine -n ns-nse-composition -- wget -O /dev/null --timeout 5 "172.16.1.100:80"` + "\n" + `if [ 0 -eq $? ]; then` + "\n" + ` echo "error: port :80 is available" >&2` + "\n" + ` false` + "\n" + `else` + "\n" + ` echo "success: port :80 is unavailable"` + "\n" + `fi`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-nse-composition -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestOpa() { + r := s.Runner("../deployments-k8s/examples/features/opa") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-opa`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/opa?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ns-opa`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-opa`) + r.Run(`kubectl logs deployments/nsc-kernel -n ns-opa | grep "PermissionDenied desc = no sufficient privileges"`) +} +func (s *Suite) TestPolicy_based_routing() { + r := s.Runner("../deployments-k8s/examples/features/policy-based-routing") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-policy-based-routing`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/policy-based-routing?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nettools -n ns-policy-based-routing`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-policy-based-routing`) + r.Run(`kubectl exec pods/nettools -n ns-policy-based-routing -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-policy-based-routing -- ping -c 4 172.16.1.101`) + r.Run(`result=$(kubectl exec pods/nettools -n ns-policy-based-routing -- ip r get 172.16.3.1 from 172.16.2.201 ipproto tcp dport 6666)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.3.1 from 172.16.2.201 via 172.16.2.200 dev nsm-1 table 1"`) + r.Run(`result=$(kubectl exec pods/nettools -n ns-policy-based-routing -- ip r get 172.16.3.1 from 172.16.2.201 ipproto tcp sport 5555)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.3.1 from 172.16.2.201 dev nsm-1 table 2"`) + r.Run(`result=$(kubectl exec pods/nettools -n ns-policy-based-routing -- ip r get 172.16.4.1 ipproto udp dport 6666)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.4.1 dev nsm-1 table 3 src 172.16.1.101"`) + r.Run(`result=$(kubectl exec pods/nettools -n ns-policy-based-routing -- ip r get 172.16.4.1 ipproto udp dport 6668)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "172.16.4.1 dev nsm-1 table 4 src 172.16.1.101"`) + r.Run(`result=$(kubectl exec pods/nettools -n ns-policy-based-routing -- ip -6 route get 2004::5 from 2004::3 ipproto udp dport 5555)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -E -q "via 2004::6 dev nsm-1 table 5 src 2004::3"`) +} +func (s *Suite) TestScale_from_zero() { + r := s.Runner("../deployments-k8s/examples/features/scale-from-zero") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-scale-from-zero`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/scale-from-zero?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n ns-scale-from-zero --for=condition=ready --timeout=1m pod -l app=nse-supplier-k8s`) + r.Run(`kubectl wait -n ns-scale-from-zero --for=condition=ready --timeout=1m pod -l app=alpine`) + r.Run(`kubectl wait -n ns-scale-from-zero --for=condition=ready --timeout=1m pod -l app=nse-icmp-responder`) + r.Run(`NSE=$(kubectl get pod -n ns-scale-from-zero --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' -l app=nse-icmp-responder)`) + r.Run(`kubectl exec pods/alpine -n ns-scale-from-zero -- ping -c 4 169.254.0.0`) + r.Run(`kubectl exec $NSE -n ns-scale-from-zero -- ping -c 4 169.254.0.1`) + r.Run(`NSE_NODE=$(kubectl get pod -n ns-scale-from-zero --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}' -l app=nse-icmp-responder)` + "\n" + `NSC_NODE=$(kubectl get pod -n ns-scale-from-zero --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}' -l app=alpine)`) + r.Run(`if [ $NSC_NODE == $NSE_NODE ]; then echo "OK"; else echo "different nodes"; false; fi`) + r.Run(`kubectl delete pod -n ns-scale-from-zero alpine`) + r.Run(`kubectl wait -n ns-scale-from-zero --for=delete --timeout=1m pod -l app=nse-icmp-responder`) +} +func (s *Suite) TestSelect_forwarder() { + r := s.Runner("../deployments-k8s/examples/features/select-forwarder") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-select-forwarder`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/select-forwarder?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-select-forwarder`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-select-forwarder`) + r.Run(`kubectl exec pods/alpine -n ns-select-forwarder -- ping -c 4 169.254.0.0`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-select-forwarder -- ping -c 4 169.254.0.1`) + r.Run(`kubectl logs pods/alpine -c cmd-nsc -n ns-select-forwarder | grep "my-forwarder-vpp"`) +} +func (s *Suite) TestVl3_basic() { + r := s.Runner("../deployments-k8s/examples/features/vl3-basic") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-vl3`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/vl3-basic?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=2m pod -l app=alpine -n ns-vl3`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3)` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3 $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3 -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` echo $nsc pings nses` + "\n" + ` kubectl exec -n ns-vl3 $nsc -- ping 172.16.0.0 -c2 -i 0.5 || exit` + "\n" + ` kubectl exec -n ns-vl3 $nsc -- ping 172.16.1.0 -c2 -i 0.5 || exit` + "\n" + `done` + "\n" + `)`) +} +func (s *Suite) TestVl3_dns() { + r := s.Runner("../deployments-k8s/examples/features/vl3-dns") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-vl3-dns`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/vl3-dns?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=2m pod -l app=alpine -n ns-vl3-dns`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-dns)` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs` + "\n" + `do` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` kubectl exec $pinger -n ns-vl3-dns -- ping -c2 -i 0.5 $nsc.vl3-dns -4 || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`(` + "\n" + `for nsc in $nscs` + "\n" + `do` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` # Get IP address for PTR request` + "\n" + ` nscAddr=$(kubectl exec $pinger -n ns-vl3-dns -- nslookup -type=a $nsc.vl3-dns | grep -A1 Name | tail -n1 | sed 's/Address: //')` + "\n" + ` kubectl exec $pinger -n ns-vl3-dns -- nslookup $nscAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`nses=$(kubectl get pods -l app=nse-vl3-vpp -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-dns)` + "\n" + `[[ ! -z nses ]]`) + r.Run(`(` + "\n" + `for nse in $nses` + "\n" + `do` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` kubectl exec $pinger -n ns-vl3-dns -- ping -c2 -i 0.5 $nse.vl3-dns -4 || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`(` + "\n" + `for nse in $nses` + "\n" + `do` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` # Get IP address for PTR request` + "\n" + ` nseAddr=$(kubectl exec $pinger -n ns-vl3-dns -- nslookup -type=a $nse.vl3-dns | grep -A1 Name | tail -n1 | sed 's/Address: //')` + "\n" + ` kubectl exec $pinger -n ns-vl3-dns -- nslookup $nseAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) +} +func (s *Suite) TestVl3_scale_from_zero() { + r := s.Runner("../deployments-k8s/examples/features/vl3-scale-from-zero") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-vl3-scale-from-zero`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/vl3-scale-from-zero?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n ns-vl3-scale-from-zero --for=condition=ready --timeout=1m pod -l app=nse-supplier-k8s`) + r.Run(`kubectl wait -n ns-vl3-scale-from-zero --for=condition=ready --timeout=1m pod -l app=alpine`) + r.Run(`kubectl wait -n ns-vl3-scale-from-zero --for=condition=ready --timeout=1m pod -l app=nse-vl3-vpp`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-scale-from-zero)` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3-scale-from-zero $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3-scale-from-zero -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` echo $nsc pings nses` + "\n" + ` kubectl exec -n ns-vl3-scale-from-zero $nsc -- ping 172.16.0.0 -c2 -i 0.5 || exit` + "\n" + ` kubectl exec -n ns-vl3-scale-from-zero $nsc -- ping 172.16.1.0 -c2 -i 0.5 || exit` + "\n" + `done` + "\n" + `)`) +} +func (s *Suite) TestWebhook() { + r := s.Runner("../deployments-k8s/examples/features/webhook") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-webhook`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/webhook?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod -l app=nse-kernel -n ns-webhook`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nettools -n ns-webhook`) + r.Run(`kubectl exec pods/nettools -n ns-webhook -- curl 172.16.1.100:80 | grep -o "Welcome to nginx!"`) +} diff --git a/suites/heal/suite.gen.go b/suites/heal/suite.gen.go new file mode 100755 index 0000000000..eeacec48aa --- /dev/null +++ b/suites/heal/suite.gen.go @@ -0,0 +1,530 @@ +// Code generated by gotestmd DO NOT EDIT. +package heal + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/basic" +) + +type Suite struct { + base.Suite + basicSuite basic.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.basicSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) TestDataplane_interrupt() { + r := s.Runner("../deployments-k8s/examples/heal/dataplane-interrupt") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-dataplane-interrupt`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/dataplane-interrupt?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-dataplane-interrupt`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-dataplane-interrupt`) + r.Run(`kubectl exec pods/alpine -n ns-dataplane-interrupt -- ping -c 4 172.16.1.100 -I 172.16.1.101`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-dataplane-interrupt -- ping -c 4 172.16.1.101 -I 172.16.1.100`) + r.Run(`PINGER_PATH=/tmp/done-${RANDOM}` + "\n" + `kubectl exec pods/alpine -n ns-dataplane-interrupt -- sh -c '` + "\n" + ` PINGER_PATH=$1; rm -f "$PINGER_PATH"` + "\n" + ` seq=0` + "\n" + ` ping -i 0.2 172.16.1.100 -I 172.16.1.101 | while :; do` + "\n" + ` read -t 1 line || { echo ping timeout; touch $PINGER_PATH; break; }` + "\n" + ` seq1=$(echo $line | sed -n "s/.* seq=\([0-9]\+\) .*/\1/p")` + "\n" + ` [ "$seq1" ] || continue` + "\n" + ` [ "$seq" -eq "$seq1" ] || { echo missing $((seq1 - seq)) pings; touch $PINGER_PATH; break; }` + "\n" + ` seq=$((seq1+1))` + "\n" + ` done` + "\n" + `' - "$PINGER_PATH" &` + "\n" + `sleep 5` + "\n" + `kubectl exec pods/alpine -n ns-dataplane-interrupt -- test ! -f /tmp/done || { echo pinger is done; false; }`) + r.Run(`kubectl exec pods/alpine -n ns-dataplane-interrupt -- ip link set nsm-1 down`) + r.Run(`kubectl exec pods/alpine -n ns-dataplane-interrupt -- sh -c 'timeout 10 sh -c "while ! [ -f \"$1\" ];do sleep 1; done"' - "$PINGER_PATH"`) + r.Run(`kubectl exec pods/alpine -n ns-dataplane-interrupt -- ping -c 4 172.16.1.100 -I 172.16.1.101`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-dataplane-interrupt -- ping -c 4 172.16.1.101 -I 172.16.1.100`) +} +func (s *Suite) TestLocal_forwarder_death() { + r := s.Runner("../deployments-k8s/examples/heal/local-forwarder-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-forwarder-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-forwarder-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-forwarder-death`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-forwarder-death`) + r.Run(`kubectl exec pods/alpine -n ns-local-forwarder-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-forwarder-death -- ping -c 4 172.16.1.101`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=alpine -n ns-local-forwarder-death --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod -n nsm-system ${FORWARDER}`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-local-forwarder-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-forwarder-death -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestLocal_forwarder_remote_forwarder() { + r := s.Runner("../deployments-k8s/examples/heal/local-forwarder-remote-forwarder") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-forwarder-remote-forwarder`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-forwarder-remote-forwarder?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-forwarder-remote-forwarder`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-forwarder-remote-forwarder`) + r.Run(`kubectl exec pods/alpine -n ns-local-forwarder-remote-forwarder -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-forwarder-remote-forwarder -- ping -c 4 172.16.1.101`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=alpine -n ns-local-forwarder-remote-forwarder --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')` + "\n" + `NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-local-forwarder-remote-forwarder --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER1=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER2=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${FORWARDER1} -n nsm-system`) + r.Run(`kubectl delete pod ${FORWARDER2} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-local-forwarder-remote-forwarder -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-forwarder-remote-forwarder -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestLocal_nse_death() { + r := s.Runner("../deployments-k8s/examples/heal/local-nse-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nse-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nse-death/nse-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-nse-death`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-nse-death`) + r.Run(`kubectl exec pods/alpine -n ns-local-nse-death -- ping -c 4 172.16.1.100 -I 172.16.1.101`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nse-death -- ping -c 4 172.16.1.101 -I 172.16.1.100`) + r.Run(`kubectl scale deployment nse-kernel -n ns-local-nse-death --replicas=0`) + r.Run(`kubectl exec pods/alpine -n ns-local-nse-death -- ping -c 4 172.16.1.100 -I 172.16.1.101 2>&1 | egrep "100% packet loss|Network unreachable|can't set multicast source"`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nse-death/nse-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl scale deployment nse-kernel -n ns-local-nse-death --replicas=1`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -l version=new -n ns-local-nse-death`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-kernel -l version=new -n ns-local-nse-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-local-nse-death -- ping -c 4 172.16.1.102 -I 172.16.1.103`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-local-nse-death -- ping -c 4 172.16.1.103 -I 172.16.1.102`) +} +func (s *Suite) TestLocal_nsm_system_restart() { + r := s.Runner("../deployments-k8s/examples/heal/local-nsm-system-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nsm-system-restart`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsm-system-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-nsm-system-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-nsm-system-restart`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsm-system-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsm-system-restart -- ping -c 4 172.16.1.101`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/basic?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsm-system-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsm-system-restart -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestLocal_nsmgr_local_forwarder_memif() { + r := s.Runner("../deployments-k8s/examples/heal/local-nsmgr-local-forwarder-memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nsmgr-local-forwarder-memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsmgr-local-forwarder-memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-local-nsmgr-local-forwarder-memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-local-nsmgr-local-forwarder-memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-local-nsmgr-local-forwarder-memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-local-nsmgr-local-forwarder-memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=nsc-memif -n ns-local-nsmgr-local-forwarder-memif --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl delete pod ${FORWARDER} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-local-nsmgr-local-forwarder-memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-local-nsmgr-local-forwarder-memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestLocal_nsmgr_local_nse_memif() { + r := s.Runner("../deployments-k8s/examples/heal/local-nsmgr-local-nse-memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nsmgr-local-nse-memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsmgr-local-nse-memif/nse-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-local-nsmgr-local-nse-memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-local-nsmgr-local-nse-memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n ns-local-nsmgr-local-nse-memif -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n ns-local-nsmgr-local-nse-memif -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`kubectl delete deployment nse-memif -n ns-local-nsmgr-local-nse-memif`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=nsc-memif -n ns-local-nsmgr-local-nse-memif --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsmgr-local-nse-memif/nse-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -l version=new -n ns-local-nsmgr-local-nse-memif`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-memif -l version=new -n ns-local-nsmgr-local-nse-memif --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n ns-local-nsmgr-local-nse-memif -- vppctl ping 172.16.1.102 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec "${NEW_NSE}" -n "ns-local-nsmgr-local-nse-memif" -- vppctl ping 172.16.1.103 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestLocal_nsmgr_remote_nsmgr() { + r := s.Runner("../deployments-k8s/examples/heal/local-nsmgr-remote-nsmgr") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nsmgr-remote-nsmgr`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsmgr-remote-nsmgr?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-nsmgr-remote-nsmgr`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-nsmgr-remote-nsmgr`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsmgr-remote-nsmgr -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsmgr-remote-nsmgr -- ping -c 4 172.16.1.101`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=alpine -n ns-local-nsmgr-remote-nsmgr --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')` + "\n" + `NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-local-nsmgr-remote-nsmgr --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR1=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR2=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR1} -n nsm-system`) + r.Run(`kubectl delete pod ${NSMGR2} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsmgr-remote-nsmgr -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsmgr-remote-nsmgr -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestLocal_nsmgr_restart() { + r := s.Runner("../deployments-k8s/examples/heal/local-nsmgr-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-local-nsmgr-restart`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/local-nsmgr-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-local-nsmgr-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-local-nsmgr-restart`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsmgr-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsmgr-restart -- ping -c 4 172.16.1.101`) + r.Run(`NSC_NODE=$(kubectl get pods -l app=alpine -n ns-local-nsmgr-restart --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSC_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-local-nsmgr-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-local-nsmgr-restart -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRegistry_local_endpoint() { + r := s.Runner("../deployments-k8s/examples/heal/registry-local-endpoint") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-registry-local-endpoint`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-local-endpoint/nse-first?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-registry-local-endpoint`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-registry-local-endpoint`) + r.Run(`kubectl exec pods/alpine -n ns-registry-local-endpoint -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-local-endpoint -- ping -c 4 172.16.1.101`) + r.Run(`REGISTRY=$(kubectl get pods -l app=registry -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${REGISTRY} -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-local-endpoint/nse-second?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=registry -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -l version=new -n ns-registry-local-endpoint`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-kernel -l version=new -n ns-registry-local-endpoint --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-registry-local-endpoint -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-registry-local-endpoint -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRegistry_remote_forwarder() { + r := s.Runner("../deployments-k8s/examples/heal/registry-remote-forwarder") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-registry-remote-forwarder`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-remote-forwarder?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-registry-remote-forwarder`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-registry-remote-forwarder`) + r.Run(`kubectl exec pods/alpine -n ns-registry-remote-forwarder -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-remote-forwarder -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-registry-remote-forwarder --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`REGISTRY=$(kubectl get pods -l app=registry -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${REGISTRY} -n nsm-system`) + r.Run(`kubectl delete pod ${FORWARDER} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=registry -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-registry-remote-forwarder -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-remote-forwarder -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRegistry_remote_nsmgr() { + r := s.Runner("../deployments-k8s/examples/heal/registry-remote-nsmgr") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-registry-remote-nsmgr`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-remote-nsmgr?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-registry-remote-nsmgr`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-registry-remote-nsmgr`) + r.Run(`kubectl exec pods/alpine -n ns-registry-remote-nsmgr -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-remote-nsmgr -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-registry-remote-nsmgr --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`REGISTRY=$(kubectl get pods -l app=registry -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${REGISTRY} -n nsm-system`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=registry -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-registry-remote-nsmgr -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-remote-nsmgr -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRegistry_restart() { + r := s.Runner("../deployments-k8s/examples/heal/registry-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-registry-restart`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-restart/registry-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-registry-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-registry-restart`) + r.Run(`NSC=$(kubectl get pods -l app=alpine -n ns-registry-restart --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`NSE=$(kubectl get pods -l app=nse-kernel -n ns-registry-restart --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-registry-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-restart -- ping -c 4 172.16.1.101`) + r.Run(`REGISTRY=$(kubectl get pods -l app=registry -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${REGISTRY} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=registry -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/registry-restart/registry-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine-new -n ns-registry-restart`) + r.Run(`kubectl exec pods/alpine-new -n ns-registry-restart -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-registry-restart -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRemote_forwarder_death() { + r := s.Runner("../deployments-k8s/examples/heal/remote-forwarder-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-forwarder-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-forwarder-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-forwarder-death`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-forwarder-death`) + r.Run(`kubectl exec pods/alpine -n ns-remote-forwarder-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-forwarder-death -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-remote-forwarder-death --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod -n nsm-system ${FORWARDER}`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-remote-forwarder-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-forwarder-death -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRemote_forwarder_death_ip() { + r := s.Runner("../deployments-k8s/examples/heal/remote-forwarder-death-ip") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-forwarder-death-ip`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-forwarder-death-ip?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-forwarder-death-ip`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-forwarder-death-ip`) + r.Run(`kubectl exec pods/alpine -n ns-remote-forwarder-death-ip -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-forwarder-death-ip -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-remote-forwarder-death-ip --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod -n nsm-system ${FORWARDER}`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-remote-forwarder-death-ip -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-forwarder-death-ip -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRemote_nse_death() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nse-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nse-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nse-death/nse-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nse-death`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nse-death`) + r.Run(`NSC=$(kubectl get pods -l app=alpine -n ns-remote-nse-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`NSE=$(kubectl get pods -l app=nse-kernel -n ns-remote-nse-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nse-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nse-death -- ping -c 4 172.16.1.101`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nse-death/nse-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -l version=new -n ns-remote-nse-death`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-kernel -l version=new -n ns-remote-nse-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nse-death -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-remote-nse-death -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRemote_nse_death_ip() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nse-death-ip") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nse-death-ip`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nse-death-ip/nse-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nse-death-ip`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nse-death-ip`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nse-death-ip -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nse-death-ip -- ping -c 4 172.16.1.101`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nse-death-ip/nse-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -l version=new -n ns-remote-nse-death-ip`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-kernel -l version=new -n ns-remote-nse-death-ip --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nse-death-ip -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-remote-nse-death-ip -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRemote_nsm_system_restart_memif_ip() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nsm-system-restart-memif-ip") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nsm-system-restart-memif-ip`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsm-system-restart-memif-ip?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-remote-nsm-system-restart-memif-ip`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-remote-nsm-system-restart-memif-ip`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n ns-remote-nsm-system-restart-memif-ip -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n ns-remote-nsm-system-restart-memif-ip -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + r.Run(`kubectl create ns nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/basic?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n ns-remote-nsm-system-restart-memif-ip -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n ns-remote-nsm-system-restart-memif-ip -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestRemote_nsmgr_death() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nsmgr-death") + s.T().Cleanup(func() { + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/apps/nsmgr?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4 -n nsm-system`) + r.Run(`kubectl delete ns ns-remote-nsmgr-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-death/remote-nse?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nsmgr-death`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nsmgr-death`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-death -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-death -- ping -c 4 172.16.1.101`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-death/nsmgr-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-death/local-nse?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l nse-version=local -n ns-remote-nsmgr-death`) + r.Run(`NEW_NSE=$(kubectl get pods -l nse-version=local -n ns-remote-nsmgr-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-death -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-remote-nsmgr-death -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRemote_nsmgr_remote_endpoint() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nsmgr-remote-endpoint") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nsmgr-remote-endpoint`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-remote-endpoint/nsmgr-before-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nsmgr-remote-endpoint`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nsmgr-remote-endpoint`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-remote-endpoint -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-remote-endpoint -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-remote-nsmgr-remote-endpoint --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-remote-endpoint/nsmgr-after-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -l version=new -n ns-remote-nsmgr-remote-endpoint`) + r.Run(`NEW_NSE=$(kubectl get pods -l app=nse-kernel -l version=new -n ns-remote-nsmgr-remote-endpoint --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-remote-endpoint -- ping -c 4 172.16.1.102`) + r.Run(`kubectl exec ${NEW_NSE} -n ns-remote-nsmgr-remote-endpoint -- ping -c 4 172.16.1.103`) +} +func (s *Suite) TestRemote_nsmgr_restart() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nsmgr-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nsmgr-restart`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nsmgr-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nsmgr-restart`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-restart -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-remote-nsmgr-restart --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-restart -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestRemote_nsmgr_restart_ip() { + r := s.Runner("../deployments-k8s/examples/heal/remote-nsmgr-restart-ip") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-remote-nsmgr-restart-ip`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/remote-nsmgr-restart-ip?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-remote-nsmgr-restart-ip`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-remote-nsmgr-restart-ip`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-restart-ip -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-restart-ip -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-remote-nsmgr-restart-ip --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')`) + r.Run(`NSMGR=$(kubectl get pods -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl delete pod ${NSMGR} -n nsm-system`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsmgr --field-selector spec.nodeName==${NSE_NODE} -n nsm-system`) + r.Run(`kubectl exec pods/alpine -n ns-remote-nsmgr-restart-ip -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-remote-nsmgr-restart-ip -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestSpire_agent_restart() { + r := s.Runner("../deployments-k8s/examples/heal/spire-agent-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-spire-agent-restart`) + }) + r.Run(`kubectl create ns ns-spire-agent-restart`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/spire-agent-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-spire-agent-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-spire-agent-restart`) + r.Run(`kubectl exec pods/alpine -n ns-spire-agent-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-agent-restart -- ping -c 4 172.16.1.101`) + r.Run(`AGENTS=$(kubectl get pods -l app=spire-agent -n spire --template '{{range .items}}{{.metadata.name}}{{" "}}{{end}}')`) + r.Run(`kubectl delete pod $AGENTS -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-agent -n spire`) + r.Run(`kubectl exec pods/alpine -n ns-spire-agent-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-agent-restart -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestSpire_server_agent_restart() { + r := s.Runner("../deployments-k8s/examples/heal/spire-server-agent-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-spire-server-agent-restart`) + }) + r.Run(`kubectl create ns ns-spire-server-agent-restart`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/spire-server-agent-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-spire-server-agent-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-spire-server-agent-restart`) + r.Run(`kubectl exec pods/alpine -n ns-spire-server-agent-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-server-agent-restart -- ping -c 4 172.16.1.101`) + r.Run(`AGENTS=$(kubectl get pods -l app=spire-agent -n spire --template '{{range .items}}{{.metadata.name}}{{" "}}{{end}}')`) + r.Run(`kubectl delete pod spire-server-0 -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-server -n spire`) + r.Run(`kubectl delete pod $AGENTS -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-agent -n spire`) + r.Run(`kubectl exec pods/alpine -n ns-spire-server-agent-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-server-agent-restart -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestSpire_server_restart() { + r := s.Runner("../deployments-k8s/examples/heal/spire-server-restart") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-spire-server-restart`) + }) + r.Run(`kubectl create ns ns-spire-server-restart`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/spire-server-restart?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-spire-server-restart`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-spire-server-restart`) + r.Run(`kubectl exec pods/alpine -n ns-spire-server-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-server-restart -- ping -c 4 172.16.1.101`) + r.Run(`kubectl delete pod spire-server-0 -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-server -n spire`) + r.Run(`kubectl exec pods/alpine -n ns-spire-server-restart -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-server-restart -- ping -c 4 172.16.1.101`) + r.Run(`AGENTS=$(kubectl get pods -l app=spire-agent -n spire --template '{{range .items}}{{.metadata.name}}{{" "}}{{end}}')`) + r.Run(`kubectl delete pod $AGENTS -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-agent -n spire`) +} +func (s *Suite) TestSpire_upgrade() { + r := s.Runner("../deployments-k8s/examples/heal/spire-upgrade") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-spire-upgrade`) + }) + r.Run(`kubectl create ns ns-spire-upgrade`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/spire-upgrade?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ns-spire-upgrade`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-spire-upgrade`) + r.Run(`kubectl exec pods/alpine -n ns-spire-upgrade -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-upgrade -- ping -c 4 172.16.1.101`) + r.Run(`kubectl delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl delete ns spire`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/single_cluster?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-server -n spire`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=spire-agent -n spire`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/single_cluster/clusterspiffeid-template.yaml`) + r.Run(`kubectl exec pods/alpine -n ns-spire-upgrade -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-spire-upgrade -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestVl3_nscs_death() { + r := s.Runner("../deployments-k8s/examples/heal/vl3-nscs-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-vl3-nscs-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/vl3-nscs-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n ns-vl3-nscs-death --for=condition=ready --timeout=1m pod -l app=alpine`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-nscs-death)` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3-nscs-death $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3-nscs-death -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`kubectl scale -n ns-vl3-nscs-death deployment alpine --replicas=0`) + r.Run(`kubectl wait -n ns-vl3-nscs-death --for=delete --timeout=1m pod -l app=alpine`) + r.Run(`kubectl scale -n ns-vl3-nscs-death deployment alpine --replicas=2`) + r.Run(`kubectl wait -n ns-vl3-nscs-death --for=condition=ready --timeout=1m pod -l app=alpine`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-nscs-death)` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3-nscs-death $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3-nscs-death -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) +} +func (s *Suite) TestVl3_nse_death() { + r := s.Runner("../deployments-k8s/examples/heal/vl3-nse-death") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-vl3-nse-death`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/heal/vl3-nse-death?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n ns-vl3-nse-death --for=condition=ready --timeout=1m pod -l app=alpine`) + r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3-nse-death) ` + "\n" + `[[ ! -z $nscs ]]`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3-nse-death $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3-nse-death -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) + r.Run(`NSE=($(kubectl get pods -l app=nse-vl3-vpp -n ns-vl3-nse-death --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')[0])`) + r.Run(`kubectl delete pod -n ns-vl3-nse-death ${NSE}`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-vl3-vpp -n ns-vl3-nse-death`) + r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3-nse-death $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3-nse-death -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`) +} diff --git a/suites/interdomain/dns/suite.gen.go b/suites/interdomain/dns/suite.gen.go new file mode 100755 index 0000000000..f28c4268cd --- /dev/null +++ b/suites/interdomain/dns/suite.gen.go @@ -0,0 +1,37 @@ +// Code generated by gotestmd DO NOT EDIT. +package dns + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/interdomain/dns") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete service -n kube-system exposed-kube-dns` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete service -n kube-system exposed-kube-dns`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 expose service kube-dns -n kube-system --port=53 --target-port=53 --protocol=TCP --name=exposed-kube-dns --type=LoadBalancer`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "ip"}}'` + "\n" + `ip1=$(kubectl --kubeconfig=$KUBECONFIG1 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "ip"}}')` + "\n" + `if [[ $ip1 == *"no value"* ]]; then ` + "\n" + ` ip1=$(kubectl --kubeconfig=$KUBECONFIG1 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "hostname"}}')` + "\n" + ` ip1=$(dig +short $ip1 | head -1)` + "\n" + `fi` + "\n" + `# if IPv6` + "\n" + `if [[ $ip1 =~ ":" ]]; then ip1=[$ip1]; fi` + "\n" + `` + "\n" + `echo Selected externalIP: $ip1 for cluster1`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 expose service kube-dns -n kube-system --port=53 --target-port=53 --protocol=TCP --name=exposed-kube-dns --type=LoadBalancer`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "ip"}}'` + "\n" + `ip2=$(kubectl --kubeconfig=$KUBECONFIG2 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "ip"}}')` + "\n" + `if [[ $ip2 == *"no value"* ]]; then ` + "\n" + ` ip2=$(kubectl --kubeconfig=$KUBECONFIG2 get services exposed-kube-dns -n kube-system -o go-template='{{index (index (index (index .status "loadBalancer") "ingress") 0) "hostname"}}')` + "\n" + ` ip2=$(dig +short $ip2 | head -1)` + "\n" + `fi` + "\n" + `# if IPv6` + "\n" + `if [[ $ip2 =~ ":" ]]; then ip2=[$ip2]; fi` + "\n" + `` + "\n" + `echo Selected externalIP: $ip2 for cluster2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -f - <Simple Bookstore App"`) +} +func (s *Suite) Test() {} diff --git a/suites/interdomain/spiffe_federation/suite.gen.go b/suites/interdomain/spiffe_federation/suite.gen.go new file mode 100755 index 0000000000..482d321109 --- /dev/null +++ b/suites/interdomain/spiffe_federation/suite.gen.go @@ -0,0 +1,30 @@ +// Code generated by gotestmd DO NOT EDIT. +package spiffe_federation + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/interdomain/spiffe_federation") + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/spiffe_federation/cluster1-spiffeid-template.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/spiffe_federation/cluster2-spiffeid-template.yaml`) + r.Run(`bundle1=$(kubectl --kubeconfig=$KUBECONFIG1 exec spire-server-0 -n spire -- bin/spire-server bundle show -format spiffe)` + "\n" + `bundle2=$(kubectl --kubeconfig=$KUBECONFIG2 exec spire-server-0 -n spire -- bin/spire-server bundle show -format spiffe)`) + r.Run(`echo $bundle2 | kubectl --kubeconfig=$KUBECONFIG1 exec -i spire-server-0 -n spire -- bin/spire-server bundle set -format spiffe -id "spiffe://nsm.cluster2"` + "\n" + `echo $bundle1 | kubectl --kubeconfig=$KUBECONFIG2 exec -i spire-server-0 -n spire -- bin/spire-server bundle set -format spiffe -id "spiffe://nsm.cluster1"`) +} +func (s *Suite) Test() {} diff --git a/suites/interdomain/suite.gen.go b/suites/interdomain/suite.gen.go new file mode 100755 index 0000000000..9da262a6a6 --- /dev/null +++ b/suites/interdomain/suite.gen.go @@ -0,0 +1,163 @@ +// Code generated by gotestmd DO NOT EDIT. +package interdomain + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/interdomain/dns" + "github.com/networkservicemesh/integration-tests/suites/interdomain/loadbalancer" + "github.com/networkservicemesh/integration-tests/suites/interdomain/nsm" + "github.com/networkservicemesh/integration-tests/suites/interdomain/spiffe_federation" + "github.com/networkservicemesh/integration-tests/suites/spire/cluster1" + "github.com/networkservicemesh/integration-tests/suites/spire/cluster2" +) + +type Suite struct { + base.Suite + loadbalancerSuite loadbalancer.Suite + dnsSuite dns.Suite + cluster1Suite cluster1.Suite + cluster2Suite cluster2.Suite + spiffe_federationSuite spiffe_federation.Suite + nsmSuite nsm.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.loadbalancerSuite, &s.dnsSuite, &s.cluster1Suite, &s.cluster2Suite, &s.spiffe_federationSuite, &s.nsmSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) TestNsm_consul() { + r := s.Runner("../deployments-k8s/examples/interdomain/nsm_consul") + s.T().Cleanup(func() { + r.Run(`pkill -f "port-forward"`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/server/counting_nsm.yaml` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 delete -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/client/dashboard.yaml` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/interdomain/nsm_consul/nse-auto-scale-client?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/interdomain/nsm_consul/nse-auto-scale-server?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/service.yaml` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/server/counting_service.yaml` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/netsvc.yaml` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete pods --all`) + r.Run(`consul-k8s uninstall --kubeconfig=$KUBECONFIG2 -auto-approve=true -wipe-data=true`) + }) + r.Run(`curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -`) + r.Run(`sudo apt-add-repository -y "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"`) + r.Run(`sudo apt-get update && sudo apt-get install -y consul-k8s=0.48.0-1`) + r.Run(`consul-k8s version`) + r.Run(`consul-k8s install -config-file=helm-consul-values.yaml -set global.image=hashicorp/consul:1.12.0 -auto-approve --kubeconfig=$KUBECONFIG2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/server/counting_service.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/server/counting.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/netsvc.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/interdomain/nsm_consul/nse-auto-scale-client?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/interdomain/nsm_consul/nse-auto-scale-server?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/service.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/client/dashboard.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --timeout=10m --for=condition=ready pod -l app=dashboard-nsc`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pod/dashboard-nsc -c cmd-nsc -- apk add curl`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pod/dashboard-nsc -c cmd-nsc -- curl counting:9001`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 port-forward pod/dashboard-nsc 9002:9002 &`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete deploy counting`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/interdomain/nsm_consul/server/counting_nsm.yaml`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --timeout=5m --for=condition=ready pod -l app=counting`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pod/dashboard-nsc -c cmd-nsc -- curl counting:9001`) +} +func (s *Suite) TestNsm_consul_vl3() { + r := s.Runner("../deployments-k8s/examples/interdomain/nsm_consul_vl3") + s.T().Cleanup(func() { + r.Run(`pkill -f "port-forward"` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 delete -n ns-nsm-consul-vl3 -k ./cluster1` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete -n ns-nsm-consul-vl3 -k ./cluster2`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k ./cluster1` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 apply -k ./cluster2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=nse-vl3-vpp -n ns-nsm-consul-vl3` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=vl3-ipam -n ns-nsm-consul-vl3` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l name=control-plane -n ns-nsm-consul-vl3` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod counting -n ns-nsm-consul-vl3` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=5m pod dashboard -n ns-nsm-consul-vl3`) + r.Run(`export CP=$(kubectl --kubeconfig=$KUBECONFIG1 get pods -n ns-nsm-consul-vl3 -l name=control-plane --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`ENCRYPTION_KEY=$(kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec ${CP} -c ubuntu -- /bin/sh -c 'consul keygen')`) + r.Run(`CP_IP_VL3_ADDRESS=$(kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec ${CP} -c ubuntu -- ifconfig nsm-1 | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec ${CP} -c ubuntu -- consul tls ca create`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec ${CP} -c ubuntu -- consul tls cert create -server -dc dc1`) + r.Run(`cat > consul.hcl < server.hcl </dev/null 2>&1 &'`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec ${CP} -c ubuntu -- consul members`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'apt update & apt upgrade -y'` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- apt-get install curl gnupg sudo lsb-release net-tools iproute2 apt-utils systemctl -y`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'curl --fail --silent --show-error --location https://apt.releases.hashicorp.com/gpg | \` + "\n" + ` gpg --dearmor | \` + "\n" + ` sudo dd of=/usr/share/keyrings/hashicorp-archive-keyring.gpg '`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \` + "\n" + ` sudo tee -a /etc/apt/sources.list.d/hashicorp.list'`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- sudo apt-get update`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- sudo apt-get install consul=1.12.0-1`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- consul version`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'curl -L https://func-e.io/install.sh | bash -s -- -b /usr/local/bin'` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'export FUNC_E_PLATFORM=linux/amd64'` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'func-e use 1.22.2'` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- /bin/bash -c 'sudo cp ~/.func-e/versions/1.22.2/bin/envoy /usr/bin/'`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- envoy --version`) + r.Run(`COUNTING_IP_VL3_ADDRESS=$(kubectl --kubeconfig=$KUBECONFIG1 -n ns-nsm-consul-vl3 exec counting -c ubuntu -- ifconfig nsm-1 | grep -Eo 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 6-)`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 cp ns-nsm-consul-vl3/${CP}:consul-agent-ca.pem consul-agent-ca.pem` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 cp ns-nsm-consul-vl3/${CP}:consul-agent-ca-key.pem consul-agent-ca-key.pem` + "\n" + `` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 cp consul-agent-ca.pem ns-nsm-consul-vl3/counting:/etc/consul.d` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 cp consul-agent-ca-key.pem ns-nsm-consul-vl3/counting:/etc/consul.d`) + r.Run(`cat > consul-counting.hcl < consul.service < counting.hcl < consul-envoy.service < consul-dashboard.hcl < consul.service < dashboard.hcl < consul-envoy.service < control-plane.yaml`) + r.Run(`cat > kustomization.yaml < /etc/resolv.conf"`) + r.Run(`cat > coredns-config << EOF` + "\n" + `.:53 {` + "\n" + ` bind 127.0.1.1` + "\n" + ` log` + "\n" + ` errors` + "\n" + ` ready` + "\n" + ` file dnsentries.db` + "\n" + ` forward . /etc/resolv_init.conf {` + "\n" + ` max_concurrent 1000` + "\n" + ` }` + "\n" + ` loop` + "\n" + ` reload 5s` + "\n" + `}` + "\n" + `k8s.nsm:53 {` + "\n" + ` bind 127.0.1.1` + "\n" + ` log` + "\n" + ` forward . ${ipk8s}:53 {` + "\n" + ` force_tcp` + "\n" + ` }` + "\n" + ` reload 5s` + "\n" + `}` + "\n" + `EOF`) + r.Run(`cat > dnsentries.db << EOF` + "\n" + `@ 3600 IN SOA docker.nsm. . (` + "\n" + ` 2017042745 ; serial` + "\n" + ` 7200 ; refresh (2 hours)` + "\n" + ` 3600 ; retry (1 hour)` + "\n" + ` 1209600 ; expire (2 weeks)` + "\n" + ` 3600 ; minimum (1 hour)` + "\n" + ` )` + "\n" + `spire-server.spire.docker.nsm IN A ${ipdock}` + "\n" + `EOF`) + r.Run(`docker cp coredns-config nsc-simple-docker:/`) + r.Run(`docker cp dnsentries.db nsc-simple-docker:/`) + r.Run(`docker exec -d nsc-simple-docker coredns -conf coredns-config`) +} +func (s *Suite) Test() {} diff --git a/suites/k8s_monolith/external_nsc/docker/suite.gen.go b/suites/k8s_monolith/external_nsc/docker/suite.gen.go new file mode 100755 index 0000000000..317ae6b1c7 --- /dev/null +++ b/suites/k8s_monolith/external_nsc/docker/suite.gen.go @@ -0,0 +1,33 @@ +// Code generated by gotestmd DO NOT EDIT. +package docker + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/k8s_monolith/external_nsc/docker") + s.T().Cleanup(func() { + r.Run(`docker compose -f docker-compose.yaml -f docker-compose.override.yaml down`) + r.Run(`rm docker-compose.yaml`) + }) + r.Run(`cat > docker-compose.override.yaml < /etc/resolv.conf"`) + r.Run(`cat > coredns-config << EOF` + "\n" + `.:53 {` + "\n" + ` bind 127.0.1.1` + "\n" + ` log` + "\n" + ` errors` + "\n" + ` ready` + "\n" + ` file dnsentries.db` + "\n" + ` forward . /etc/resolv_init.conf {` + "\n" + ` max_concurrent 1000` + "\n" + ` }` + "\n" + ` loop` + "\n" + ` reload 5s` + "\n" + `}` + "\n" + `k8s.nsm:53 {` + "\n" + ` bind 127.0.1.1` + "\n" + ` log` + "\n" + ` forward . ${ipk8s}:53 {` + "\n" + ` force_tcp` + "\n" + ` }` + "\n" + ` reload 5s` + "\n" + `}` + "\n" + `EOF`) + r.Run(`cat > dnsentries.db << EOF` + "\n" + `@ 3600 IN SOA docker.nsm. . (` + "\n" + ` 2017042745 ; serial` + "\n" + ` 7200 ; refresh (2 hours)` + "\n" + ` 3600 ; retry (1 hour)` + "\n" + ` 1209600 ; expire (2 weeks)` + "\n" + ` 3600 ; minimum (1 hour)` + "\n" + ` )` + "\n" + `spire-server.spire.docker.nsm IN A ${ipdock}` + "\n" + `EOF`) + r.Run(`docker cp coredns-config nse-simple-vl3-docker:/`) + r.Run(`docker cp dnsentries.db nse-simple-vl3-docker:/`) + r.Run(`docker exec -d nse-simple-vl3-docker coredns -conf coredns-config`) +} +func (s *Suite) Test() {} diff --git a/suites/k8s_monolith/external_nse/docker/suite.gen.go b/suites/k8s_monolith/external_nse/docker/suite.gen.go new file mode 100755 index 0000000000..9354a31c15 --- /dev/null +++ b/suites/k8s_monolith/external_nse/docker/suite.gen.go @@ -0,0 +1,33 @@ +// Code generated by gotestmd DO NOT EDIT. +package docker + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/k8s_monolith/external_nse/docker") + s.T().Cleanup(func() { + r.Run(`docker compose -f docker-compose.yaml -f docker-compose.override.yaml down`) + r.Run(`rm docker-compose.yaml`) + }) + r.Run(`cat > docker-compose.override.yaml <&2` + "\n" + ` false` + "\n" + `else` + "\n" + ` echo "success: port :80 is unavailable"` + "\n" + `fi`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec deployments/nse-kernel -n ns-interdomain-nse-composition -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestFloating_vl3_basic() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/floating_vl3-basic") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-basic/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-floating-vl3-basic`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-floating-vl3-basic`) + r.Run(`ipAddr2=$(kubectl --kubeconfig=$KUBECONFIG2 exec -n ns-floating-vl3-basic pods/alpine -- ifconfig nsm-1)` + "\n" + `ipAddr2=$(echo $ipAddr2 | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 $ipAddr2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 172.16.0.0` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 172.16.1.0`) + r.Run(`ipAddr1=$(kubectl --kubeconfig=$KUBECONFIG1 exec -n ns-floating-vl3-basic pods/alpine -- ifconfig nsm-1)` + "\n" + `ipAddr1=$(echo $ipAddr1 | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 $ipAddr1`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 172.16.0.0` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-basic -- ping -c 4 172.16.1.0`) +} +func (s *Suite) TestFloating_vl3_dns() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/floating_vl3-dns") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=alpine -n ns-floating-vl3-dns`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-dns/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=5m pod -l app=alpine -n ns-floating-vl3-dns`) + r.Run(`nsc1=$(kubectl --kubeconfig=$KUBECONFIG1 get pods -l app=alpine -n ns-floating-vl3-dns --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`nse1=$(kubectl --kubeconfig=$KUBECONFIG1 get pods -l app=nse-vl3-vpp -n ns-floating-vl3-dns --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`nsc2=$(kubectl --kubeconfig=$KUBECONFIG2 get pods -l app=alpine -n ns-floating-vl3-dns --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`nse2=$(kubectl --kubeconfig=$KUBECONFIG2 get pods -l app=nse-vl3-vpp -n ns-floating-vl3-dns --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine-1 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nsc2.floating-vl3-dns.my.cluster3. -4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine-1 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nse2.floating-vl3-dns.my.cluster3. -4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine-1 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nse1.floating-vl3-dns.my.cluster3. -4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine-2 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nsc1.floating-vl3-dns.my.cluster3. -4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine-2 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nse1.floating-vl3-dns.my.cluster3. -4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine-2 -n ns-floating-vl3-dns -- ping -c2 -i 0.5 $nse2.floating-vl3-dns.my.cluster3. -4`) +} +func (s *Suite) TestFloating_vl3_scale_from_zero() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/floating_vl3-scale-from-zero/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-floating-vl3-scale-from-zero`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-floating-vl3-scale-from-zero`) + r.Run(`ipAddr2=$(kubectl --kubeconfig=$KUBECONFIG2 exec -n ns-floating-vl3-scale-from-zero pods/alpine -- ifconfig nsm-1)` + "\n" + `ipAddr2=$(echo $ipAddr2 | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 $ipAddr2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 172.16.0.0` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 172.16.1.0`) + r.Run(`ipAddr1=$(kubectl --kubeconfig=$KUBECONFIG1 exec -n ns-floating-vl3-scale-from-zero pods/alpine -- ifconfig nsm-1)` + "\n" + `ipAddr1=$(echo $ipAddr1 | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 $ipAddr1`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 172.16.0.0` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 exec pods/alpine -n ns-floating-vl3-scale-from-zero -- ping -c 4 172.16.1.0`) +} +func (s *Suite) TestInterdomain_kernel2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete ns ns-interdomain-kernel2ethernet2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete ns ns-interdomain-kernel2ethernet2kernel`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2Ethernet2Kernel/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-interdomain-kernel2ethernet2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2Ethernet2Kernel/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=alpine -n ns-interdomain-kernel2ethernet2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-interdomain-kernel2ethernet2kernel -- ping -c 4 172.16.1.2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec deployments/nse-kernel -n ns-interdomain-kernel2ethernet2kernel -- ping -c 4 172.16.1.3`) +} +func (s *Suite) TestInterdomain_kernel2ip2kernel() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2IP2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete ns ns-interdomain-kernel2ip2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete ns ns-interdomain-kernel2ip2kernel`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2IP2Kernel/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-interdomain-kernel2ip2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_Kernel2IP2Kernel/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=alpine -n ns-interdomain-kernel2ip2kernel`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/alpine -n ns-interdomain-kernel2ip2kernel -- ping -c 4 172.16.1.2`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 exec deployments/nse-kernel -n ns-interdomain-kernel2ip2kernel -- ping -c 4 172.16.1.3`) +} +func (s *Suite) TestInterdomain_dns() { + r := s.Runner("../deployments-k8s/examples/multicluster/usecases/interdomain_dns") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete ns ns-interdomain-dns`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete ns ns-interdomain-dns`) + }) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_dns/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multicluster/usecases/interdomain_dns/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait --for=condition=ready --timeout=5m pod -l app=dnsutils -n ns-interdomain-dns`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/dnsutils -c dnsutils -n ns-interdomain-dns -- nslookup -norec -nodef my.coredns.service`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/dnsutils -c dnsutils -n ns-interdomain-dns -- ping -c 4 my.coredns.service`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 exec pods/dnsutils -c dnsutils -n ns-interdomain-dns -- dig kubernetes.default A kubernetes.default AAAA | grep "kubernetes.default.svc.cluster.local"`) +} diff --git a/suites/multiforwarder/suite.gen.go b/suites/multiforwarder/suite.gen.go new file mode 100755 index 0000000000..b626212bd5 --- /dev/null +++ b/suites/multiforwarder/suite.gen.go @@ -0,0 +1,122 @@ +// Code generated by gotestmd DO NOT EDIT. +package multiforwarder + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/multiforwarder") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multiforwarder?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestKernel2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ethernet2kernel_vfio2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel_Vfio2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-kernel2ethernet2kernel-vfio2noop exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel-vfio2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel_Vfio2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio -n ns-kernel2ethernet2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-vfio -n ns-kernel2ethernet2kernel-vfio2noop`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-kernel2ethernet2kernel-vfio2noop exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel-vfio2noop -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel-vfio2noop -- ping -c 4 172.16.1.101`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} +func (s *Suite) TestKernel2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2kernel_vfio2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel_Vfio2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-kernel2kernel-vfio2noop exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-kernel2kernel-vfio2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel_Vfio2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio -n ns-kernel2kernel-vfio2noop`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-vfio -n ns-kernel2kernel-vfio2noop`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-kernel2kernel-vfio2noop exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel-vfio2noop -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel-vfio2noop -- ping -c 4 172.16.1.101`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} +func (s *Suite) TestMemif2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestSriovkernel2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/SriovKernel2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-sriov-kernel2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2Noop/ponger?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=ponger`) + r.Run(`kubectl -n ns-sriov-kernel2noop exec deploy/ponger -- ip a | grep "172.16.1.100"`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=nse-noop`) + r.Run(`kubectl -n ns-sriov-kernel2noop exec deployments/nsc-kernel -- ping -c 4 172.16.1.100`) +} +func (s *Suite) TestVfio2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/Vfio2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-vfio2noop exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-vfio2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Vfio2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-vfio2noop wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio`) + r.Run(`kubectl -n ns-vfio2noop wait --for=condition=ready --timeout=1m pod -l app=nse-vfio`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-vfio2noop exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} diff --git a/suites/multiforwarder_vlantag/suite.gen.go b/suites/multiforwarder_vlantag/suite.gen.go new file mode 100755 index 0000000000..3da6b9712f --- /dev/null +++ b/suites/multiforwarder_vlantag/suite.gen.go @@ -0,0 +1,122 @@ +// Code generated by gotestmd DO NOT EDIT. +package multiforwarder_vlantag + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/multiforwarder_vlantag") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/multiforwarder?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestKernel2ethernet2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2ethernet2kernel_vfio2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel_Vfio2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-kernel2ethernet2kernel-vfio2noopvlantag exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-kernel2ethernet2kernel-vfio2noopvlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel_Vfio2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio -n ns-kernel2ethernet2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-vfio -n ns-kernel2ethernet2kernel-vfio2noopvlantag`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-kernel2ethernet2kernel-vfio2noopvlantag exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel-vfio2noopvlantag -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel-vfio2noopvlantag -- ping -c 4 172.16.1.101`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} +func (s *Suite) TestKernel2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2kernel_vfio2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel_Vfio2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-kernel2kernel-vfio2noopvlantag exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-kernel2kernel-vfio2noopvlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel_Vfio2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio -n ns-kernel2kernel-vfio2noopvlantag`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-vfio -n ns-kernel2kernel-vfio2noopvlantag`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-kernel2kernel-vfio2noopvlantag exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel-vfio2noopvlantag -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel-vfio2noopvlantag -- ping -c 4 172.16.1.101`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} +func (s *Suite) TestMemif2memif() { + r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Memif") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-memif2memif`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Memif?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif`) + r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) + r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`) +} +func (s *Suite) TestSriovkernel2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-sriov-kernel2noop-vlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag/ponger?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=ponger`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag exec deploy/ponger -- ip a | grep "172.16.1.100"`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nse-noop`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag exec deployments/nsc-kernel -- ping -c 4 172.16.1.100`) +} +func (s *Suite) TestVfio2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/Vfio2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-vfio2noop-vlantag exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-vfio2noop-vlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Vfio2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-vfio2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio`) + r.Run(`kubectl -n ns-vfio2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nse-vfio`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-vfio2noop-vlantag exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} diff --git a/suites/observability/suite.gen.go b/suites/observability/suite.gen.go new file mode 100755 index 0000000000..c82b488c62 --- /dev/null +++ b/suites/observability/suite.gen.go @@ -0,0 +1,48 @@ +// Code generated by gotestmd DO NOT EDIT. +package observability + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) TestJaeger_and_prometheus() { + r := s.Runner("../deployments-k8s/examples/observability/jaeger-and-prometheus") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-jaeger-and-prometheus`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + r.Run(`kubectl describe pods -n observability` + "\n" + `kubectl delete ns observability` + "\n" + `pkill -f "port-forward"`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/observability/jaeger-and-prometheus?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n observability --timeout=1m --for=condition=ready pod -l app=opentelemetry`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/observability/jaeger-and-prometheus/nsm-system?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/observability/jaeger-and-prometheus/example?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-jaeger-and-prometheus`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-jaeger-and-prometheus`) + r.Run(`kubectl exec pods/alpine -n ns-jaeger-and-prometheus -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-jaeger-and-prometheus -- ping -c 4 172.16.1.101`) + r.Run(`NSE_NODE=$(kubectl get pods -l app=nse-kernel -n ns-jaeger-and-prometheus --template '{{range .items}}{{.spec.nodeName}}{{"\n"}}{{end}}')` + "\n" + `FORWARDER=$(kubectl get pods -l app=forwarder-vpp --field-selector spec.nodeName==${NSE_NODE} -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl port-forward service/jaeger -n observability 16686:16686 2>&1 > /dev/null &` + "\n" + `kubectl port-forward service/prometheus -n observability 9090:9090 2>&1 > /dev/null &`) + r.Run(`result=$(curl -X GET localhost:16686/api/traces?service=${FORWARDER}&lookback=5m&limit=1)` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -q "forwarder"`) + r.Run(`FORWARDER=${FORWARDER//-/_}`) + r.Run(`result=$(curl -X GET localhost:9090/api/v1/query?query="${FORWARDER}_server_tx_bytes")` + "\n" + `echo ${result}` + "\n" + `echo ${result} | grep -q "forwarder"`) +} diff --git a/suites/ovs/suite.gen.go b/suites/ovs/suite.gen.go new file mode 100755 index 0000000000..197d2c697f --- /dev/null +++ b/suites/ovs/suite.gen.go @@ -0,0 +1,76 @@ +// Code generated by gotestmd DO NOT EDIT. +package ovs + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/ovs") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/ovs?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestWebhook_smartvf() { + r := s.Runner("../deployments-k8s/examples/features/webhook-smartvf") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-webhook-smartvf`) + }) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/webhook-smartvf?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod -l app=nse-kernel -n ns-webhook-smartvf`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod postgres-cl -n ns-webhook-smartvf`) + r.Run(`kubectl exec pods/postgres-cl -n ns-webhook-smartvf -c postgres-cl -- sh -c 'PGPASSWORD=admin psql -h 172.16.1.100 -p 5432 -U admin test'`) +} +func (s *Suite) TestKernel2kernel() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel`) + r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel -- ping -c 4 172.16.1.100`) + r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel -- ping -c 4 172.16.1.101`) +} +func (s *Suite) TestKernel2kernelvlan() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2KernelVLAN") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2kernel-vlan`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2KernelVLAN?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ns-kernel2kernel-vlan`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel-vlan`) + r.Run(`NSC=$((kubectl get pods -l app=nsc-kernel -n ns-kernel2kernel-vlan --template '{{range .items}}{{.metadata.name}}{{" "}}{{end}}') | cut -d' ' -f1)` + "\n" + `TARGET_IP=$(kubectl exec -ti ${NSC} -n ns-kernel2kernel-vlan -- ip route show | grep 172.16 | cut -d' ' -f1)`) + r.Run(`NSE=$(kubectl get pods -l app=nse-kernel -n ns-kernel2kernel-vlan --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')`) + r.Run(`kubectl exec ${NSC} -n ns-kernel2kernel-vlan -- ping -c 4 ${TARGET_IP}`) +} +func (s *Suite) TestSmartvf2smartvf() { + r := s.Runner("../deployments-k8s/examples/use-cases/SmartVF2SmartVF") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-smartvf2smartvf`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SmartVF2SmartVF?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-smartvf2smartvf wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel`) + r.Run(`kubectl -n ns-smartvf2smartvf wait --for=condition=ready --timeout=1m pod -l app=nse-kernel`) + r.Run(`kubectl -n ns-smartvf2smartvf exec deployments/nsc-kernel -- ping -c 4 172.16.1.100`) +} diff --git a/suites/pss/suite.gen.go b/suites/pss/suite.gen.go new file mode 100755 index 0000000000..fda89a17eb --- /dev/null +++ b/suites/pss/suite.gen.go @@ -0,0 +1,43 @@ +// Code generated by gotestmd DO NOT EDIT. +package pss + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster_csi" +) + +type Suite struct { + base.Suite + single_cluster_csiSuite single_cluster_csi.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_cluster_csiSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/pss") + s.T().Cleanup(func() { + r.Run(`kubectl delete ds/forwarder-vpp -n nsm-system`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/pss/nsm-system?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) +} +func (s *Suite) TestNginx() { + r := s.Runner("../deployments-k8s/examples/pss/use-cases/nginx") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-nginx`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/pss/use-cases/nginx?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait --for=condition=ready --timeout=5m pod -l app=nse-kernel -n ns-nginx`) + r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nettools -n ns-nginx`) + r.Run(`kubectl exec pods/nettools -n ns-nginx -- curl 172.16.1.100:8080 | grep -o "Welcome to nginx"`) +} diff --git a/suites/remotevlan/rvlanovs/suite.gen.go b/suites/remotevlan/rvlanovs/suite.gen.go new file mode 100755 index 0000000000..ce3addd523 --- /dev/null +++ b/suites/remotevlan/rvlanovs/suite.gen.go @@ -0,0 +1,93 @@ +// Code generated by gotestmd DO NOT EDIT. +package rvlanovs + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/remotevlan/rvlanovs") + s.T().Cleanup(func() { + r.Run(`kubectl delete -k https://github.com/networkservicemesh/deployments-k8s/examples/remotevlan/rvlanovs?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/remotevlan/rvlanovs?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n nsm-system wait --for=condition=ready --timeout=2m pod -l app=forwarder-ovs`) +} +func (s *Suite) TestKernel2rvlanbreakout() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanBreakout") + s.T().Cleanup(func() { + r.Run(`docker stop rvm-tester` + "\n" + `docker image rm rvm-tester:latest` + "\n" + `true`) + r.Run(`kubectl delete ns ns-kernel2rvlan-breakout`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanBreakout?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-kernel2rvlan-breakout wait --for=condition=ready --timeout=1m pod -l app=iperf1-s`) + r.Run(`NSCS=($(kubectl get pods -l app=iperf1-s -n ns-kernel2rvlan-breakout --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`cat > Dockerfile <<EOF` + "\n" + `FROM networkstatic/iperf3` + "\n" + `` + "\n" + `RUN apt-get update \` + "\n" + ` && apt-get install -y ethtool iproute2 \` + "\n" + ` && rm -rf /var/lib/apt/lists/*` + "\n" + `` + "\n" + `ENTRYPOINT [ "tail", "-f", "/dev/null" ]` + "\n" + `EOF` + "\n" + `docker build . -t rvm-tester`) + r.Run(`docker run --cap-add=NET_ADMIN --rm -d --network bridge-2 --name rvm-tester rvm-tester tail -f /dev/null` + "\n" + `docker exec rvm-tester ip link set eth0 down` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.100 type vlan id 100` + "\n" + `docker exec rvm-tester ip link set eth0 up` + "\n" + `docker exec rvm-tester ip addr add 172.10.0.254/24 dev eth0.100` + "\n" + `docker exec rvm-tester ethtool -K eth0 tx off`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` IP_ADDRESS=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2rvlan-breakout -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -sD -B ${IP_ADDRESS} -1` + "\n" + ` docker exec rvm-tester iperf3 -i0 -t 25 -c ${IP_ADDRESS}` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` IP_ADDRESS=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2rvlan-breakout -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -sD -B ${IP_ADDRESS} -1` + "\n" + ` docker exec rvm-tester iperf3 -i0 -t 5 -u -c ${IP_ADDRESS}` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` docker exec rvm-tester iperf3 -sD -B 172.10.0.254 -1` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -i0 -t 5 -c 172.10.0.254` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` docker exec rvm-tester iperf3 -sD -B 172.10.0.254 -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -i0 -t 5 -u -c 172.10.0.254` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) +} +func (s *Suite) TestKernel2rvlaninternal() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanInternal") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2rvlan-internal`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanInternal?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-kernel2rvlan-internal wait --for=condition=ready --timeout=1m pod -l app=iperf1-s`) + r.Run(`NSCS=($(kubectl get pods -l app=iperf1-s -n ns-kernel2rvlan-internal --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[0]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[1]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -u -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[0]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -6 a s nsm-1 scope global | grep -oP '(?<=inet6\s)([0-9a-f:]+:+)+[0-9a-f]+')` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -6 -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[1]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -6 a s nsm-1 scope global | grep -oP '(?<=inet6\s)([0-9a-f:]+:+)+[0-9a-f]+')` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -6 -u -c ${IP_ADDR}`) +} +func (s *Suite) TestKernel2rvlanmultins() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS") + s.T().Cleanup(func() { + r.Run(`docker stop rvm-tester && \` + "\n" + `docker image rm rvm-tester:latest` + "\n" + `true`) + r.Run(`kubectl delete --namespace=nsm-system -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/client.yaml`) + r.Run(`kubectl delete ns ns-kernel2vlan-multins-1`) + r.Run(`kubectl delete ns ns-kernel2vlan-multins-2`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS/ns-1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/ns-2/ns-kernel2vlan-multins-2.yaml` + "\n" + `kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/ns-2/netsvc.yaml` + "\n" + `kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS/ns-2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -n nsm-system -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/client.yaml`) + r.Run(`kubectl -n ns-kernel2vlan-multins-1 wait --for=condition=ready --timeout=1m pod -l app=nse-remote-vlan`) + r.Run(`kubectl -n ns-kernel2vlan-multins-1 wait --for=condition=ready --timeout=1m pod -l app=alpine-1`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=nse-remote-vlan`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=alpine-2`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=alpine-3`) + r.Run(`kubectl -n nsm-system wait --for=condition=ready --timeout=1m pod -l app=alpine-4`) + r.Run(`cat > Dockerfile <<EOF` + "\n" + `FROM alpine:3.15.0` + "\n" + `` + "\n" + `RUN apk add ethtool tcpdump iproute2` + "\n" + `` + "\n" + `ENTRYPOINT [ "tail", "-f", "/dev/null" ]` + "\n" + `EOF` + "\n" + `docker build . -t rvm-tester`) + r.Run(`docker run --cap-add=NET_ADMIN --rm -d --network bridge-2 --name rvm-tester rvm-tester tail -f /dev/null` + "\n" + `docker exec rvm-tester ip link set eth0 down` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.100 type vlan id 100` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.300 type vlan id 300` + "\n" + `docker exec rvm-tester ip link set eth0 up` + "\n" + `docker exec rvm-tester ip addr add 172.10.0.254/24 dev eth0.100` + "\n" + `docker exec rvm-tester ip addr add 172.10.1.254/24 dev eth0` + "\n" + `docker exec rvm-tester ip addr add 172.10.2.254/24 dev eth0.300` + "\n" + `docker exec rvm-tester ethtool -K eth0 tx off`) + r.Run(`NSCS=($(kubectl get pods -l app=alpine-1 -n ns-kernel2vlan-multins-1 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `LINK_MTU=$(docker exec kind-worker cat /sys/class/net/ext_net1/mtu)` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2vlan-multins-1 -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-1 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0.300` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR[$nsc]} -I eth0` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`NSCS_BLUE=($(kubectl get pods -l app=alpine-2 -n ns-kernel2vlan-multins-2 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))` + "\n" + `NSCS_GREEN=($(kubectl get pods -l app=alpine-3 -n ns-kernel2vlan-multins-2 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_BLUE[@]} ${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2vlan-multins-2 -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR_BLUE` + "\n" + `for nsc in "${NSCS_BLUE[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR_BLUE[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-2 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done` + "\n" + `declare -A IP_ADDR_GREEN` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR_GREEN[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-2 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_BLUE[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_BLUE[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_BLUE[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_GREEN[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`kubectl delete deployment alpine-2-bg -n ns-kernel2vlan-multins-2`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`NSCS=($(kubectl get pods -l app=alpine-4 -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n nsm-system -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR[$nsc]=$(kubectl exec ${nsc} -n nsm-system -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0 eth0.300` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR[$nsc]} -I eth0.100` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) +} diff --git a/suites/remotevlan/rvlanvpp/suite.gen.go b/suites/remotevlan/rvlanvpp/suite.gen.go new file mode 100755 index 0000000000..4d9bd116a2 --- /dev/null +++ b/suites/remotevlan/rvlanvpp/suite.gen.go @@ -0,0 +1,93 @@ +// Code generated by gotestmd DO NOT EDIT. +package rvlanvpp + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/remotevlan/rvlanvpp") + s.T().Cleanup(func() { + r.Run(`kubectl delete -k https://github.com/networkservicemesh/deployments-k8s/examples/remotevlan/rvlanvpp?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/remotevlan/rvlanvpp?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n nsm-system wait --for=condition=ready --timeout=2m pod -l app=forwarder-vpp`) +} +func (s *Suite) TestKernel2rvlanbreakout() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanBreakout") + s.T().Cleanup(func() { + r.Run(`docker stop rvm-tester` + "\n" + `docker image rm rvm-tester:latest` + "\n" + `true`) + r.Run(`kubectl delete ns ns-kernel2rvlan-breakout`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanBreakout?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-kernel2rvlan-breakout wait --for=condition=ready --timeout=1m pod -l app=iperf1-s`) + r.Run(`NSCS=($(kubectl get pods -l app=iperf1-s -n ns-kernel2rvlan-breakout --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`cat > Dockerfile <<EOF` + "\n" + `FROM networkstatic/iperf3` + "\n" + `` + "\n" + `RUN apt-get update \` + "\n" + ` && apt-get install -y ethtool iproute2 \` + "\n" + ` && rm -rf /var/lib/apt/lists/*` + "\n" + `` + "\n" + `ENTRYPOINT [ "tail", "-f", "/dev/null" ]` + "\n" + `EOF` + "\n" + `docker build . -t rvm-tester`) + r.Run(`docker run --cap-add=NET_ADMIN --rm -d --network bridge-2 --name rvm-tester rvm-tester tail -f /dev/null` + "\n" + `docker exec rvm-tester ip link set eth0 down` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.100 type vlan id 100` + "\n" + `docker exec rvm-tester ip link set eth0 up` + "\n" + `docker exec rvm-tester ip addr add 172.10.0.254/24 dev eth0.100` + "\n" + `docker exec rvm-tester ethtool -K eth0 tx off`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` IP_ADDRESS=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2rvlan-breakout -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -sD -B ${IP_ADDRESS} -1` + "\n" + ` docker exec rvm-tester iperf3 -i0 -t 25 -c ${IP_ADDRESS}` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` IP_ADDRESS=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2rvlan-breakout -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -sD -B ${IP_ADDRESS} -1` + "\n" + ` docker exec rvm-tester iperf3 -i0 -t 5 -u -c ${IP_ADDRESS}` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` docker exec rvm-tester iperf3 -sD -B 172.10.0.254 -1` + "\n" + ` kubectl exec ${nsc} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -i0 -t 5 -c 172.10.0.254` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) + r.Run(`status=0` + "\n" + ` for nsc in "${NSCS[@]}"` + "\n" + ` do` + "\n" + ` docker exec rvm-tester iperf3 -sD -B 172.10.0.254 -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-breakout -- iperf3 -i0 -t 5 -u -c 172.10.0.254` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + ` fi`) +} +func (s *Suite) TestKernel2rvlaninternal() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanInternal") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-kernel2rvlan-internal`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanInternal?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-kernel2rvlan-internal wait --for=condition=ready --timeout=1m pod -l app=iperf1-s`) + r.Run(`NSCS=($(kubectl get pods -l app=iperf1-s -n ns-kernel2rvlan-internal --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[0]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[1]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -u -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[0]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -6 a s nsm-1 scope global | grep -oP '(?<=inet6\s)([0-9a-f:]+:+)+[0-9a-f]+')` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -6 -c ${IP_ADDR}`) + r.Run(`IP_ADDR=$(kubectl exec ${NSCS[1]} -c cmd-nsc -n ns-kernel2rvlan-internal -- ip -6 a s nsm-1 scope global | grep -oP '(?<=inet6\s)([0-9a-f:]+:+)+[0-9a-f]+')` + "\n" + ` kubectl exec ${NSCS[1]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -sD -B ${IP_ADDR} -1` + "\n" + ` kubectl exec ${NSCS[0]} -c iperf-server -n ns-kernel2rvlan-internal -- iperf3 -i0 -t 5 -6 -u -c ${IP_ADDR}`) +} +func (s *Suite) TestKernel2rvlanmultins() { + r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS") + s.T().Cleanup(func() { + r.Run(`docker stop rvm-tester && \` + "\n" + `docker image rm rvm-tester:latest` + "\n" + `true`) + r.Run(`kubectl delete --namespace=nsm-system -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/client.yaml`) + r.Run(`kubectl delete ns ns-kernel2vlan-multins-1`) + r.Run(`kubectl delete ns ns-kernel2vlan-multins-2`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS/ns-1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/ns-2/ns-kernel2vlan-multins-2.yaml` + "\n" + `kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/ns-2/netsvc.yaml` + "\n" + `kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2RVlanMultiNS/ns-2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl apply -n nsm-system -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/use-cases/Kernel2RVlanMultiNS/client.yaml`) + r.Run(`kubectl -n ns-kernel2vlan-multins-1 wait --for=condition=ready --timeout=1m pod -l app=nse-remote-vlan`) + r.Run(`kubectl -n ns-kernel2vlan-multins-1 wait --for=condition=ready --timeout=1m pod -l app=alpine-1`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=nse-remote-vlan`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=alpine-2`) + r.Run(`kubectl -n ns-kernel2vlan-multins-2 wait --for=condition=ready --timeout=1m pod -l app=alpine-3`) + r.Run(`kubectl -n nsm-system wait --for=condition=ready --timeout=1m pod -l app=alpine-4`) + r.Run(`cat > Dockerfile <<EOF` + "\n" + `FROM alpine:3.15.0` + "\n" + `` + "\n" + `RUN apk add ethtool tcpdump iproute2` + "\n" + `` + "\n" + `ENTRYPOINT [ "tail", "-f", "/dev/null" ]` + "\n" + `EOF` + "\n" + `docker build . -t rvm-tester`) + r.Run(`docker run --cap-add=NET_ADMIN --rm -d --network bridge-2 --name rvm-tester rvm-tester tail -f /dev/null` + "\n" + `docker exec rvm-tester ip link set eth0 down` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.100 type vlan id 100` + "\n" + `docker exec rvm-tester ip link add link eth0 name eth0.300 type vlan id 300` + "\n" + `docker exec rvm-tester ip link set eth0 up` + "\n" + `docker exec rvm-tester ip addr add 172.10.0.254/24 dev eth0.100` + "\n" + `docker exec rvm-tester ip addr add 172.10.1.254/24 dev eth0` + "\n" + `docker exec rvm-tester ip addr add 172.10.2.254/24 dev eth0.300` + "\n" + `docker exec rvm-tester ethtool -K eth0 tx off`) + r.Run(`NSCS=($(kubectl get pods -l app=alpine-1 -n ns-kernel2vlan-multins-1 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `LINK_MTU=$(docker exec kind-worker cat /sys/class/net/ext_net1/mtu)` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2vlan-multins-1 -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-1 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0.300` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR[$nsc]} -I eth0` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`NSCS_BLUE=($(kubectl get pods -l app=alpine-2 -n ns-kernel2vlan-multins-2 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))` + "\n" + `NSCS_GREEN=($(kubectl get pods -l app=alpine-3 -n ns-kernel2vlan-multins-2 --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_BLUE[@]} ${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n ns-kernel2vlan-multins-2 -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR_BLUE` + "\n" + `for nsc in "${NSCS_BLUE[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR_BLUE[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-2 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done` + "\n" + `declare -A IP_ADDR_GREEN` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR_GREEN[$nsc]=$(kubectl exec ${nsc} -n ns-kernel2vlan-multins-2 -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_BLUE[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_BLUE[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_BLUE[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0.100 eth0` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_GREEN[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`kubectl delete deployment alpine-2-bg -n ns-kernel2vlan-multins-2`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS_GREEN[@]}"` + "\n" + `do` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`NSCS=($(kubectl get pods -l app=alpine-4 -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'))`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` MTU=$(kubectl exec ${nsc} -c cmd-nsc -n nsm-system -- cat /sys/class/net/nsm-1/mtu)` + "\n" + `` + "\n" + ` echo "$LINK_MTU vs $MTU"` + "\n" + `` + "\n" + ` if test "${MTU}" = ""` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + ` if test $MTU -ne $LINK_MTU` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -ne 0` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) + r.Run(`declare -A IP_ADDR` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` IP_ADDR[$nsc]=$(kubectl exec ${nsc} -n nsm-system -c alpine -- ip -4 addr show nsm-1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')` + "\n" + `done`) + r.Run(`status=0` + "\n" + `for nsc in "${NSCS[@]}"` + "\n" + `do` + "\n" + ` for vlan_if_name in eth0 eth0.300` + "\n" + ` do` + "\n" + ` docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}` + "\n" + ` if test $? -eq 0` + "\n" + ` then` + "\n" + ` status=2` + "\n" + ` fi` + "\n" + ` done` + "\n" + ` docker exec rvm-tester ping -c 1 ${IP_ADDR[$nsc]} -I eth0.100` + "\n" + ` if test $? -ne 0` + "\n" + ` then` + "\n" + ` status=1` + "\n" + ` fi` + "\n" + `done` + "\n" + `if test ${status} -eq 1` + "\n" + ` then` + "\n" + ` false` + "\n" + `fi`) +} diff --git a/suites/remotevlan/suite.gen.go b/suites/remotevlan/suite.gen.go new file mode 100755 index 0000000000..622e1e3332 --- /dev/null +++ b/suites/remotevlan/suite.gen.go @@ -0,0 +1,50 @@ +// Code generated by gotestmd DO NOT EDIT. +package remotevlan + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/remotevlan/rvlanovs" + "github.com/networkservicemesh/integration-tests/suites/remotevlan/rvlanvpp" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite + rvlanovsSuite rvlanovs.Suite + rvlanvppSuite rvlanvpp.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/remotevlan") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + r.Run(`docker network disconnect bridge-2 kind-worker` + "\n" + `docker network disconnect bridge-2 kind-worker2` + "\n" + `docker network rm bridge-2` + "\n" + `docker exec kind-worker ip link del ext_net1` + "\n" + `docker exec kind-worker2 ip link del ext_net1` + "\n" + `true`) + }) + r.Run(`docker network create bridge-2` + "\n" + `docker network connect bridge-2 kind-worker` + "\n" + `docker network connect bridge-2 kind-worker2`) + r.Run(`MACS=($(docker inspect --format='{{range .Containers}}{{.MacAddress}}{{"\n"}}{{end}}' bridge-2))` + "\n" + `ifw1=$(docker exec kind-worker ip -o link | grep ${MACS[@]/#/-e } | cut -f1 -d"@" | cut -f2 -d" ")` + "\n" + `ifw2=$(docker exec kind-worker2 ip -o link | grep ${MACS[@]/#/-e } | cut -f1 -d"@" | cut -f2 -d" ")` + "\n" + `` + "\n" + `(docker exec kind-worker ip link set $ifw1 down &&` + "\n" + `docker exec kind-worker ip link set $ifw1 name ext_net1 &&` + "\n" + `docker exec kind-worker ip link set dev ext_net1 mtu 1450 &&` + "\n" + `docker exec kind-worker ip link set ext_net1 up &&` + "\n" + `docker exec kind-worker2 ip link set $ifw2 down &&` + "\n" + `docker exec kind-worker2 ip link set $ifw2 name ext_net1 &&` + "\n" + `docker exec kind-worker2 ip link set dev ext_net1 mtu 1450 &&` + "\n" + `docker exec kind-worker2 ip link set ext_net1 up)`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/remotevlan?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n nsm-system wait --for=condition=ready --timeout=2m pod -l app=nse-remote-vlan`) + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`) + s.RunIncludedSuites() +} +func (s *Suite) RunIncludedSuites() { + s.Run("Rvlanovs", func() { + suite.Run(s.T(), &s.rvlanovsSuite) + }) + s.Run("Rvlanvpp", func() { + suite.Run(s.T(), &s.rvlanvppSuite) + }) +} +func (s *Suite) Test() {} diff --git a/suites/spire/cluster1/suite.gen.go b/suites/spire/cluster1/suite.gen.go new file mode 100755 index 0000000000..fd907a653b --- /dev/null +++ b/suites/spire/cluster1/suite.gen.go @@ -0,0 +1,34 @@ +// Code generated by gotestmd DO NOT EDIT. +package cluster1 + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/spire/cluster1") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl --kubeconfig=$KUBECONFIG1 delete ns spire`) + }) + r.Run(`[[ ! -z $KUBECONFIG1 ]]`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/cluster1?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-server`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-agent`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG1 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/cluster1/clusterspiffeid-template.yaml`) +} +func (s *Suite) Test() {} diff --git a/suites/spire/cluster2/suite.gen.go b/suites/spire/cluster2/suite.gen.go new file mode 100755 index 0000000000..b35e4418cb --- /dev/null +++ b/suites/spire/cluster2/suite.gen.go @@ -0,0 +1,34 @@ +// Code generated by gotestmd DO NOT EDIT. +package cluster2 + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/spire/cluster2") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl --kubeconfig=$KUBECONFIG2 delete ns spire`) + }) + r.Run(`[[ ! -z $KUBECONFIG2 ]]`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/cluster2?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-server`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-agent`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG2 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/cluster2/clusterspiffeid-template.yaml`) +} +func (s *Suite) Test() {} diff --git a/suites/spire/cluster3/suite.gen.go b/suites/spire/cluster3/suite.gen.go new file mode 100755 index 0000000000..459aac52ce --- /dev/null +++ b/suites/spire/cluster3/suite.gen.go @@ -0,0 +1,34 @@ +// Code generated by gotestmd DO NOT EDIT. +package cluster3 + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/spire/cluster3") + s.T().Cleanup(func() { + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG3 delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl --kubeconfig=$KUBECONFIG3 delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl --kubeconfig=$KUBECONFIG3 delete ns spire`) + }) + r.Run(`[[ ! -z $KUBECONFIG3 ]]`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/cluster3?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-server`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-agent`) + r.Run(`kubectl --kubeconfig=$KUBECONFIG3 apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/cluster3/clusterspiffeid-template.yaml`) +} +func (s *Suite) Test() {} diff --git a/suites/spire/single_cluster/suite.gen.go b/suites/spire/single_cluster/suite.gen.go new file mode 100755 index 0000000000..a885dc870a --- /dev/null +++ b/suites/spire/single_cluster/suite.gen.go @@ -0,0 +1,33 @@ +// Code generated by gotestmd DO NOT EDIT. +package single_cluster + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/spire/single_cluster") + s.T().Cleanup(func() { + r.Run(`kubectl delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl delete ns spire`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/single_cluster?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-server`) + r.Run(`kubectl wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-agent`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/single_cluster/clusterspiffeid-template.yaml`) +} +func (s *Suite) Test() {} diff --git a/suites/spire/single_cluster_csi/suite.gen.go b/suites/spire/single_cluster_csi/suite.gen.go new file mode 100755 index 0000000000..b2c67c9267 --- /dev/null +++ b/suites/spire/single_cluster_csi/suite.gen.go @@ -0,0 +1,33 @@ +// Code generated by gotestmd DO NOT EDIT. +package single_cluster_csi + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/spire/single_cluster_csi") + s.T().Cleanup(func() { + r.Run(`kubectl delete crd clusterspiffeids.spire.spiffe.io` + "\n" + `kubectl delete crd clusterfederatedtrustdomains.spire.spiffe.io` + "\n" + `kubectl delete validatingwebhookconfiguration.admissionregistration.k8s.io/spire-controller-manager-webhook` + "\n" + `kubectl delete ns spire`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/spire/single_cluster_csi?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-server`) + r.Run(`kubectl wait -n spire --timeout=1m --for=condition=ready pod -l app=spire-agent`) + r.Run(`kubectl apply -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/8fd5ce5a577a80bd48e697fd4a10e950af9f30d4/examples/spire/single_cluster/clusterspiffeid-template.yaml`) +} +func (s *Suite) Test() {} diff --git a/suites/spire/suite.gen.go b/suites/spire/suite.gen.go new file mode 100755 index 0000000000..8357b991bd --- /dev/null +++ b/suites/spire/suite.gen.go @@ -0,0 +1,25 @@ +// Code generated by gotestmd DO NOT EDIT. +package spire + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" +) + +type Suite struct { + base.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } +} +func (s *Suite) Test() {} diff --git a/suites/sriov/suite.gen.go b/suites/sriov/suite.gen.go new file mode 100755 index 0000000000..64ba7578d5 --- /dev/null +++ b/suites/sriov/suite.gen.go @@ -0,0 +1,56 @@ +// Code generated by gotestmd DO NOT EDIT. +package sriov + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/sriov") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/sriov?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) +} +func (s *Suite) TestSriovkernel2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/SriovKernel2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-sriov-kernel2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2Noop/ponger?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=ponger`) + r.Run(`kubectl -n ns-sriov-kernel2noop exec deploy/ponger -- ip a | grep "172.16.1.100"`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel`) + r.Run(`kubectl -n ns-sriov-kernel2noop wait --for=condition=ready --timeout=1m pod -l app=nse-noop`) + r.Run(`kubectl -n ns-sriov-kernel2noop exec deployments/nsc-kernel -- ping -c 4 172.16.1.100`) +} +func (s *Suite) TestVfio2noop() { + r := s.Runner("../deployments-k8s/examples/use-cases/Vfio2Noop") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-vfio2noop exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-vfio2noop`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Vfio2Noop?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-vfio2noop wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio`) + r.Run(`kubectl -n ns-vfio2noop wait --for=condition=ready --timeout=1m pod -l app=nse-vfio`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-vfio2noop exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +} diff --git a/suites/sriov_vlantag/suite.gen.go b/suites/sriov_vlantag/suite.gen.go new file mode 100755 index 0000000000..b71e7ec3f7 --- /dev/null +++ b/suites/sriov_vlantag/suite.gen.go @@ -0,0 +1,56 @@ +// Code generated by gotestmd DO NOT EDIT. +package sriov_vlantag + +import ( + "github.com/stretchr/testify/suite" + + "github.com/networkservicemesh/integration-tests/extensions/base" + "github.com/networkservicemesh/integration-tests/suites/spire/single_cluster" +) + +type Suite struct { + base.Suite + single_clusterSuite single_cluster.Suite +} + +func (s *Suite) SetupSuite() { + parents := []interface{}{&s.Suite, &s.single_clusterSuite} + for _, p := range parents { + if v, ok := p.(suite.TestingSuite); ok { + v.SetT(s.T()) + } + if v, ok := p.(suite.SetupAllSuite); ok { + v.SetupSuite() + } + } + r := s.Runner("../deployments-k8s/examples/sriov_vlantag") + s.T().Cleanup(func() { + r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl delete mutatingwebhookconfiguration ${WH}` + "\n" + `kubectl delete ns nsm-system`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/sriov?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) +} +func (s *Suite) TestSriovkernel2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl delete ns ns-sriov-kernel2noop-vlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag/ponger?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=ponger`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag exec deploy/ponger -- ip a | grep "172.16.1.100"`) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/SriovKernel2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nse-noop`) + r.Run(`kubectl -n ns-sriov-kernel2noop-vlantag exec deployments/nsc-kernel -- ping -c 4 172.16.1.100`) +} +func (s *Suite) TestVfio2noopvlantag() { + r := s.Runner("../deployments-k8s/examples/use-cases/Vfio2NoopVlanTag") + s.T().Cleanup(func() { + r.Run(`kubectl -n ns-vfio2noop-vlantag exec deployments/nse-vfio --container ponger -- /bin/bash -c '\` + "\n" + ` (sleep 10 && kill $(pgrep "pingpong")) 1>/dev/null 2>&1 & \` + "\n" + `'`) + r.Run(`kubectl delete ns ns-vfio2noop-vlantag`) + }) + r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Vfio2NoopVlanTag?ref=8fd5ce5a577a80bd48e697fd4a10e950af9f30d4`) + r.Run(`kubectl -n ns-vfio2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nsc-vfio`) + r.Run(`kubectl -n ns-vfio2noop-vlantag wait --for=condition=ready --timeout=1m pod -l app=nse-vfio`) + r.Run(`function dpdk_ping() {` + "\n" + ` err_file="$(mktemp)"` + "\n" + ` trap 'rm -f "${err_file}"' RETURN` + "\n" + `` + "\n" + ` client_mac="$1"` + "\n" + ` server_mac="$2"` + "\n" + `` + "\n" + ` command="/root/dpdk-pingpong/build/pingpong \` + "\n" + ` --no-huge \` + "\n" + ` -- \` + "\n" + ` -n 500 \` + "\n" + ` -c \` + "\n" + ` -C ${client_mac} \` + "\n" + ` -S ${server_mac}` + "\n" + ` "` + "\n" + ` out="$(kubectl -n ns-vfio2noop-vlantag exec deployments/nsc-vfio --container pinger -- /bin/bash -c "${command}" 2>"${err_file}")"` + "\n" + `` + "\n" + ` if [[ "$?" != 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if ! pong_packets="$(echo "${out}" | grep "rx .* pong packets" | sed -E 's/rx ([0-9]*) pong packets/\1/g')"; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` if [[ "${pong_packets}" == 0 ]]; then` + "\n" + ` echo "${out}"` + "\n" + ` cat "${err_file}" 1>&2` + "\n" + ` return 1` + "\n" + ` fi` + "\n" + `` + "\n" + ` echo "${out}"` + "\n" + ` return 0` + "\n" + `}`) + r.Run(`dpdk_ping "0a:55:44:33:22:00" "0a:55:44:33:22:11"`) +}