@@ -196,8 +196,7 @@ func updateDesiredStateWithCaptureAtNodeAndWait(node string, desiredState nmstat
196
196
policy .WaitForAvailableTestPolicy ()
197
197
}
198
198
199
- // TODO: After we implement policy delete (it will cleanUp desiredState) we have
200
- // to remove this
199
+ // TODO: After we implement policy delete (it will cleanUp desiredState) we have to remove this.
201
200
func resetDesiredStateForNodes () {
202
201
By ("Resetting nics state primary up and secondaries disable ipv4 and ipv6" )
203
202
updateDesiredState (resetPrimaryAndSecondaryNICs ())
@@ -399,6 +398,13 @@ func vlanForNodeInterfaceEventually(node, iface string) AsyncAssertion {
399
398
}, ReadTimeout , ReadInterval )
400
399
}
401
400
401
+ // vrfForNodeInterfaceEventually asserts that VRF with vrfID is eventually created.
402
+ func vrfForNodeInterfaceEventually (node , vrfID string ) AsyncAssertion {
403
+ return Eventually (func () string {
404
+ return vrf (node , vrfID )
405
+ }, ReadTimeout , ReadInterval )
406
+ }
407
+
402
408
func interfacesForNode (node string ) AsyncAssertion {
403
409
return Eventually (func () []interface {} {
404
410
var currentStateYaml nmstate.State
@@ -612,9 +618,19 @@ func routeDest(node, destIP string) string {
612
618
return gjson .ParseBytes (currentStateJSON (node )).Get (path ).String ()
613
619
}
614
620
621
+ // routeNextHopInterfaceWithTableID checks if a route with destIP exists in the default routing table.
615
622
func routeNextHopInterface (node , destIP string ) AsyncAssertion {
623
+ return routeNextHopInterfaceWithTableID (node , destIP , "" )
624
+ }
625
+
626
+ // routeNextHopInterfaceWithTableID checks if a route with destIP exists in table tableID. If tableID is the empty
627
+ // string, use the default table-id (254).
628
+ func routeNextHopInterfaceWithTableID (node , destIP , tableID string ) AsyncAssertion {
629
+ if tableID == "" {
630
+ tableID = "254"
631
+ }
616
632
return Eventually (func () string {
617
- path := fmt .Sprintf ("routes.running.#(destination==%q).next-hop-interface" , destIP )
633
+ path := fmt .Sprintf ("routes.running.#(table-id==%s)#|#( destination==%q).next-hop-interface" , tableID , destIP )
618
634
return gjson .ParseBytes (currentStateJSON (node )).Get (path ).String ()
619
635
}, 15 * time .Second , 1 * time .Second )
620
636
}
@@ -624,6 +640,12 @@ func vlan(node, iface string) string {
624
640
return gjson .ParseBytes (currentStateJSON (node )).Get (vlanFilter ).String ()
625
641
}
626
642
643
+ // vrf verifies if the VRF with vrfID was created on node.
644
+ func vrf (node , vrfID string ) string {
645
+ vrfFilter := fmt .Sprintf ("interfaces.#(name==vrf%s).vrf.route-table-id" , vrfID )
646
+ return gjson .ParseBytes (currentStateJSON (node )).Get (vrfFilter ).String ()
647
+ }
648
+
627
649
func kubectlAndCheck (command ... string ) {
628
650
out , err := cmd .Kubectl (command ... )
629
651
Expect (err ).ShouldNot (HaveOccurred (), out )
0 commit comments