'Create a vxlan unless it already exists.'

def ensure_vxlan(self, segmentation_id):

    interface = self.get_vxlan_device_name(segmentation_id)
    if (not ip_lib.device_exists(interface)):
        LOG.debug('Creating    vxlan    interface    %(interface)s    for    VNI    %(segmentation_id)s', {'interface': interface, 'segmentation_id': segmentation_id})
        args = {'dev': self.local_int, 'srcport': (cfg.CONF.VXLAN.udp_srcport_min, cfg.CONF.VXLAN.udp_srcport_max), 'dstport': cfg.CONF.VXLAN.udp_dstport, 'ttl': cfg.CONF.VXLAN.ttl, 'tos': cfg.CONF.VXLAN.tos}
        if (self.vxlan_mode == lconst.VXLAN_MCAST):
            args['group'] = self.get_vxlan_group(segmentation_id)
        if cfg.CONF.VXLAN.l2_population:
            args['proxy'] = cfg.CONF.VXLAN.arp_responder
        try:
            int_vxlan = self.ip.add_vxlan(interface, segmentation_id, **args)
        except RuntimeError:
            with excutils.save_and_reraise_exception() as ctxt:
                if ip_lib.vxlan_in_use(segmentation_id):
                    ctxt.reraise = False
                    LOG.error(_LE('Unable    to    create    VXLAN    interface    for    VNI    %s    because    it    is    in    use    by    another    interface.'), segmentation_id)
                    return None
        int_vxlan.disable_ipv6()
        int_vxlan.link.set_up()
        LOG.debug('Done    creating    vxlan    interface    %s', interface)
    return interface
