def build_routes(iface, **settings):
    '''
    Build a route script for a network interface.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_routes eth0 <settings>
    '''

    template = 'rh6_route_eth.jinja'
    try:
        if int(__grains__['osrelease'][0]) < 6:
            template = 'route_eth.jinja'
    except ValueError:
        pass
    log.debug('Template name: %s', template)

    opts = _parse_routes(iface, settings)
    log.debug('Opts: \n %s', opts)
    try:
        template = JINJA.get_template(template)
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template %s', template)
        return ''
    opts6 = []
    opts4 = []
    for route in opts['routes']:
        ipaddr = route['ipaddr']
        if salt.utils.validate.net.ipv6_addr(ipaddr):
            opts6.append(route)
        else:
            opts4.append(route)
    log.debug("IPv4 routes:\n%s", opts4)
    log.debug("IPv6 routes:\n%s", opts6)

    routecfg = template.render(routes=opts4, iface=iface)
    routecfg6 = template.render(routes=opts6, iface=iface)

    if settings['test']:
        routes = _read_temp(routecfg)
        routes.extend(_read_temp(routecfg6))
        return routes

    _write_file_iface(iface, routecfg, _RH_NETWORK_SCRIPT_DIR, 'route-{0}')
    _write_file_iface(iface, routecfg6, _RH_NETWORK_SCRIPT_DIR, 'route6-{0}')

    path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route-{0}'.format(iface))
    path6 = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route6-{0}'.format(iface))

    routes = _read_file(path)
    routes.extend(_read_file(path6))
    return routes
Build a route script for a network interface.

    CLI Example:

    .. code-block:: bash

        salt '*' ip.build_routes eth0 <settings>