def replace_static_route(ns, setting, address, prefix, metric=None, next_hop=None):
    # Check the IP address
    address, version = util.address_check(address)

    # this is workaround for crashing provider, see:
    # https://bugzilla.redhat.com/show_bug.cgi?id=1067487
    while 1:
        settingData = setting.first_associator(AssocClass="LMI_OrderedIPAssignmentComponent", ResultClass="LMI_IPRouteSettingData")
        if settingData is None:
            break
        settingData.delete()
    LOG().info("Static routes replaced with route to %s/%d in setting %s", address, prefix, setting.Caption)
    return add_static_route(ns, setting, address, prefix, metric, next_hop)
Remove all static routes and add given static route to the given setting.
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/networking/lmi/scripts/networking/__init__.py/replace_static_route