diff --git a/pkg/agent/controller/trafficcontrol/controller.go b/pkg/agent/controller/trafficcontrol/controller.go index 1c0d8720a77..f76e2b9a250 100644 --- a/pkg/agent/controller/trafficcontrol/controller.go +++ b/pkg/agent/controller/trafficcontrol/controller.go @@ -920,7 +920,7 @@ func (c *Controller) syncTrafficControl(tcName string) error { for _, port := range sets.List(newOfPorts) { ofPorts = append(ofPorts, uint32(port)) } - if err = c.ofClient.InstallTrafficControlMarkFlows(tc.Name, ofPorts, targetOFPort, tc.Spec.Direction, tc.Spec.Action); err != nil { + if err = c.ofClient.InstallTrafficControlMarkFlows(tc.Name, ofPorts, targetOFPort, tc.Spec.Direction, tc.Spec.Action, openflow.TrafficControlFlowPriorityMedium); err != nil { return err } } diff --git a/pkg/agent/controller/trafficcontrol/controller_test.go b/pkg/agent/controller/trafficcontrol/controller_test.go index 3dab23a1fac..b38366d9002 100644 --- a/pkg/agent/controller/trafficcontrol/controller_test.go +++ b/pkg/agent/controller/trafficcontrol/controller_test.go @@ -35,6 +35,7 @@ import ( "k8s.io/client-go/tools/cache" "antrea.io/antrea/pkg/agent/interfacestore" + "antrea.io/antrea/pkg/agent/openflow" openflowtest "antrea.io/antrea/pkg/agent/openflow/testing" "antrea.io/antrea/pkg/agent/types" "antrea.io/antrea/pkg/agent/util" @@ -332,7 +333,7 @@ func TestTrafficControlAdd(t *testing.T) { mockOVSBridgeClient.EXPECT().CreatePort(networkDeviceName, networkDeviceName, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(networkDeviceName, false) mockOVSCtlClient.EXPECT().SetPortNoFlood(0) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -346,7 +347,7 @@ func TestTrafficControlAdd(t *testing.T) { mockOVSBridgeClient.EXPECT().CreateTunnelPortExt(gomock.Any(), ovsconfig.TunnelType(ovsconfig.VXLANTunnel), int32(0), false, "", remoteIP, "", "", extraOptions, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(gomock.Any(), false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -360,7 +361,7 @@ func TestTrafficControlAdd(t *testing.T) { mockOVSBridgeClient.EXPECT().CreateTunnelPortExt(gomock.Any(), ovsconfig.TunnelType(ovsconfig.GeneveTunnel), int32(0), false, "", remoteIP, "", "", extraOptions, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(gomock.Any(), false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -374,7 +375,7 @@ func TestTrafficControlAdd(t *testing.T) { mockOVSBridgeClient.EXPECT().CreateTunnelPortExt(gomock.Any(), ovsconfig.TunnelType(ovsconfig.GRETunnel), int32(0), false, "", remoteIP, "", "", extraOptions, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(gomock.Any(), false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -388,7 +389,7 @@ func TestTrafficControlAdd(t *testing.T) { mockOVSBridgeClient.EXPECT().CreateTunnelPortExt(gomock.Any(), ovsconfig.TunnelType(ovsconfig.ERSPANTunnel), int32(0), false, "", remoteIP, "", "", extraOptions, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(gomock.Any(), false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -402,7 +403,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort2OFPort, directionIngress, actionRedirect) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort2OFPort, directionIngress, actionRedirect, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -415,7 +416,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -428,7 +429,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod2OFPort}), targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod2OFPort}), targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -441,7 +442,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod2OFPort}, targetPort1OFPort, directionIngress, actionRedirect) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod2OFPort}, targetPort1OFPort, directionIngress, actionRedirect, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -454,7 +455,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionRedirect) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionRedirect, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -467,7 +468,7 @@ func TestTrafficControlAdd(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod1OFPort, pod2OFPort, pod3OFPort, pod4OFPort}, targetPort1OFPort, directionIngress, actionRedirect) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod1OFPort, pod2OFPort, pod3OFPort, pod4OFPort}, targetPort1OFPort, directionIngress, actionRedirect, openflow.TrafficControlFlowPriorityMedium) }, }, } @@ -520,7 +521,7 @@ func TestTrafficControlUpdate(t *testing.T) { mockOVSBridgeClient.EXPECT().CreatePort(targetPort2Name, targetPort2Name, externalIDs) mockOVSBridgeClient.EXPECT().GetOFPort(targetPort2Name, false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -534,7 +535,7 @@ func TestTrafficControlUpdate(t *testing.T) { mockOVSBridgeClient.EXPECT().GetOFPort(returnPort1Name, false) mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) mockOFClient.EXPECT().InstallTrafficControlReturnPortFlow(gomock.Any()) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionIngress, actionRedirect) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionIngress, actionRedirect, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -544,7 +545,7 @@ func TestTrafficControlUpdate(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionEgress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), targetPort1OFPort, directionEgress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -554,7 +555,7 @@ func TestTrafficControlUpdate(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod2OFPort, pod4OFPort}), targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod2OFPort, pod4OFPort}), targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -564,7 +565,7 @@ func TestTrafficControlUpdate(t *testing.T) { expectedCalls: func(mockOFClient *openflowtest.MockClient, mockOVSBridgeClient *ovsconfigtest.MockOVSBridgeClient, mockOVSCtlClient *ovsctltest.MockOVSCtlClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod3OFPort}, targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod3OFPort}, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, } @@ -637,8 +638,8 @@ func TestSharedTargetPort(t *testing.T) { c.mockOVSBridgeClient.EXPECT().GetOFPort(targetPort1Name, false).Times(1) c.mockOVSCtlClient.EXPECT().SetPortNoFlood(gomock.Any()) // Mark flows for TrafficControl tc1 and tc2 are expected to be installed. - c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror) - c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, gomock.InAnyOrder([]uint32{pod2OFPort, pod4OFPort}), gomock.Any(), directionIngress, actionMirror) + c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, gomock.InAnyOrder([]uint32{pod1OFPort, pod3OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) + c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, gomock.InAnyOrder([]uint32{pod2OFPort, pod4OFPort}), gomock.Any(), directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) // Process the TrafficControl ADD events for TrafficControl tc1 and tc2. waitEvents(t, 2, c) @@ -721,7 +722,7 @@ func TestPodUpdateFromCNIServer(t *testing.T) { require.Equal(t, expectedState, c.tcStates[tc1Name]) // Mark flows are expected to be installed after the interface of the Pod is ready. - c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod1OFPort}, targetPort1OFPort, directionIngress, actionMirror) + c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod1OFPort}, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) // Add the interface information of the test Pod to interface store to mock the interface of the Pod is ready, then // add an update event to podUpdateChannel to trigger a TrafficControl event. @@ -772,7 +773,7 @@ func TestPodLabelsUpdate(t *testing.T) { eventsTriggeredByPodLabelsUpdate: 2, expectedPodBinding: nil, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -790,8 +791,8 @@ func TestPodLabelsUpdate(t *testing.T) { eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string]()}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -802,8 +803,8 @@ func TestPodLabelsUpdate(t *testing.T) { eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string](tc3Name)}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -947,7 +948,7 @@ func TestNamespaceLabelsUpdate(t *testing.T) { updatedNS: newNamespace("ns1", nil), eventsTriggeredByNSLabelsUpdate: 2, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -965,8 +966,8 @@ func TestNamespaceLabelsUpdate(t *testing.T) { eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string]()}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -977,8 +978,8 @@ func TestNamespaceLabelsUpdate(t *testing.T) { eventsTriggeredByPodEffectiveTCUpdate: 1, expectedPodBinding: &podToTCBinding{effectiveTC: tc2Name, alternativeTCs: sets.New[string](tc3Name)}, expectedCalls: func(mockOFClient *openflowtest.MockClient) { - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror) - mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, nil, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) + mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc2Name, []uint32{pod1OFPort}, targetPort2OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) }, }, { @@ -1156,7 +1157,7 @@ func TestPodDelete(t *testing.T) { c.queue.Done(item) } - c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod3OFPort}, targetPort1OFPort, directionIngress, actionMirror) + c.mockOFClient.EXPECT().InstallTrafficControlMarkFlows(tc1Name, []uint32{pod3OFPort}, targetPort1OFPort, directionIngress, actionMirror, openflow.TrafficControlFlowPriorityMedium) expectedPod3Binding := &podToTCBinding{ effectiveTC: tc1Name, alternativeTCs: sets.New[string](tc2Name, tc3Name), diff --git a/pkg/agent/openflow/client.go b/pkg/agent/openflow/client.go index 45acf46aac5..b22e2e2ee69 100644 --- a/pkg/agent/openflow/client.go +++ b/pkg/agent/openflow/client.go @@ -39,6 +39,27 @@ import ( const maxRetryForOFSwitch = 5 +type TrafficControlFlowPriority string + +const ( + TrafficControlFlowPriorityHigh TrafficControlFlowPriority = "high" + TrafficControlFlowPriorityMedium TrafficControlFlowPriority = "medium" + TrafficControlFlowPriorityLow TrafficControlFlowPriority = "low" +) + +func (p TrafficControlFlowPriority) toOFPriority() uint16 { + switch p { + case TrafficControlFlowPriorityHigh: + return priorityHigh + case TrafficControlFlowPriorityMedium: + return priorityNormal + case TrafficControlFlowPriorityLow: + return priorityLow + default: + return 0 + } +} + // Client is the interface to program OVS flows for entity connectivity of Antrea. type Client interface { // Initialize sets up all basic flows on the specific OVS bridge. It returns a channel which @@ -323,7 +344,12 @@ type Client interface { igmp ofutil.Message) error // InstallTrafficControlMarkFlows installs the flows to mark the packets for a traffic control rule. - InstallTrafficControlMarkFlows(name string, sourceOFPorts []uint32, targetOFPort uint32, direction crdv1alpha2.Direction, action crdv1alpha2.TrafficControlAction) error + InstallTrafficControlMarkFlows(name string, + sourceOFPorts []uint32, + targetOFPort uint32, + direction crdv1alpha2.Direction, + action crdv1alpha2.TrafficControlAction, + priority TrafficControlFlowPriority) error // UninstallTrafficControlMarkFlows removes the flows for a traffic control rule. UninstallTrafficControlMarkFlows(name string) error @@ -1449,8 +1475,13 @@ func (c *client) SendIGMPQueryPacketOut( return c.bridge.SendPacketOut(packetOutObj) } -func (c *client) InstallTrafficControlMarkFlows(name string, sourceOFPorts []uint32, targetOFPort uint32, direction crdv1alpha2.Direction, action crdv1alpha2.TrafficControlAction) error { - flows := c.featurePodConnectivity.trafficControlMarkFlows(sourceOFPorts, targetOFPort, direction, action) +func (c *client) InstallTrafficControlMarkFlows(name string, + sourceOFPorts []uint32, + targetOFPort uint32, + direction crdv1alpha2.Direction, + action crdv1alpha2.TrafficControlAction, + priority TrafficControlFlowPriority) error { + flows := c.featurePodConnectivity.trafficControlMarkFlows(sourceOFPorts, targetOFPort, direction, action, priority.toOFPriority()) cacheKey := fmt.Sprintf("tc_%s", name) c.replayMutex.RLock() defer c.replayMutex.RUnlock() diff --git a/pkg/agent/openflow/client_test.go b/pkg/agent/openflow/client_test.go index 8ce11c86263..ee889ce5d7a 100644 --- a/pkg/agent/openflow/client_test.go +++ b/pkg/agent/openflow/client_test.go @@ -2425,7 +2425,7 @@ func Test_client_InstallTrafficControlMarkFlows(t *testing.T) { cacheKey := fmt.Sprintf("tc_%s", tcName) - assert.NoError(t, fc.InstallTrafficControlMarkFlows(tcName, sourceOFPorts, targetOFPort, tc.direction, tc.action)) + assert.NoError(t, fc.InstallTrafficControlMarkFlows(tcName, sourceOFPorts, targetOFPort, tc.direction, tc.action, TrafficControlFlowPriorityMedium)) fCacheI, ok := fc.featurePodConnectivity.tcCachedFlows.Load(cacheKey) require.True(t, ok) assert.ElementsMatch(t, tc.expectedFlows, getFlowStrings(fCacheI)) @@ -2768,7 +2768,7 @@ func Test_client_ReplayFlows(t *testing.T) { ) sourceOFPorts := []uint32{50, 100} targetOFPort := uint32(200) - addFlowInCache(fc.featurePodConnectivity.tcCachedFlows, "tcFlows", fc.featurePodConnectivity.trafficControlMarkFlows(sourceOFPorts, targetOFPort, v1alpha2.DirectionEgress, v1alpha2.ActionMirror)) + addFlowInCache(fc.featurePodConnectivity.tcCachedFlows, "tcFlows", fc.featurePodConnectivity.trafficControlMarkFlows(sourceOFPorts, targetOFPort, v1alpha2.DirectionEgress, v1alpha2.ActionMirror, priorityNormal)) replayedFlows = append(replayedFlows, "cookie=0x1010000000000, table=TrafficControl, priority=200,in_port=50 actions=set_field:0xc8->reg9,set_field:0x400000/0xc00000->reg4,goto_table:IngressSecurityClassifier", "cookie=0x1010000000000, table=TrafficControl, priority=200,in_port=100 actions=set_field:0xc8->reg9,set_field:0x400000/0xc00000->reg4,goto_table:IngressSecurityClassifier", diff --git a/pkg/agent/openflow/network_policy.go b/pkg/agent/openflow/network_policy.go index 8a8c96a344d..9ea7de9983c 100644 --- a/pkg/agent/openflow/network_policy.go +++ b/pkg/agent/openflow/network_policy.go @@ -2218,7 +2218,7 @@ func (f *featureNetworkPolicy) l7NPTrafficControlFlows() []binding.Flow { // This generates the flow to output the packets marked with L7NPRedirectCTMark to an application-aware engine // via the target ofPort. Note that, before outputting the packets, VLAN ID stored on field L7NPRuleVlanIDCTMarkField // will be copied to VLAN ID register (OXM_OF_VLAN_VID) to set VLAN ID of the packets. - OutputTable.ofTable.BuildFlow(priorityHigh+1). + OutputTable.ofTable.BuildFlow(priorityHigh+2). Cookie(cookieID). MatchRegMark(OutputToOFPortRegMark). MatchCTMark(L7NPRedirectCTMark). @@ -2239,7 +2239,7 @@ func (f *featureNetworkPolicy) l7NPTrafficControlFlows() []binding.Flow { Done(), // This generates the flow to forward the returned packets (with FromTCReturnRegMark) to stageOutput directly // after loading output port number to reg1 in L2ForwardingCalcTable. - TrafficControlTable.ofTable.BuildFlow(priorityHigh). + TrafficControlTable.ofTable.BuildFlow(priorityHigh+1). Cookie(cookieID). MatchRegMark(OutputToOFPortRegMark, FromTCReturnRegMark). Action().GotoStage(stageOutput). diff --git a/pkg/agent/openflow/network_policy_test.go b/pkg/agent/openflow/network_policy_test.go index 898b178f7b8..355d3f4a23b 100644 --- a/pkg/agent/openflow/network_policy_test.go +++ b/pkg/agent/openflow/network_policy_test.go @@ -1403,8 +1403,8 @@ func networkPolicyInitFlows(ovsMeterSupported, externalNodeEnabled, l7NetworkPol if l7NetworkPolicyEnabled { initFlows = append(initFlows, "cookie=0x1020000000000, table=Classifier, priority=200,in_port=11,vlan_tci=0x1000/0x1000 actions=pop_vlan,set_field:0x6/0xf->reg0,goto_table:L3Forwarding", - "cookie=0x1020000000000, table=TrafficControl, priority=210,reg0=0x200006/0x60000f actions=goto_table:Output", - "cookie=0x1020000000000, table=Output, priority=211,ct_mark=0x80/0x80,reg0=0x200000/0x600000 actions=push_vlan:0x8100,move:NXM_NX_CT_LABEL[64..75]->OXM_OF_VLAN_VID[0..11],output:10", + "cookie=0x1020000000000, table=TrafficControl, priority=211,reg0=0x200006/0x60000f actions=goto_table:Output", + "cookie=0x1020000000000, table=Output, priority=212,ct_mark=0x80/0x80,reg0=0x200000/0x600000 actions=push_vlan:0x8100,move:NXM_NX_CT_LABEL[64..75]->OXM_OF_VLAN_VID[0..11],output:10", ) } return initFlows diff --git a/pkg/agent/openflow/pod_connectivity.go b/pkg/agent/openflow/pod_connectivity.go index 7a073b5bdbd..ec9b366e65c 100644 --- a/pkg/agent/openflow/pod_connectivity.go +++ b/pkg/agent/openflow/pod_connectivity.go @@ -200,7 +200,11 @@ func (f *featurePodConnectivity) replayFlows() []*openflow15.FlowMod { } // trafficControlMarkFlows generates the flows to mark the packets that need to be redirected or mirrored. -func (f *featurePodConnectivity) trafficControlMarkFlows(sourceOFPorts []uint32, targetOFPort uint32, direction v1alpha2.Direction, action v1alpha2.TrafficControlAction) []binding.Flow { +func (f *featurePodConnectivity) trafficControlMarkFlows(sourceOFPorts []uint32, + targetOFPort uint32, + direction v1alpha2.Direction, + action v1alpha2.TrafficControlAction, + priority uint16) []binding.Flow { cookieID := f.cookieAllocator.Request(f.category).Raw() var actionRegMark *binding.RegMark if action == v1alpha2.ActionRedirect { @@ -212,7 +216,7 @@ func (f *featurePodConnectivity) trafficControlMarkFlows(sourceOFPorts []uint32, for _, port := range sourceOFPorts { if direction == v1alpha2.DirectionIngress || direction == v1alpha2.DirectionBoth { // This generates the flow to mark the packets destined for a provided port. - flows = append(flows, TrafficControlTable.ofTable.BuildFlow(priorityNormal). + flows = append(flows, TrafficControlTable.ofTable.BuildFlow(priority). Cookie(cookieID). MatchRegFieldWithValue(TargetOFPortField, port). Action().LoadToRegField(TrafficControlTargetOFPortField, targetOFPort). @@ -222,7 +226,7 @@ func (f *featurePodConnectivity) trafficControlMarkFlows(sourceOFPorts []uint32, } // This generates the flow to mark the packets sourced from a provided port. if direction == v1alpha2.DirectionEgress || direction == v1alpha2.DirectionBoth { - flows = append(flows, TrafficControlTable.ofTable.BuildFlow(priorityNormal). + flows = append(flows, TrafficControlTable.ofTable.BuildFlow(priority). Cookie(cookieID). MatchInPort(port). Action().LoadToRegField(TrafficControlTargetOFPortField, targetOFPort). diff --git a/pkg/agent/openflow/testing/mock_openflow.go b/pkg/agent/openflow/testing/mock_openflow.go index af1e9a34cc2..512190802d2 100644 --- a/pkg/agent/openflow/testing/mock_openflow.go +++ b/pkg/agent/openflow/testing/mock_openflow.go @@ -28,10 +28,11 @@ import ( reflect "reflect" config "antrea.io/antrea/pkg/agent/config" + openflow "antrea.io/antrea/pkg/agent/openflow" types "antrea.io/antrea/pkg/agent/types" v1beta2 "antrea.io/antrea/pkg/apis/controlplane/v1beta2" v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - openflow "antrea.io/antrea/pkg/ovs/openflow" + openflow0 "antrea.io/antrea/pkg/ovs/openflow" ip "antrea.io/antrea/pkg/util/ip" proxy "antrea.io/antrea/third_party/proxy" openflow15 "antrea.io/libOpenflow/openflow15" @@ -163,10 +164,10 @@ func (mr *MockClientMockRecorder) Disconnect() *gomock.Call { } // GetFlowTableStatus mocks base method. -func (m *MockClient) GetFlowTableStatus() []openflow.TableStatus { +func (m *MockClient) GetFlowTableStatus() []openflow0.TableStatus { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetFlowTableStatus") - ret0, _ := ret[0].([]openflow.TableStatus) + ret0, _ := ret[0].([]openflow0.TableStatus) return ret0 } @@ -223,7 +224,7 @@ func (mr *MockClientMockRecorder) GetPolicyInfoFromConjunction(arg0 any) *gomock } // GetServiceFlowKeys mocks base method. -func (m *MockClient) GetServiceFlowKeys(arg0 net.IP, arg1 uint16, arg2 openflow.Protocol, arg3 []proxy.Endpoint) []string { +func (m *MockClient) GetServiceFlowKeys(arg0 net.IP, arg1 uint16, arg2 openflow0.Protocol, arg3 []proxy.Endpoint) []string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetServiceFlowKeys", arg0, arg1, arg2, arg3) ret0, _ := ret[0].([]string) @@ -280,7 +281,7 @@ func (mr *MockClientMockRecorder) InstallEgressQoS(arg0, arg1, arg2 any) *gomock } // InstallEndpointFlows mocks base method. -func (m *MockClient) InstallEndpointFlows(arg0 openflow.Protocol, arg1 []proxy.Endpoint) error { +func (m *MockClient) InstallEndpointFlows(arg0 openflow0.Protocol, arg1 []proxy.Endpoint) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallEndpointFlows", arg0, arg1) ret0, _ := ret[0].(error) @@ -294,7 +295,7 @@ func (mr *MockClientMockRecorder) InstallEndpointFlows(arg0, arg1 any) *gomock.C } // InstallMulticastFlows mocks base method. -func (m *MockClient) InstallMulticastFlows(arg0 net.IP, arg1 openflow.GroupIDType) error { +func (m *MockClient) InstallMulticastFlows(arg0 net.IP, arg1 openflow0.GroupIDType) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallMulticastFlows", arg0, arg1) ret0, _ := ret[0].(error) @@ -308,7 +309,7 @@ func (mr *MockClientMockRecorder) InstallMulticastFlows(arg0, arg1 any) *gomock. } // InstallMulticastGroup mocks base method. -func (m *MockClient) InstallMulticastGroup(arg0 openflow.GroupIDType, arg1 []uint32, arg2 []net.IP) error { +func (m *MockClient) InstallMulticastGroup(arg0 openflow0.GroupIDType, arg1 []uint32, arg2 []net.IP) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallMulticastGroup", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -322,7 +323,7 @@ func (mr *MockClientMockRecorder) InstallMulticastGroup(arg0, arg1, arg2 any) *g } // InstallMulticastRemoteReportFlows mocks base method. -func (m *MockClient) InstallMulticastRemoteReportFlows(arg0 openflow.GroupIDType) error { +func (m *MockClient) InstallMulticastRemoteReportFlows(arg0 openflow0.GroupIDType) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallMulticastRemoteReportFlows", arg0) ret0, _ := ret[0].(error) @@ -434,7 +435,7 @@ func (mr *MockClientMockRecorder) InstallPodSNATFlows(arg0, arg1, arg2 any) *gom } // InstallPolicyBypassFlows mocks base method. -func (m *MockClient) InstallPolicyBypassFlows(arg0 openflow.Protocol, arg1 *net.IPNet, arg2 uint16, arg3 bool) error { +func (m *MockClient) InstallPolicyBypassFlows(arg0 openflow0.Protocol, arg1 *net.IPNet, arg2 uint16, arg3 bool) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallPolicyBypassFlows", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -504,7 +505,7 @@ func (mr *MockClientMockRecorder) InstallServiceFlows(arg0 any) *gomock.Call { } // InstallServiceGroup mocks base method. -func (m *MockClient) InstallServiceGroup(arg0 openflow.GroupIDType, arg1 bool, arg2 []proxy.Endpoint) error { +func (m *MockClient) InstallServiceGroup(arg0 openflow0.GroupIDType, arg1 bool, arg2 []proxy.Endpoint) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallServiceGroup", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -518,7 +519,7 @@ func (mr *MockClientMockRecorder) InstallServiceGroup(arg0, arg1, arg2 any) *gom } // InstallTraceflowFlows mocks base method. -func (m *MockClient) InstallTraceflowFlows(arg0 byte, arg1, arg2, arg3 bool, arg4 *openflow.Packet, arg5 uint32, arg6 uint16) error { +func (m *MockClient) InstallTraceflowFlows(arg0 byte, arg1, arg2, arg3 bool, arg4 *openflow0.Packet, arg5 uint32, arg6 uint16) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InstallTraceflowFlows", arg0, arg1, arg2, arg3, arg4, arg5, arg6) ret0, _ := ret[0].(error) @@ -532,17 +533,17 @@ func (mr *MockClientMockRecorder) InstallTraceflowFlows(arg0, arg1, arg2, arg3, } // InstallTrafficControlMarkFlows mocks base method. -func (m *MockClient) InstallTrafficControlMarkFlows(arg0 string, arg1 []uint32, arg2 uint32, arg3 v1alpha2.Direction, arg4 v1alpha2.TrafficControlAction) error { +func (m *MockClient) InstallTrafficControlMarkFlows(arg0 string, arg1 []uint32, arg2 uint32, arg3 v1alpha2.Direction, arg4 v1alpha2.TrafficControlAction, arg5 openflow.TrafficControlFlowPriority) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InstallTrafficControlMarkFlows", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "InstallTrafficControlMarkFlows", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(error) return ret0 } // InstallTrafficControlMarkFlows indicates an expected call of InstallTrafficControlMarkFlows. -func (mr *MockClientMockRecorder) InstallTrafficControlMarkFlows(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockClientMockRecorder) InstallTrafficControlMarkFlows(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InstallTrafficControlMarkFlows", reflect.TypeOf((*MockClient)(nil).InstallTrafficControlMarkFlows), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InstallTrafficControlMarkFlows", reflect.TypeOf((*MockClient)(nil).InstallTrafficControlMarkFlows), arg0, arg1, arg2, arg3, arg4, arg5) } // InstallTrafficControlReturnPortFlow mocks base method. @@ -724,7 +725,7 @@ func (mr *MockClientMockRecorder) ResumePausePacket(arg0 any) *gomock.Call { } // SendEthPacketOut mocks base method. -func (m *MockClient) SendEthPacketOut(arg0, arg1 uint32, arg2 *protocol.Ethernet, arg3 func(openflow.PacketOutBuilder) openflow.PacketOutBuilder) error { +func (m *MockClient) SendEthPacketOut(arg0, arg1 uint32, arg2 *protocol.Ethernet, arg3 func(openflow0.PacketOutBuilder) openflow0.PacketOutBuilder) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendEthPacketOut", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -738,7 +739,7 @@ func (mr *MockClientMockRecorder) SendEthPacketOut(arg0, arg1, arg2, arg3 any) * } // SendICMPPacketOut mocks base method. -func (m *MockClient) SendICMPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 byte, arg9 []byte, arg10 func(openflow.PacketOutBuilder) openflow.PacketOutBuilder) error { +func (m *MockClient) SendICMPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 byte, arg9 []byte, arg10 func(openflow0.PacketOutBuilder) openflow0.PacketOutBuilder) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendICMPPacketOut", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) ret0, _ := ret[0].(error) @@ -780,7 +781,7 @@ func (mr *MockClientMockRecorder) SendIGMPRemoteReportPacketOut(arg0, arg1, arg2 } // SendTCPPacketOut mocks base method. -func (m *MockClient) SendTCPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 uint16, arg9, arg10 uint32, arg11, arg12 byte, arg13 uint16, arg14 []byte, arg15 func(openflow.PacketOutBuilder) openflow.PacketOutBuilder) error { +func (m *MockClient) SendTCPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 uint16, arg9, arg10 uint32, arg11, arg12 byte, arg13 uint16, arg14 []byte, arg15 func(openflow0.PacketOutBuilder) openflow0.PacketOutBuilder) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendTCPPacketOut", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) ret0, _ := ret[0].(error) @@ -794,7 +795,7 @@ func (mr *MockClientMockRecorder) SendTCPPacketOut(arg0, arg1, arg2, arg3, arg4, } // SendTraceflowPacket mocks base method. -func (m *MockClient) SendTraceflowPacket(arg0 byte, arg1 *openflow.Packet, arg2 uint32, arg3 int32) error { +func (m *MockClient) SendTraceflowPacket(arg0 byte, arg1 *openflow0.Packet, arg2 uint32, arg3 int32) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendTraceflowPacket", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) @@ -808,7 +809,7 @@ func (mr *MockClientMockRecorder) SendTraceflowPacket(arg0, arg1, arg2, arg3 any } // SendUDPPacketOut mocks base method. -func (m *MockClient) SendUDPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 uint16, arg9 []byte, arg10 func(openflow.PacketOutBuilder) openflow.PacketOutBuilder) error { +func (m *MockClient) SendUDPPacketOut(arg0, arg1, arg2, arg3 string, arg4, arg5 uint32, arg6 bool, arg7, arg8 uint16, arg9 []byte, arg10 func(openflow0.PacketOutBuilder) openflow0.PacketOutBuilder) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendUDPPacketOut", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) ret0, _ := ret[0].(error) @@ -834,7 +835,7 @@ func (mr *MockClientMockRecorder) StartPacketInHandler(arg0 any) *gomock.Call { } // SubscribePacketIn mocks base method. -func (m *MockClient) SubscribePacketIn(arg0 byte, arg1 *openflow.PacketInQueue) error { +func (m *MockClient) SubscribePacketIn(arg0 byte, arg1 *openflow0.PacketInQueue) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SubscribePacketIn", arg0, arg1) ret0, _ := ret[0].(error) @@ -862,7 +863,7 @@ func (mr *MockClientMockRecorder) UninstallEgressQoS(arg0 any) *gomock.Call { } // UninstallEndpointFlows mocks base method. -func (m *MockClient) UninstallEndpointFlows(arg0 openflow.Protocol, arg1 []proxy.Endpoint) error { +func (m *MockClient) UninstallEndpointFlows(arg0 openflow0.Protocol, arg1 []proxy.Endpoint) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UninstallEndpointFlows", arg0, arg1) ret0, _ := ret[0].(error) @@ -890,7 +891,7 @@ func (mr *MockClientMockRecorder) UninstallMulticastFlows(arg0 any) *gomock.Call } // UninstallMulticastGroup mocks base method. -func (m *MockClient) UninstallMulticastGroup(arg0 openflow.GroupIDType) error { +func (m *MockClient) UninstallMulticastGroup(arg0 openflow0.GroupIDType) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UninstallMulticastGroup", arg0) ret0, _ := ret[0].(error) @@ -1003,7 +1004,7 @@ func (mr *MockClientMockRecorder) UninstallSNATMarkFlows(arg0 any) *gomock.Call } // UninstallServiceFlows mocks base method. -func (m *MockClient) UninstallServiceFlows(arg0 net.IP, arg1 uint16, arg2 openflow.Protocol) error { +func (m *MockClient) UninstallServiceFlows(arg0 net.IP, arg1 uint16, arg2 openflow0.Protocol) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UninstallServiceFlows", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -1017,7 +1018,7 @@ func (mr *MockClientMockRecorder) UninstallServiceFlows(arg0, arg1, arg2 any) *g } // UninstallServiceGroup mocks base method. -func (m *MockClient) UninstallServiceGroup(arg0 openflow.GroupIDType) error { +func (m *MockClient) UninstallServiceGroup(arg0 openflow0.GroupIDType) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UninstallServiceGroup", arg0) ret0, _ := ret[0].(error) @@ -1124,7 +1125,7 @@ func (mr *MockOFEntryOperationsMockRecorder) AddAll(arg0 any) *gomock.Call { } // AddOFEntries mocks base method. -func (m *MockOFEntryOperations) AddOFEntries(arg0 []openflow.OFEntry) error { +func (m *MockOFEntryOperations) AddOFEntries(arg0 []openflow0.OFEntry) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddOFEntries", arg0) ret0, _ := ret[0].(error) @@ -1166,7 +1167,7 @@ func (mr *MockOFEntryOperationsMockRecorder) DeleteAll(arg0 any) *gomock.Call { } // DeleteOFEntries mocks base method. -func (m *MockOFEntryOperations) DeleteOFEntries(arg0 []openflow.OFEntry) error { +func (m *MockOFEntryOperations) DeleteOFEntries(arg0 []openflow0.OFEntry) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteOFEntries", arg0) ret0, _ := ret[0].(error) @@ -1194,7 +1195,7 @@ func (mr *MockOFEntryOperationsMockRecorder) ModifyAll(arg0 any) *gomock.Call { } // ModifyOFEntries mocks base method. -func (m *MockOFEntryOperations) ModifyOFEntries(arg0 []openflow.OFEntry) error { +func (m *MockOFEntryOperations) ModifyOFEntries(arg0 []openflow0.OFEntry) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ModifyOFEntries", arg0) ret0, _ := ret[0].(error) diff --git a/test/integration/agent/openflow_test.go b/test/integration/agent/openflow_test.go index 8070a45a052..3d71727c31e 100644 --- a/test/integration/agent/openflow_test.go +++ b/test/integration/agent/openflow_test.go @@ -1874,7 +1874,7 @@ func TestTrafficControlFlows(t *testing.T) { returnOFPort := uint32(201) expectedFlows := prepareTrafficControlFlows(sourceOFPorts, targetOFPort, returnOFPort) c.InstallTrafficControlReturnPortFlow(returnOFPort) - c.InstallTrafficControlMarkFlows("tc", sourceOFPorts, targetOFPort, v1alpha2.DirectionBoth, v1alpha2.ActionRedirect) + c.InstallTrafficControlMarkFlows("tc", sourceOFPorts, targetOFPort, v1alpha2.DirectionBoth, v1alpha2.ActionRedirect, ofClient.TrafficControlFlowPriorityMedium) for _, tableFlow := range expectedFlows { ofTestUtils.CheckFlowExists(t, ovsCtlClient, tableFlow.tableName, 0, true, tableFlow.flows) }