digitalocean/go-openvswitch

ovs: ability to set VLAN tag on port

Opened this issue ยท 6 comments

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.

func (v *VSwitchService) AddPort(bridge string, port string) error {
_, err := v.exec("--may-exist", "add-port", bridge, string(port))
return err
}

Thanks.

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?

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.

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.

Please have a look. #57

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: #56 (comment) 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.

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