go-openvswitch icon indicating copy to clipboard operation
go-openvswitch copied to clipboard

ovs: ability to set VLAN tag on port

Open hwchiu opened this issue 7 years ago • 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.

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

Thanks.

hwchiu avatar Jun 06 '18 03:06 hwchiu

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?

mdlayher avatar Jun 06 '18 04:06 mdlayher

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.

hwchiu avatar Jun 06 '18 04:06 hwchiu

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.

mdlayher avatar Jun 06 '18 17:06 mdlayher

Please have a look. #57

chenyunchen avatar Jun 08 '18 07:06 chenyunchen