digitalocean / go-openvswitch

Go packages which enable interacting with Open vSwitch and related tools. Apache 2.0 Licensed.
Other
295 stars 95 forks source link

ovs: ability to set VLAN tag on port #56

Open hwchiu opened 6 years ago

hwchiu commented 6 years ago

Hi. I want to use the vSwitch client to add the port with the vlan tag.

I saw the original AddPort method only accept the interface name but no more options.

https://github.com/digitalocean/go-openvswitch/blob/813765f6db709e0aa0a8d837eac1d3c1518824d0/ovs/vswitch.go#L54-L57

Thanks.

mdlayher commented 6 years ago

I wasn't even aware of this option until now. To clarify, can you not accomplish the same thing by pushing/popping VLANs with flows?

hwchiu commented 6 years ago

In some scenario, we use the normal action to do the simple L2 forwarding and we will use the trunk for some ports and tag for some ports. It's not convenient to use the flow to push/pop vlang when we use the normal action to forward packets.

mdlayher commented 6 years ago

I think I would prefer to add this alongside the other "ovs-vsctl set" methods in this structure: https://github.com/digitalocean/go-openvswitch/blob/master/ovs/vswitch.go#L182 for consistency, rather than adding more parameters to AddPort immediately. PRs are welcome.

chenyunchen commented 6 years ago

Please have a look. #57

steveyiyo commented 1 year ago

Hello everyone in this thread,

I'm currently attempting to add a new network interface card to a bridge and apply a VLAN tag to it, similar to separating it directly from the Ethernet interface, as shown below:

sudo ovs-vsctl add-port ovs-br0 vlan1383 tag=1383 -- set Interface vlan1383 type=internal

I've noticed that the AddPort function doesn't support additional parameters, and I referred to the following sources for guidance: https://github.com/digitalocean/go-openvswitch/issues/56#issuecomment-395152812 and #57 PR (by @chenyunchen).

However, according to the official documentation, ovs-vsctl add-port does support additional features such as GRE, DPDK, erspan, etc. ref: https://docs.openvswitch.org/en/latest/faq/configuration/

I'm interested in finding out if @mdlayher is willing to add more parameters to the AddPort function or if I could help implement these additional features, as it appears that they cannot be implemented through ovs-vsctl.

On a side note, my Open vSwitch version is as follows:

steveyiyo@cr1-tpe:~$ sudo ovs-vsctl -V
ovs-vsctl (Open vSwitch) 3.1.0
DB Schema 8.3.1

Thank you, and please feel free to share any additional ideas or thoughts.

mdlayher commented 1 year ago

I haven't worked for DigitalOcean in several years now. Best of luck.