Use link_state=enabled sriov network for connectivity test
This will allow to execute the test case on a machine where PFs are
not plugged to external network, or where external switch is not
configured to route traffic from one VF to another VF hosted on the
same machine.
@@ -47,6 +47,7 @@ const (
linuxBridgeConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s"},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"mynet\", \"plugins\": [{\"type\": \"bridge\", \"bridge\": \"br10\", \"vlan\": 100, \"ipam\": {}},{\"type\": \"tuning\"}]}"}}`
ptpConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s"},"spec":{"config":"{ \"cniVersion\": \"0.3.1\", \"name\": \"mynet\", \"plugins\": [{\"type\": \"ptp\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" }},{\"type\": \"tuning\"}]}"}}`
sriovConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"name\": \"sriov\", \"type\": \"sriov\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
+ sriovLinkEnableConfCRD = `{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"name":"%s","namespace":"%s","annotations":{"k8s.v1.cni.cncf.io/resourceName":"%s"}},"spec":{"config":"{ \"name\": \"sriov\", \"type\": \"sriov\", \"link_state\": \"enable\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"10.1.1.0/24\" } }"}}`
)
var _ = Describe("Multus", func() {
@@ -587,6 +588,12 @@ var _ = Describe("SRIOV", func() {
Body([]byte(fmt.Sprintf(sriovConfCRD, "sriov2", tests.NamespaceTestDefault, sriovResourceName))).
Do()
Expect(result.Error()).NotTo(HaveOccurred())
+ result = virtClient.RestClient().
+ Post().
+ RequestURI(fmt.Sprintf(postUrl, tests.NamespaceTestDefault, "sriov-link-enabled")).
+ Body([]byte(fmt.Sprintf(sriovLinkEnableConfCRD, "sriov-link-enabled", tests.NamespaceTestDefault, sriovResourceName))).
+ Do()
+ Expect(result.Error()).NotTo(HaveOccurred())
})
BeforeEach(func() {
@@ -741,8 +748,8 @@ var _ = Describe("SRIOV", func() {
//properly, or via in-PF switching for VFs (works for some NIC models)
It("should connect to another machine with sriov interface", func() {
// start peer machines with sriov interfaces from the same resource pool
- vmi1 := getSriovVmi([]string{"sriov"})
- vmi2 := getSriovVmi([]string{"sriov"})
+ vmi1 := getSriovVmi([]string{"sriov-link-enabled"})
+ vmi2 := getSriovVmi([]string{"sriov-link-enabled"})
startVmi(vmi1)
startVmi(vmi2)
