This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
T7283: VPP add static NAT support #24
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dmbaturin
suggested changes
Mar 25, 2025
d2e066f to
97e44e5
Compare
zdc
suggested changes
Mar 27, 2025
451384d to
d73016a
Compare
zdc
approved these changes
Apr 1, 2025
python/vyos/vpp/utils.py
Outdated
Comment on lines
161
to
176
| def vpp_iface_name_by_index(vpp_api, index: int) -> str | None: | ||
| """Find interface name by interface index in VPP | ||
| Args: | ||
| vpp_api (_type_): VPP API object | ||
| index (int): interface index inside VPP | ||
| Returns: | ||
| str | None: Interface name or None (if was not found) | ||
| """ | ||
| for iface in vpp_api.sw_interface_dump(): | ||
| if iface.sw_if_index == index: | ||
| return iface.interface_name | ||
| return None | ||
|
|
||
|
|
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an idea: should we keep this and this together?
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put them together in the control_vpp.py
Add static mapping NAT implementation ``` set vpp nat44 static rule 10 outbound-interface 'eth0' set vpp nat44 static rule 10 inbound-interface 'eth1' set vpp nat44 static rule 10 destination address 192.168.122.10 # optional, if not set outbound interface ip address is used set vpp nat44 static rule 10 destination port 6545 # optional set vpp nat44 static rule 10 protocol tcp|udp|icmp|all # optional, defaults to "all" set vpp nat44 static rule 10 translation address 100.64.0.10 set vpp nat44 static rule 10 translation port 64010 # optional ```
dmbaturin
approved these changes
Apr 1, 2025
| """Add NAT44 interface""" | ||
| self.vpp.api.nat44_interface_add_del_feature( | ||
| flags=1, | ||
| flags=0x20, |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a constant. If there are issues with constants in the VPP module, we can just add it at the top of the script. Magic numbers are easy to forget, and we never know if VPP may change them.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add static mapping NAT implementation
Change Summary
Types of changes
Related Task(s)
Related PR(s)
Proposed changes
How to test
Check VPP NAT44
Checklist: