Skip to content

WIP: GRE tunnel plugin#3554

Merged
ipspace merged 2 commits into
devfrom
feature/tunnel.gre
Jul 2, 2026
Merged

WIP: GRE tunnel plugin#3554
ipspace merged 2 commits into
devfrom
feature/tunnel.gre

Conversation

@ipspace

@ipspace ipspace commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Already done:

  • Attributes, basic logic
  • Most of the utility functions
  • Transformation coverage test

Still missing:

  • Tunnel source/destination calculations
  • Device templates
  • Documentation

@ipspace ipspace marked this pull request as draft June 30, 2026 16:19
Comment thread netsim/extra/tunnel.gre/defaults.yml Outdated
@jbemmel

jbemmel commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Could we use extra/tunnel/gre as path, so all tunnel plugins are together?

@ipspace

ipspace commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

Could we use extra/tunnel/gre as path, so all tunnel plugins are together?

No idea, never tested it. Will try it out

This comment was marked as outdated.

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Comment thread netsim/extra/tunnel.gre/plugin.py Outdated
Comment thread netsim/utils/tunnel.py Outdated
Comment thread netsim/utils/tunnel.py
The plugin implements GRE tunnel logic, including:

* Tunnel attributes
* Setting tunnel type on links with tunnel attributes
* Figuring out tunnel source and destination IP addresses

Shared code is implemented in a utility module, potentially optimizing
other tunnel implementations.

Included in the PR:

* Plugin, attributes, utility functions
* Coverage transformation test
* GRE and GRE-in-VRF integration tests
* Cisco IOS implementation
* Documentation
@ipspace ipspace force-pushed the feature/tunnel.gre branch from a5833ef to 45392ba Compare July 1, 2026 10:58
@ipspace ipspace marked this pull request as ready for review July 1, 2026 11:03
@ipspace ipspace requested review from DanPartelly and jbemmel July 1, 2026 11:03
@ipspace

ipspace commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

@jbemmel, @DanPartelly -- The tunnel.gre plugin is ready. Based on @jbemmel suggestion, I changed the source attribute names to tunnel.source.link.something. Will figure out how to put 'tunnel.gre' plugin in 'tunnel/gre' directory as a separate PR.

link:
tunnel:
af: # Transport address family
{ type: str, valid_values: [ ipv4, ipv6] }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

spacing

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Dang, missed it before merging. Maybe we have to update yamllint defaults ;)

# Second pass -- after computing tunnel source for all GRE interfaces, set tunnel destinations
#
for node in node_iflist: # Process only nodes with tunnel interfaces
ndata = topology.nodes[node] # Get node data (we might need it)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

unused?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

As I said, we might need it ;) Interestingly, none of the code checking tools complain about setting a variable value and not using it afterwards; they only complain about unused variable.

Comment thread netsim/utils/tunnel.py
continue

if t_name and t_name != intf.get('name',None):
continue # Mismatch in interface name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

link name - that's the confusing part I noted earlier

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Yeah, of course I agree, but that ship has sailed years ago...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The comment should say "Mismatch in link name"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

IIRC I tested and you can specify 'name' on an individual interface, which would make this exactly what it says

Comment thread netsim/utils/tunnel.py
if t_af not in intf: # Is the interface enabled for the desired tunnel transport AF
continue

if not isinstance(intf[t_af],str): # Cannot run tunnels from unnumbered interfaces

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should generate a (suppressible) warning?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Let's see how this evolves. We could either generate errors in here or in the caller function. We could be more precise here, but would have more context in the caller.

@jbemmel jbemmel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some minor tweaks, I think we will find that much of the code is applicable to other tunnel types as well but we can refactor as we go

@DanPartelly DanPartelly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you Ivan.

Comment thread netsim/devices/ios.yml
@ipspace ipspace merged commit 8ec92da into dev Jul 2, 2026
12 checks passed
@ipspace ipspace deleted the feature/tunnel.gre branch July 2, 2026 05:40
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.

4 participants