Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e, handler, ovs: Use secondary interfaces vars. #1275

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions test/e2e/handler/simple_ovs_bridge_and_bond_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
. "github.com/onsi/gomega"

nmstate "github.com/nmstate/kubernetes-nmstate/api/shared"
"github.com/nmstate/kubernetes-nmstate/test/e2e/policy"
)

func ovsBrUpLAGEth1AndEth2(bridgeName, bondName, port1Name, port2Name string) nmstate.State {
Expand Down Expand Up @@ -146,20 +147,21 @@ var _ = Describe("OVS Bridge", func() {
Context("with capture", func() {
BeforeEach(func() {
capture := map[string]string{
"ethernet-ifaces": `interfaces.type=="ethernet"`,
"ethernet-not-ignored-ifaces": `capture.ethernet-ifaces | interfaces.state!="ignore"`,
"secondary-ifaces": `capture.ethernet-not-ignored-ifaces | interfaces.ipv4.enabled==false`,
"first-secondary-nic": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
"second-secondary-nic": fmt.Sprintf(`interfaces.name=="%s"`, secondSecondaryNic),
}
updateDesiredStateWithCaptureAndWait(
setDesiredStateWithPolicyAndCapture(bridge1,
ovsBrUpLAGEth1AndEth2(
bridge1,
bond1,
`"{{ capture.secondary-ifaces.interfaces.0.name }}"`,
`"{{ capture.secondary-ifaces.interfaces.1.name }}"`,
`"{{ capture.first-secondary-nic.interfaces.0.name }}"`,
`"{{ capture.second-secondary-nic.interfaces.0.name }}"`,
),
capture,
)
deletePolicy(TestPolicy)

policy.WaitForAvailablePolicy(bridge1)
deletePolicy(bridge1)
})

It("should have the ovs-bridge at currentState", func() {
Expand Down Expand Up @@ -255,22 +257,21 @@ var _ = Describe("OVS Bridge", func() {
BeforeEach(func() {
By("Creating policy with desiredState")
capture := map[string]string{
"first-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
"ethernet-ifaces": `interfaces.type=="ethernet"`,
"ethernet-not-ignored-ifaces": `capture.ethernet-ifaces | interfaces.state!="ignore"`,
"secondary-ifaces": `capture.ethernet-not-ignored-ifaces | interfaces.ipv4.enabled==false`,
"first-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
"second-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, secondSecondaryNic),
}

macAddr = `"{{ capture.first-secondary-iface.interfaces.0.mac-address }}"`
port1 := `"{{ capture.secondary-ifaces.interfaces.0.name }}"`
port2 := `"{{ capture.secondary-ifaces.interfaces.1.name }}"`
port1 := `"{{ capture.first-secondary-iface.interfaces.0.name }}"`
port2 := `"{{ capture.second-secondary-iface.interfaces.0.name }}"`

updateDesiredStateWithCaptureAtNodeAndWait(
designatedNode,
setDesiredStateWithPolicyAndCaptureAndNodeSelectorEventually(bridge1,
ovsBrUpLAGEth1Eth2WithInternalPort(bridge1, ovsPortName, macAddr, port1, port2),
capture,
map[string]string{"kubernetes.io/hostname": designatedNode},
)
deletePolicy(TestPolicy)
policy.WaitForAvailablePolicy(bridge1)
deletePolicy(bridge1)
})

It("should have the ovs-bridge and internal port at currentState", func() {
Expand Down