How to create an ethernet frame in python with a specification of VLAN?
I have the IP and TCP header ready. I need to attach the ethernet header to it.
You can use Scapy:
from scapy import inet
newpkt = inet.Ether()/inet.Dot1Q(vlan=1)/inet.IP()
There are many tutorials... You can start with this: http://www.secdev.org/projects/scapy/doc/usage.html
If you wanna play with sockets, you can find a good example at https://github.com/osrg/openvswitch/blob/master/utilities/ovs-vlan-test.in