def create_vlan_interface(namespace, port_name, mac_address, ip_address, vlan_tag):
 ip_wrap = ip_lib.IPWrapper(namespace)
 dev_name = ('%s.%d' % (port_name, vlan_tag))
 ip_wrap.add_vlan(dev_name, port_name, vlan_tag)
 dev = ip_wrap.device(dev_name)
 dev.addr.add(str(ip_address))
 dev.link.set_address(mac_address)
 dev.link.set_up()
 return dev

def create_vlan_interface ( namespace , port_name , mac_address , ip_address , vlan_tag ) : ip_wrap = ip_lib . IPWrapper ( namespace ) dev_name = ( '%s.%d' % ( port_name , vlan_tag ) ) ip_wrap . add_vlan ( dev_name , port_name , vlan_tag ) dev = ip_wrap . device ( dev_name ) dev . addr . add ( str ( ip_address ) ) dev . link . set_address ( mac_address ) dev . link . set_up ( ) return dev
create a vlan interface in namespace with ip address .