Skip to content

allow port ranges in floating ip portforwarding - #3756

Merged
mandre merged 1 commit into
gophercloud:mainfrom
rjmercier1:b/portforward
May 28, 2026
Merged

mandre merged 1 commit into
gophercloud:mainfrom
rjmercier1:b/portforward

Conversation

@rjmercier1

@rjmercier1 rjmercier1 commented May 15, 2026 •

Copy link
Copy Markdown

Fixes #3750

Added acceptance tests ranges:

=== RUN TestLayer3PortForwardingsCreateDelete
networking.go:35: Attempting to create network: TESTACC-OSTY0pea
networking.go:42: Successfully created network.
networking.go:305: Attempting to create subnet: TESTACC-3C9Bc0xM
networking.go:312: Successfully created subnet.
layer3.go:155: Attempting to create external router: TESTACC-6aVUKGog
layer3.go:178: Created router: TESTACC-6aVUKGog
networking.go:85: Attempting to create port: TESTACC-ysyRcBdk
networking.go:109: Successfully created port: TESTACC-ysyRcBdk
layer3.go:221: Attempting to add port b510e931-d475-45fd-a34a-4585b82bd1dd to router a257972a-fda3-484c-91eb-6060bd78006f
layer3.go:236: Successfully added port b510e931-d475-45fd-a34a-4585b82bd1dd to router a257972a-fda3-484c-91eb-6060bd78006f
layer3.go:24: Attempting to create floating IP on port:
layer3.go:38: Created floating IP.
tools.go:89: {
"id": "04f3adc1-7c84-4c41-8abc-9998c9040dfe",
"description": "Test floating IP",
"floating_network_id": "97a60fd4-aa21-436f-ba06-97b00865c6b0",
"floating_ip_address": "149.255.36.136",
"port_id": "",
"fixed_ip_address": "",
"tenant_id": "ba25a7a11cda4a3f8f88681a9fed7934",
"project_id": "ba25a7a11cda4a3f8f88681a9fed7934",
"status": "DOWN",
"router_id": "",
"tags": [],
"revision_number": 0
}
layer3.go:74: Attempting to create Port forwarding for floating IP with ID: 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:93: Created Port Forwarding.
tools.go:89: {
"id": "59000e6a-7642-47d5-8b1f-1532520b8eab",
"description": "Test description",
"internal_port_id": "b510e931-d475-45fd-a34a-4585b82bd1dd",
"external_port": 2230,
"external_port_range": "2230:2230",
"protocol": "tcp",
"internal_port": 25,
"internal_port_range": "25:25",
"internal_ip_address": "192.168.54.184"
}
layer3.go:103: Attempting to create Port Range forwarding for floating IP with ID: 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:122: Created Port Range Forwarding.
tools.go:89: {
"id": "3172eb85-a518-465b-93f9-c2e23cf1a111",
"description": "Test description range",
"internal_port_id": "b510e931-d475-45fd-a34a-4585b82bd1dd",
"external_port": 0,
"external_port_range": "1200:1299",
"protocol": "tcp",
"internal_port": 0,
"internal_port_range": "1200:1299",
"internal_ip_address": "192.168.54.184"
}
layer3.go:132: Attempting to delete the port forwarding with ID 3172eb85-a518-465b-93f9-c2e23cf1a111 for floating IP with ID 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:138: Successfully deleted the port forwarding with ID 3172eb85-a518-465b-93f9-c2e23cf1a111 for floating IP with ID 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:132: Attempting to delete the port forwarding with ID 59000e6a-7642-47d5-8b1f-1532520b8eab for floating IP with ID 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:138: Successfully deleted the port forwarding with ID 59000e6a-7642-47d5-8b1f-1532520b8eab for floating IP with ID 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:305: Attempting to delete floating IP: 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:312: Deleted floating IP: 04f3adc1-7c84-4c41-8abc-9998c9040dfe
layer3.go:283: Attempting to detach port b510e931-d475-45fd-a34a-4585b82bd1dd from router a257972a-fda3-484c-91eb-6060bd78006f
layer3.go:298: Successfully detached port b510e931-d475-45fd-a34a-4585b82bd1dd from router a257972a-fda3-484c-91eb-6060bd78006f
layer3.go:265: Attempting to delete router: a257972a-fda3-484c-91eb-6060bd78006f
layer3.go:276: Deleted router: a257972a-fda3-484c-91eb-6060bd78006f
networking.go:553: Attempting to delete subnet: 53265daf-13bd-4bed-ac97-480d865bfefb
networking.go:560: Deleted subnet: 53265daf-13bd-4bed-ac97-480d865bfefb
networking.go:525: Attempting to delete network: 724286e5-306a-448e-9d9a-d1b7289b91c6
networking.go:532: Deleted network: 724286e5-306a-448e-9d9a-d1b7289b91c6
--- PASS: TestLayer3PortForwardingsCreateDelete (17.72s)
PASS
ok github.com/gophercloud/gophercloud/v2/internal/acceptance/openstack/networking/v2/extensions/layer3 17.722s

@github-actions github-actions Bot added the edit:networking This PR updates networking code label May 15, 2026

@winiciusallan winiciusallan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please add some unit and acceptance tests?

Comment thread openstack/networking/v2/extensions/layer3/portforwarding/requests.go Outdated
@rjmercier1

rjmercier1 commented May 15, 2026 via email

Copy link
Copy Markdown
Author

@github-actions github-actions Bot added the edit:testinfra This PR updates testing infrastructure code label May 19, 2026
Comment thread openstack/networking/v2/extensions/layer3/portforwarding/results.go Outdated
@winiciusallan

Copy link
Copy Markdown
Contributor

@mandre would you mind taking a look and probably triggering the tests? 😃

@rjmercier1

rjmercier1 commented May 19, 2026 via email

Copy link
Copy Markdown
Author

@github-actions github-actions Bot added semver:minor Backwards-compatible change backport-v2 This PR will be backported to v2 labels May 20, 2026
@coveralls

coveralls commented May 20, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 63.981% (-0.04%) from 64.021% — rjmercier1:b/portforward into gophercloud:main

@kayrus

kayrus commented May 20, 2026

Copy link
Copy Markdown
Contributor

@rjmercier1 please fix formatting issues to pass linter tests

@rjmercier1

Copy link
Copy Markdown
Author

I think I fixed the linter issue (sorry, kinda new to this w/golang)

@winiciusallan

Copy link
Copy Markdown
Contributor

@rjmercier1 can you rebase the main branch into your branch so we get this fix for the functional-networking job?

also, looks like the unit tests failed due to a problem on the Coveralls server's side.

@kayrus

kayrus commented May 20, 2026

Copy link
Copy Markdown
Contributor

@winiciusallan test infra now automatically rebases on target branch. This is a new error, see also #3760. Probably relates to https://bugs.launchpad.net/neutron/+bug/2152241, but I'm not sure.

@rjmercier1

rjmercier1 commented May 20, 2026 •

Copy link
Copy Markdown
Author

@winiciusallan I did the rebase but there didnt seem to be any changes.

Update: Figured out how to update upstream and have merged latest with my fork

@rjmercier1

Copy link
Copy Markdown
Author

Does anything else need to be done for this PR?

@winiciusallan

winiciusallan commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for your work until now!

Does anything else need to be done for this PR?

The PR looks good, but for completeness, and to cover operations against those fields, I would also add unit tests here in this package

https://github.com/gophercloud/gophercloud/tree/main/openstack/networking/v2/extensions/layer3/portforwarding/testing

The failing CI job is unrelated to your changes, so this shouldn't be blocking.

Would you mind taking a look at the changes, @kayrus?

kayrus
kayrus previously approved these changes May 22, 2026
Comment thread openstack/networking/v2/extensions/layer3/portforwarding/results.go
@github-actions github-actions Bot added the edit:actions This PR updates GitHub Actions code label May 23, 2026
@rjmercier1

Copy link
Copy Markdown
Author

@kayrus I see the PRs I opened on gophercloud/utils and terraform-openstack-provider/utils have been closed. It looks like some attempt was made to move towards the openstack provider using it's own utils but there are still dozens of references to gophercloud/utils in the provider code. How to proceed?

@kayrus

kayrus commented May 26, 2026

Copy link
Copy Markdown
Contributor

I see the PRs I opened on gophercloud/utils and terraform-openstack-provider/utils have been closed
How to proceed?

As I mentioned they're not related to this PR. Once this PR is merged, it will be backported to v2 branch, which is currently used by terraform provider and utils.

Comment thread internal/acceptance/clients/clients.go Outdated
Comment thread openstack/networking/v2/extensions/layer3/portforwarding/testing/requests_test.go Outdated
Comment thread .github/workflows/functional-networking.yaml Outdated
Comment thread internal/acceptance/clients/clients.go Outdated
@github-actions github-actions Bot added the edit:db This PR updates db code label May 26, 2026
@github-actions github-actions Bot added edit:placement This PR updates placement code edit:dependencies This PR updates dependencies labels May 26, 2026
@kayrus
kayrus force-pushed the b/portforward branch 2 times, most recently from 8971697 to 8ef9b2a Compare May 26, 2026 17:42
kayrus
kayrus previously approved these changes May 26, 2026
@kayrus
kayrus requested review from mandre and stephenfin May 26, 2026 18:04

@mandre mandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR 😃
I noticed a few nits that should be addressed before merging, nothing dramatic.

Comment thread openstack/networking/v2/extensions/layer3/portforwarding/requests.go Outdated
Comment thread openstack/networking/v2/extensions/layer3/portforwarding/testing/requests_test.go Outdated
@mandre
mandre enabled auto-merge May 28, 2026 07:23
@mandre
mandre added this pull request to the merge queue May 28, 2026
Merged via the queue into gophercloud:main with commit 89b4226 May 28, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v2 This PR will be backported to v2 edit:actions This PR updates GitHub Actions code edit:db This PR updates db code edit:dependencies This PR updates dependencies edit:networking This PR updates networking code edit:placement This PR updates placement code edit:testinfra This PR updates testing infrastructure code semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

port forwarding should support port ranges

5 participants