def ensure_floating_forward(floating_ip, fixed_ip, device, network):
    # NOTE(vish): Make sure we never have duplicate rules for the same ip
    regex = '.*\s+%s(/32|\s+|$)' % floating_ip
    num_rules = iptables_manager.ipv4['nat'].remove_rules_regex(regex)
    if num_rules:
        msg = _LW('Removed %(num)d duplicate rules for floating IP %(float)s')
        LOG.warning(msg, {'num': num_rules, 'float': floating_ip})
    for chain, rule in floating_forward_rules(floating_ip, fixed_ip, device):
        iptables_manager.ipv4['nat'].add_rule(chain, rule)
    iptables_manager.apply()
    if device != network['bridge']:
        ensure_ebtables_rules(*floating_ebtables_rules(fixed_ip, network))
Ensure floating IP forwarding rule.
dataset/ETHPy150Open openstack/nova/nova/network/linux_net.py/ensure_floating_forward