/* $XORP: xorp/etc/templates/static_routes.tp,v 1.44 2008/08/06 08:26:14 abittau Exp $ */

protocols {
    static {
	targetname:		txt = "static_routes";
	disable:		toggle = false;
	enabled:		bool;		/* %deprecated */

	route @: ipv4net {
	    next-hop:		ipv4;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;

	    qualified-next-hop @: ipv4 {
		metric:		u32 = 10;
	    }
	}

	route @: ipv6net {
	    next-hop:		ipv6;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;

	    qualified-next-hop @: ipv6 {
		metric:		u32 = 10;
	    }
	}

	route4 @: ipv4net {			/* %deprecated */
	    next-hop:		ipv4;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;
	}

	route6 @: ipv6net {			/* %deprecated */
	    next-hop:		ipv6;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;
	}

	interface-route @: ipv4net {
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv4 = 0.0.0.0;
	    metric:		u32 = 1;

	    qualified-next-hop-interface @: txt {
		qualified-next-hop-vif @: txt {
		    next-hop-router:	ipv4 = 0.0.0.0;
		    metric:		u32 = 10;
		}
	    }
	}

	interface-route @: ipv6net {
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv6 = ::;
	    metric:		u32 = 1;

	    qualified-next-hop-interface @: txt {
		qualified-next-hop-vif @: txt {
		    next-hop-router:	ipv6 = ::;
		    metric:		u32 = 10;
		}
	    }
	}

	interface-route4 @: ipv4net {		/* %deprecated */
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv4 = 0.0.0.0;
	    metric:		u32 = 1;
	}

	interface-route6 @: ipv6net {		/* %deprecated */
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv6 = ::;
	    metric:		u32 = 1;
	}

	mrib-route @: ipv4net {
	    next-hop:		ipv4;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;

	    qualified-next-hop @: ipv4 {
		metric:		u32 = 10;
	    }
	}

	mrib-route @: ipv6net {
	    next-hop:		ipv6;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;

	    qualified-next-hop @: ipv6 {
		metric:		u32 = 10;
	    }
	}

	mrib-route4 @: ipv4net {		/* %deprecated */
	    next-hop:		ipv4;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;
	}

	mrib-route6 @: ipv6net {		/* %deprecated */
	    next-hop:		ipv6;
	    nexthop:		ipv4;		/* %deprecated */
	    metric:		u32 = 1;
	}

	mrib-interface-route @: ipv4net {
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv4 = 0.0.0.0;
	    metric:		u32 = 1;

	    qualified-next-hop-interface @: txt {
		qualified-next-hop-vif @: txt {
		    next-hop-router:	ipv4 = 0.0.0.0;
		    metric:		u32 = 10;
		}
	    }
	}

	mrib-interface-route @: ipv6net {
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv6 = ::;
	    metric:		u32 = 1;

	    qualified-next-hop-interface @: txt {
		qualified-next-hop-vif @: txt {
		    next-hop-router:	ipv6 = ::;
		    metric:		u32 = 10;
		}
	    }
	}

	mrib-interface-route4 @: ipv4net {	/* %deprecated */
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv4 = 0.0.0.0;
	    metric:		u32 = 1;
	}

	mrib-interface-route6 @: ipv6net {	/* %deprecated */
	    next-hop-interface: txt;
	    next-hop-vif:	txt;
	    next-hop-router:	ipv6 = ::;
	    metric:		u32 = 1;
	}

	import: txt;
    }
}

policy {
    policy-statement @: txt {
	term @: txt {
	    from {
		metric: u32range;
	    }
	}
    }
}

protocols {
    static {
	%help:		short	"Configure static routes";
	%modinfo:	provides	static_routes;
	%modinfo:	depends		rib;
	%modinfo:	depends		policy;
	%modinfo:	path		"static_routes/xorp_static_routes";
	%modinfo:	default_targetname "static_routes";
	%modinfo:	status_method	xrl "$(static.targetname)/common/0.1/get_status->status:u32&reason:txt";
	%modinfo:	shutdown_method	xrl "$(static.targetname)/common/0.1/shutdown";

	%mandatory:	$(@.targetname);

	%activate:	xrl "$(static.targetname)/static_routes/0.1/start_static_routes";

	targetname {
	    %user-hidden: "XRL target name";
	    %help:	short "XRL target name";
	    %set:;
	}

	disable {
	    %help:	short "Disable the static routes";
	    %create:;
	    %set:	xrl "$(static.targetname)/static_routes/0.1/enable_static_routes?enable:bool=`~$(@)`";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/enable_static_routes?enable:bool=`~$(DEFAULT)`";
	}

	enabled {
	    %deprecated: "Statement 'enabled: true/false' is replaced with 'disable: false/true'";
	    %help:	short "Enable the static routes";
	    %create:;
	    %set:	xrl "$(static.targetname)/static_routes/0.1/enable_static_routes?enable:bool=$(@)";
	}

	route @: ipv4net {
	    %help:	short "Configure a static route";
	    %mandatory:	$(@.next-hop);

	    %create:	xrl "$(static.targetname)/static_routes/0.1/add_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop @: ipv4 {
		%help:		short "Next hop with qualifiers";

		%create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(route.@)&nexthop:ipv4=$(@)&metric:u32=$(@.metric)";
		%update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(route.@)&nexthop:ipv4=$(@)&metric:u32=$(@.metric)";
		%delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(route.@)&nexthop:ipv4=$(@)";

		metric {
		    %help:	short "Configure the routing metric";
		    %allow-range: $(@) "1" "65535" %help: "The routing metric";
		    %set:;
		}
	    }
	}

	route @: ipv6net {
	    %help:	short "Configure a static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop @: ipv6 {
		%help:		short "Next hop with qualifiers";

		%create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(route.@)&nexthop:ipv6=$(@)&metric:u32=$(@.metric)";
		%update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(route.@)&nexthop:ipv6=$(@)&metric:u32=$(@.metric)";
		%delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(route.@)&nexthop:ipv6=$(@)";

		metric {
		    %help:	short "Configure the routing metric";
		    %allow-range: $(@) "1" "65535" %help: "The routing metric";
		    %set:;
		}
	    }
	}

	route4 @: ipv4net {
	    %deprecated: "Statement 'route4' is replaced with 'route'";
	    %help:	short "Configure an IPv4 static route";
	    %mandatory:	$(@.next-hop);

	    %create:	xrl "$(static.targetname)/static_routes/0.1/add_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	route6 @: ipv6net {
	    %deprecated: "Statement 'route6' is replaced with 'route'";
	    %help:	short "Configure an IPv6 static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	interface-route @: ipv4net {
	    %help:	short "Configure an interface-based static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create:	xrl "$(static.targetname)/static_routes/0.1/add_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop-interface @: txt {
		%help:		short "Next hop interface name with qualifiers";
		qualified-next-hop-vif @: txt {
		    %help:	short "Next hop virtual interface name with qualifiers";

		    %create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)";

		    next-hop-router {
			%help:	short "Configure the optional next-hop router";
			%set:;
		    }

		    metric {
			%help:	short "Configure the routing metric";
			%allow-range: $(@) "1" "65535" %help: "The routing metric";
			%set:;
		    }
		}
	    }
	}

	interface-route @: ipv6net {
	    %help:	short "Configure an interface-based static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop-interface @: txt {
		%help:		short "Next hop interface name with qualifiers";
		qualified-next-hop-vif @: txt {
		    %help:	short "Next hop virtual interface name with qualifiers";

		    %create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)";

		    next-hop-router {
			%help:	short "Configure the optional next-hop router";
			%set:;
		    }

		    metric {
			%help:	short "Configure the routing metric";
			%allow-range: $(@) "1" "65535" %help: "The routing metric";
			%set:;
		    }
		}
	    }
	}

	interface-route4 @: ipv4net {
	    %deprecated: "Statement 'interface-route4' is replaced with 'interface-route'";
	    %help:	short "Configure an interface-based IPv4 static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create:	xrl "$(static.targetname)/static_routes/0.1/add_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_interface_route4?unicast:bool=true&multicast:bool=false&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	interface-route6 @: ipv6net {
	    %deprecated: "Statement 'interface-route6' is replaced with 'interface-route'";
	    %help:	short "Configure an interface-based IPv6 static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route6?unicast:bool=true&multicast:bool=false&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	mrib-route @: ipv4net {
	    %help:	short "Configure a multicast-specific static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop @: ipv4 {
		%help:		short "Next hop with qualifiers";

		%create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-route.@)&nexthop:ipv4=$(@)&metric:u32=$(@.metric)";
		%update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-route.@)&nexthop:ipv4=$(@)&metric:u32=$(@.metric)";
		%delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-route.@)&nexthop:ipv4=$(@)";

		metric {
		    %help:	short "Configure the routing metric";
		    %allow-range: $(@) "1" "65535" %help: "The routing metric";
		    %set:;
		}
	    }
	}

	mrib-route @: ipv6net {
	    %help:	short "Configure a multicast-specific static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop @: ipv6 {
		%help:		short "Next hop with qualifiers";

		%create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-route.@)&nexthop:ipv6=$(@)&metric:u32=$(@.metric)";
		%update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-route.@)&nexthop:ipv6=$(@)&metric:u32=$(@.metric)";
		%delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-route.@)&nexthop:ipv6=$(@)";

		metric {
		    %help:	short "Configure the routing metric";
		    %allow-range: $(@) "1" "65535" %help: "The routing metric";
		    %set:;
		}
	    }
	}

	mrib-route4 @: ipv4net {
	    %deprecated: "Statement 'mrib-route4' is replaced with 'mrib-route'";
	    %help:	short "Configure a multicast-specific IPv4 static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	mrib-route6 @: ipv6net {
	    %deprecated: "Statement 'mrib-route6' is replaced with 'mrib-route'";
	    %help:	short "Configure a multicast-specific IPv6 static route";
	    %mandatory:	$(@.next-hop);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop)";

	    next-hop {
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    nexthop {
		%deprecated: "Statement 'nexthop' is replaced with 'next-hop'";
		%help:	short "Configure the next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	mrib-interface-route @: ipv4net {
	    %help:	short "Configure a multicast-specific interface-based static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop-interface @: txt {
		%help:		short "Next hop interface name with qualifiers";
		qualified-next-hop-vif @: txt {
		    %help:	short "Next hop virtual interface name with qualifiers";

		    %create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(mrib-interface-route.@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)";

		    next-hop-router {
			%help:	short "Configure the optional next-hop router";
			%set:;
		    }

		    metric {
			%help:	short "Configure the routing metric";
			%allow-range: $(@) "1" "65535" %help: "The routing metric";
			%set:;
		    }
		}
	    }
	}

	mrib-interface-route @: ipv6net {
	    %help:	short "Configure a multicast-specific interface-based static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }

	    qualified-next-hop-interface @: txt {
		%help:		short "Next hop interface name with qualifiers";
		qualified-next-hop-vif @: txt {
		    %help:	short "Next hop virtual interface name with qualifiers";

		    %create:	xrl "$(static.targetname)/static_routes/0.1/add_backup_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_backup_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)&metric:u32=$(@.metric)";
		    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_backup_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(mrib-interface-route.@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(qualified-next-hop-interface.@)&vifname:txt=$(qualified-next-hop-vif.@)";

		    next-hop-router {
			%help:	short "Configure the optional next-hop router";
			%set:;
		    }

		    metric {
			%help:	short "Configure the routing metric";
			%allow-range: $(@) "1" "65535" %help: "The routing metric";
			%set:;
		    }
		}
	    }
	}

	mrib-interface-route4 @: ipv4net {
	    %deprecated: "Statement 'mrib-interface-route4' is replaced with 'mrib-interface-route'";
	    %help:	short "Configure a multicast-specific interface-based IPv4 static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route4?unicast:bool=false&multicast:bool=true&network:ipv4net=$(@)&nexthop:ipv4=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	mrib-interface-route6 @: ipv6net {
	    %deprecated: "Statement 'mrib-interface-route4' is replaced with 'mrib-interface-route'";
	    %help:	short "Configure a multicast-specific interface-based IPv6 static route";
	    %mandatory:	$(@.next-hop-interface), $(@.next-hop-vif);

	    %create: xrl "$(static.targetname)/static_routes/0.1/add_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %update: xrl "$(static.targetname)/static_routes/0.1/replace_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)&metric:u32=$(@.metric)";
	    %delete: xrl "$(static.targetname)/static_routes/0.1/delete_interface_route6?unicast:bool=false&multicast:bool=true&network:ipv6net=$(@)&nexthop:ipv6=$(@.next-hop-router)&ifname:txt=$(@.next-hop-interface)&vifname:txt=$(@.next-hop-vif)";

	    next-hop-interface {
		%help:	short "Configure the next-hop network interface name";
		%set:;
	    }

	    next-hop-vif {
		%help:	short "Configure the next-hop virtual interface name";
		%set:;
	    }

	    next-hop-router {
		%help:	short "Configure the optional next-hop router";
		%set:;
	    }

	    metric {
		%help:	short "Configure the routing metric";
		%allow-range: $(@) "1" "65535" %help: "The routing metric";
		%set:;
	    }
	}

	import {
	    %help: short "Import policy";
	    %delete: xrl "policy/policy/0.1/import?protocol:txt=static&policies:txt=&modifier:txt=";
	    %set: xrl "policy/policy/0.1/import?protocol:txt=static&policies:txt=$(@)&modifier:txt=";
	}
    }
}

policy {
    %create: xrl "$(policy.targetname)/policy/0.1/set_proto_target?protocol:txt=static&target:txt=static_routes";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=static&variable:txt=network4&type:txt=ipv4net&access:txt=r&id:u32=10";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=static&variable:txt=nexthop4&type:txt=ipv4nexthop&access:txt=rw&id:u32=11";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=static&variable:txt=network6&type:txt=ipv6net&access:txt=r&id:u32=12";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=static&variable:txt=nexthop6&type:txt=ipv6nexthop&access:txt=rw&id:u32=13";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=static&variable:txt=metric&type:txt=u32&access:txt=rw&id:u32=14";

    policy-statement @: txt {
	term @: txt {
	    from {
		metric {
		    %help: short "Metric value";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=metric $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}
	    }
	}
    }
}
