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

Add support to modify OF table name #2585

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Conversation

wenyingd
Copy link
Contributor

@wenyingd wenyingd commented Aug 12, 2021

Use readable name for openflow tables.
Fixes #2617

Signed-off-by: wenyingd [email protected]

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #2585 (50c1726) into main (95e836d) will increase coverage by 0.44%.
The diff coverage is 82.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2585      +/-   ##
==========================================
+ Coverage   61.18%   61.62%   +0.44%     
==========================================
  Files         284      283       -1     
  Lines       23494    23625     +131     
==========================================
+ Hits        14374    14559     +185     
+ Misses       7565     7492      -73     
- Partials     1555     1574      +19     
Flag Coverage Δ
e2e-tests ∅ <ø> (?)
kind-e2e-tests 49.33% <80.26%> (+0.67%) ⬆️
unit-tests 40.87% <25.98%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/openflow/client.go 58.33% <ø> (+0.67%) ⬆️
pkg/agent/types/networkpolicy.go 83.33% <ø> (ø)
pkg/antctl/antctl.go 66.66% <0.00%> (-33.34%) ⬇️
pkg/ovs/ovsctl/interface.go 0.00% <ø> (ø)
pkg/ovs/ovsctl/ofctl.go 37.07% <33.33%> (-1.20%) ⬇️
pkg/agent/controller/networkpolicy/packetin.go 72.00% <75.00%> (ø)
pkg/agent/controller/networkpolicy/reconciler.go 77.29% <77.77%> (-0.10%) ⬇️
pkg/agent/openflow/pipeline.go 78.27% <82.42%> (+2.70%) ⬆️
pkg/agent/controller/traceflow/packetin.go 64.60% <83.33%> (+5.11%) ⬆️
pkg/ovs/openflow/ofctrl_bridge.go 54.38% <87.03%> (+4.72%) ⬆️
... and 30 more

@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd wenyingd changed the title [WIP] Add support to modify OF table name Add support to modify OF table name Aug 20, 2021
@wenyingd wenyingd changed the title Add support to modify OF table name [WIP]Add support to modify OF table name Aug 20, 2021
@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd
Copy link
Contributor Author

/test-ipv6-e2e
/test-ipv6-only-conformance
/test-ipv6-only-e2e
/test-networkpolicy
/test-windows-networkpolicy

@wenyingd wenyingd changed the title [WIP]Add support to modify OF table name Add support to modify OF table name Aug 23, 2021
@wenyingd
Copy link
Contributor Author

/test-ipv6-only-e2e

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I was thinking could we define variables for each binding.Table, and so needs not to get the table by c.pipeline[id] every time to save a hash table lookup. But did not get a good idea to maintain the binding.Table - name - ID mapping with some clean/simple code.

pkg/ovs/openflow/ofctrl_bridge.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
@wenyingd wenyingd requested a review from jianjuns August 24, 2021 02:39
@wenyingd wenyingd force-pushed the name_table branch 4 times, most recently from a877a48 to f1ea04f Compare August 24, 2021 15:11
@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just several nits.

pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
@wenyingd wenyingd closed this Sep 1, 2021
antoninbas
antoninbas previously approved these changes Sep 29, 2021
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for addressing comments and resolving the multipart reply receive issue in libOpenflow / ofnet

@wenyingd
Copy link
Contributor Author

/skip-all
/skip-ipv6-all
/skip-ipv6-only-all
/skip-windows-all

Since the change is only for comments but not about logic code, and tests in last round already passed, I skip the tests in this round.

@wenyingd
Copy link
Contributor Author

/skip-all
/skip-ipv6-all
/skip-ipv6-only-all
/skip-windows-all

antoninbas
antoninbas previously approved these changes Sep 30, 2021
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnqn any follow-up comment?

pkg/ovs/openflow/ofctrl_bridge.go Show resolved Hide resolved
@wenyingd
Copy link
Contributor Author

wenyingd commented Oct 8, 2021

/test-all
/test-ipv6-all
/test-ipv6-only-all
/test-windows-all
/test-integration
Rebase the code, so re-trigger the tests here.

@wenyingd
Copy link
Contributor Author

wenyingd commented Oct 8, 2021

/test-conformance

@wenyingd
Copy link
Contributor Author

@tnqn Could you help review this PR again?

// 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, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed when it's not used by any instance below? If this is really needed, it might indicate there is an anti-OOP code in the openflow package where some global variables require some objects to initialize implicitly.

Copy link
Contributor Author

@wenyingd wenyingd Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, these code is added to ensure the functions openflow.GetFlowTableName and openflow.GetFlowTableID are called correctly after the binding.Table is added into cache ofTableCache, and the related logic is called in function createOFTable. To unbreak the code style, I would use function variables in handler.go and use mock functions in the unit test.

pkg/ovs/openflow/ofctrl_bridge.go Show resolved Hide resolved
pkg/ovs/openflow/ofctrl_bridge.go Show resolved Hide resolved
@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all
/test-windows-all

1. Use Multipart messages to query OVS table features and modify the table name property if the table is defined in Antrea pipeline
2. Use openflow.Table in the ofClient under pkg/agent/openflow directly, and remove the pipeline map and FlowTables in pipeline.go
3. Remove the typed type TableIDType, and use uint8 for table id directly.

Signed-off-by: wenyingd <[email protected]>
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all
/test-windows-all

@wenyingd
Copy link
Contributor Author

/test-ipv6-e2e
/test-windows-networkpolicy

1 similar comment
@wenyingd
Copy link
Contributor Author

/test-ipv6-e2e
/test-windows-networkpolicy

@tnqn
Copy link
Member

tnqn commented Oct 19, 2021

@wenyingd I will edit the commit message when merging it. Could you make the commit message of other patches wrapped properly following https://github.com/antrea-io/antrea/blob/main/CONTRIBUTING.md#getting-reviewers in the future?

@tnqn tnqn merged commit 95156bd into antrea-io:main Oct 19, 2021
@wenyingd wenyingd deleted the name_table branch August 15, 2022 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure Openflow tables with name strings
5 participants