'Provisions a local VLAN.
:param net_uuid: the uuid of the network associated with this vlan.
:param network_type: the network type (\'gre\', \'vxlan\', \'vlan\', \'flat\',
\'local\', \'geneve\')
:param physical_network: the physical network for \'vlan\' or \'flat\'
:param segmentation_id: the VID for \'vlan\' or tunnel ID for \'tunnel\''

def provision_local_vlan(self, net_uuid, network_type, physical_network, segmentation_id):

    try:
        lvm = self.vlan_manager.get(net_uuid)
        lvid = lvm.vlan
    except vlanmanager.MappingNotFound:
        lvid = self._local_vlan_hints.pop(net_uuid, None)
        if (lvid is None):
            if (not self.available_local_vlans):
                LOG.error(_LE('No    local    VLAN    available    for    net-id=%s'), net_uuid)
                return
            lvid = self.available_local_vlans.pop()
        self.vlan_manager.add(net_uuid, lvid, network_type, physical_network, segmentation_id)
    LOG.info(_LI('Assigning    %(vlan_id)s    as    local    vlan    for    net-id=%(net_uuid)s'), {'vlan_id': lvid, 'net_uuid': net_uuid})
    if (network_type in constants.TUNNEL_NETWORK_TYPES):
        if self.enable_tunneling:
            ofports = list(self.tun_br_ofports[network_type].values())
            if ofports:
                self.tun_br.install_flood_to_tun(lvid, segmentation_id, ofports)
            if self.enable_distributed_routing:
                self.dvr_agent.process_tunneled_network(network_type, lvid, segmentation_id)
            else:
                self.tun_br.provision_local_vlan(network_type=network_type, lvid=lvid, segmentation_id=segmentation_id)
        else:
            LOG.error(_LE('Cannot    provision    %(network_type)s    network    for    net-id=%(net_uuid)s    -    tunneling    disabled'), {'network_type': network_type, 'net_uuid': net_uuid})
    elif (network_type == p_const.TYPE_FLAT):
        if (physical_network in self.phys_brs):
            self._local_vlan_for_flat(lvid, physical_network)
        else:
            LOG.error(_LE('Cannot    provision    flat    network    for    net-id=%(net_uuid)s    -    no    bridge    for    physical_network    %(physical_network)s'), {'net_uuid': net_uuid, 'physical_network': physical_network})
    elif (network_type == p_const.TYPE_VLAN):
        if (physical_network in self.phys_brs):
            self._local_vlan_for_vlan(lvid, physical_network, segmentation_id)
        else:
            LOG.error(_LE('Cannot    provision    VLAN    network    for    net-id=%(net_uuid)s    -    no    bridge    for    physical_network    %(physical_network)s'), {'net_uuid': net_uuid, 'physical_network': physical_network})
    elif (network_type == p_const.TYPE_LOCAL):
        pass
    else:
        LOG.error(_LE('Cannot    provision    unknown    network    type    %(network_type)s    for    net-id=%(net_uuid)s'), {'network_type': network_type, 'net_uuid': net_uuid})
