'Create a vlan unless it already exists.'

@staticmethod
@utils.synchronized('lock_vlan', external=True)
def ensure_vlan(vlan_num, bridge_interface, mac_address=None, mtu=None, interface=None):

    if (interface is None):
        interface = ('vlan%s' % vlan_num)
    if (not device_exists(interface)):
        LOG.debug('Starting    VLAN    interface    %s', interface)
        _execute('ip', 'link', 'add', 'link', bridge_interface, 'name', interface, 'type', 'vlan', 'id', vlan_num, run_as_root=True, check_exit_code=[0, 2, 254])
        if mac_address:
            _execute('ip', 'link', 'set', interface, 'address', mac_address, run_as_root=True, check_exit_code=[0, 2, 254])
        _execute('ip', 'link', 'set', interface, 'up', run_as_root=True, check_exit_code=[0, 2, 254])
    _set_device_mtu(interface, mtu)
    return interface
