-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: forrestchen <[email protected]>
- Loading branch information
1 parent
8dda2bc
commit a10c266
Showing
4 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package veth_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestUnderlayVeth(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Underlay-Veth Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package veth | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
"tkestack.io/galaxy/e2e/helper" | ||
"tkestack.io/galaxy/pkg/utils" | ||
) | ||
|
||
var _ = Describe("galaxy-underlay-veth vlan test", func() { | ||
cni := "galaxy-underlay-veth" | ||
ifaceCidr := "192.168.0.66/26" | ||
vlanCidr := "192.168.2.68/26" | ||
containerCidr := "192.168.0.69/26" | ||
containerId := helper.NewContainerId() | ||
|
||
AfterEach(func() { | ||
helper.CleanupNetNS() | ||
helper.CleanupIFace("dummy0.2") | ||
helper.CleanupDummy() | ||
}) | ||
It("vlan", func() { | ||
netConf := []byte(`{ | ||
"name": "myvlan", | ||
"type": "galaxy-underlay-veth", | ||
"device": "dummy0" | ||
}`) | ||
Expect(helper.SetupDummyDev("dummy0", ifaceCidr)).NotTo(HaveOccurred()) | ||
Expect(helper.SetupVlanDev("dummy0.2", "dummy0", vlanCidr, 2)).NotTo(HaveOccurred()) | ||
argsStr, err := helper.IPInfo(containerCidr, 2) | ||
Expect(err).NotTo(HaveOccurred()) | ||
nsPath := helper.CmdAdd(containerId, "", argsStr, cni, | ||
`{"cniVersion":"0.2.0","ip4":{"ip":"192.168.0.69/26","gateway":"192.168.0.65","routes":[{"dst":"0.0.0.0/0"}]},"dns":{}}`, netConf) | ||
_, err = helper.Ping("192.168.0.68") | ||
Expect(err).To(HaveOccurred()) | ||
|
||
err = (&helper.NetworkTopology{ | ||
LeaveDevices: []*helper.LinkDevice{ | ||
helper.NewLinkDevice(nil, utils.HostVethName(containerId, ""), "veth"), | ||
}, | ||
}).Verify() | ||
Expect(err).To(HaveOccurred()) | ||
|
||
// check container iface topology, route, neigh, ip address is expected | ||
helper.CheckContainerTopology(nsPath, containerCidr, "192.168.0.65") | ||
|
||
// test DEL command | ||
helper.CmdDel(containerId, cni, netConf) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters