Add a new virtual link with the type set to VLAN.

    Creates a new vlan device {name} on device {port}.
    Will raise an exception if value is already assigned.

    :param enode: Engine node to communicate with.
    :type enode: topology.platforms.base.BaseNode
    :param str portlbl: Port label to configure. Port label will be mapped
     automatically.
    :param str name: specifies the name of the new virtual device.
    :param str vlan_id: specifies the VLAN identifier.
    :param str shell: Shell name to execute commands. If ``None``, use the
     Engine Node default shell.

def add_link_type_vlan(enode, portlbl, name, vlan_id, shell=None):
    """
    Add a new virtual link with the type set to VLAN.

    Creates a new vlan device {name} on device {port}.
    Will raise an exception if value is already assigned.

    :param enode: Engine node to communicate with.
    :type enode: topology.platforms.base.BaseNode
    :param str portlbl: Port label to configure. Port label will be mapped
     automatically.
    :param str name: specifies the name of the new virtual device.
    :param str vlan_id: specifies the VLAN identifier.
    :param str shell: Shell name to execute commands. If ``None``, use the
     Engine Node default shell.
    """
    assert name
    if name in enode.ports:
        raise ValueError('Port {name} already exists'.format(name=name))

    assert portlbl
    assert vlan_id
    port = enode.ports[portlbl]

    cmd = 'ip link add link {dev} name {name} type vlan id {vlan_id}'.format(
        dev=port, name=name, vlan_id=vlan_id)

    response = enode(cmd, shell=shell)
    assert not response, 'Cannot add virtual link {name}'.format(name=name)

    enode.ports[name] = name