'Set the L3 settings for the interface using data from the port.
ip_cidrs: list of \'X.X.X.X/YY\' strings
preserve_ips: list of ip cidrs that should not be removed from device
clean_connections: Boolean to indicate if we should cleanup connections
associated to removed ips'

def init_l3(self, device_name, ip_cidrs, namespace=None, preserve_ips=None, clean_connections=False):

    preserve_ips = (preserve_ips or [])
    device = ip_lib.IPDevice(device_name, namespace=namespace)
    default_ipv6_lla = ip_lib.get_ipv6_lladdr(device.link.address)
    cidrs = set()
    remove_ips = set()
    for ip_cidr in ip_cidrs:
        net = netaddr.IPNetwork(ip_cidr)
        if (net.version == 6):
            ip_cidr = str(net)
        cidrs.add(ip_cidr)
    for address in device.addr.list():
        cidr = address['cidr']
        dynamic = address['dynamic']
        if (cidr == default_ipv6_lla):
            continue
        if (cidr in preserve_ips):
            continue
        if ((cidr in cidrs) and (not dynamic)):
            cidrs.remove(cidr)
            continue
        remove_ips.add(cidr)
    for ip_cidr in remove_ips:
        if clean_connections:
            device.delete_addr_and_conntrack_state(ip_cidr)
        else:
            device.addr.delete(ip_cidr)
    for ip_cidr in cidrs:
        device.addr.add(ip_cidr)
