Skip to content

Commit

Permalink
Flexible pipeline 7 Misc
Browse files Browse the repository at this point in the history
Signed-off-by: Hongliang Liu <[email protected]>
  • Loading branch information
hongliangl committed Dec 9, 2021
1 parent 871df0f commit 7dab284
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/agent/apiserver/handlers/ovsflows/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func getPodFlows(aq agentquerier.AgentQuerier, podName, namespace string) ([]Res

flowKeys := aq.GetOpenflowClient().GetPodFlowKeys(interfaces[0].InterfaceName)
return dumpMatchedFlows(aq, flowKeys)

}

func getServiceFlows(aq agentquerier.AgentQuerier, serviceName, namespace string) ([]Response, error) {
Expand Down
7 changes: 7 additions & 0 deletions pkg/agent/apiserver/handlers/ovsflows/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import (

"antrea.io/antrea/pkg/agent/interfacestore"
interfacestoretest "antrea.io/antrea/pkg/agent/interfacestore/testing"
"antrea.io/antrea/pkg/agent/openflow"
oftest "antrea.io/antrea/pkg/agent/openflow/testing"
proxytest "antrea.io/antrea/pkg/agent/proxy/testing"
agentquerier "antrea.io/antrea/pkg/agent/querier"
aqtest "antrea.io/antrea/pkg/agent/querier/testing"
cpv1beta "antrea.io/antrea/pkg/apis/controlplane/v1beta2"
binding "antrea.io/antrea/pkg/ovs/openflow"
"antrea.io/antrea/pkg/ovs/ovsconfig"
ovsctltest "antrea.io/antrea/pkg/ovs/ovsctl/testing"
"antrea.io/antrea/pkg/querier"
queriertest "antrea.io/antrea/pkg/querier/testing"
Expand Down Expand Up @@ -131,6 +133,11 @@ func TestServiceFlows(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

// Create openflow.Client to ensure the OVS tables are added into the cache.
bridgeName := "testbr"
bridgeMgmtAddr := binding.GetMgmtAddress(ovsconfig.DefaultOVSRunDir, bridgeName)
openflow.NewClient(bridgeName, bridgeMgmtAddr, ovsconfig.OVSDatapathSystem, true, false, false, false, false, false)

testcases := []testCase{
{
test: "Existing Service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
interfacestoretest "antrea.io/antrea/pkg/agent/interfacestore/testing"
"antrea.io/antrea/pkg/agent/metrics"
"antrea.io/antrea/pkg/agent/openflow"
ofclient "antrea.io/antrea/pkg/agent/openflow"
proxytest "antrea.io/antrea/pkg/agent/proxy/testing"
agenttypes "antrea.io/antrea/pkg/agent/types"
cpv1beta "antrea.io/antrea/pkg/apis/controlplane/v1beta2"
Expand Down Expand Up @@ -83,7 +82,7 @@ var (
Priority: nil,
Name: "",
FlowID: uint32(0),
TableID: ofclient.IngressRuleTable.GetID(),
TableID: uint8(10),
PolicyRef: &np1,
EnableLogging: false,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/flowexporter/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func (exp *FlowExporter) findFlowType(conn flowexporter.Connection) uint8 {
return 0
}
if exp.nodeRouteController.IPInPodSubnets(conn.FlowKey.SourceAddress) {
if conn.Mark == openflow.ServiceCTMark.GetValue() || exp.nodeRouteController.IPInPodSubnets(conn.FlowKey.DestinationAddress) {
if conn.Mark&openflow.ServiceCTMark.GetRange().ToNXRange().ToUint32Mask() == openflow.ServiceCTMark.GetValue() || exp.nodeRouteController.IPInPodSubnets(conn.FlowKey.DestinationAddress) {
if conn.SourcePodName == "" || conn.DestinationPodName == "" {
return ipfixregistry.FlowTypeInterNode
}
Expand Down

0 comments on commit 7dab284

Please sign in to comment.