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

	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;
	    }
	}

	mcast-route @: ipv4 {
	    input_if:		txt;
	    input_ip:		ipv4;
	    output_ifs:		txt;
	    distance:		u32 = 0;
	}

	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		"xorp_static_routes";
	%modinfo:	default_targetname "static_routes";
	%modinfo:	status_method	xrl "$(static.targetname)/common/0.1/get_status->status:u32&reason:txt";
	%modinfo:	startup_method	xrl "$(static.targetname)/common/0.1/startup";
	%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=$(@)";
	}

	distance {
            %help:      short "Administrative Distance for Static";
            %allow-range: $(@) "0" "255" %help: "Administrative Distance for Static";
            %set:       xrl "rib/rib/0.1/set_protocol_admin_distance?protocol:txt=static&ipv4:bool=true&ipv6:bool=false&unicast:bool=true&multicast:bool=false&admin_distance:u32=$(@)";
        }

	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:;
		}
	    }
	}

	mcast-route @: ipv4 {
	    %help:	short "Configure a static Multicast route";
	    %mandatory:	$(@.input_if), $(@.input_ip), $(@.output_ifs);

	    %create:	xrl "$(static.targetname)/static_routes/0.1/add_mcast_route4?mcast_addr:ipv4=$(@)&input_if:txt=$(@.input_if)&input_ip:ipv4=$(@.input_ip)&output_ifs:txt=$(@.output_ifs)&distance:u32=$(@.distance)";
	    %update:	xrl "$(static.targetname)/static_routes/0.1/replace_mcast_route4?mcast_addr:ipv4=$(@)&input_if:txt=$(@.input_if)&input_ip:ipv4=$(@.input_ip)&output_ifs:txt=$(@.output_ifs))&distance:u32=$(@.distance)";
	    %delete:	xrl "$(static.targetname)/static_routes/0.1/delete_mcast_route4?mcast_addr:ipv4=$(@)&input_ip:ipv4=$(@.input_ip)";

	    input_if {
		%help:	short "Configure the input interface";
		%set:;
	    }

	    input_ip {
		%help:	short "Configure the input IP address";
		%set:;
	    }

	    output_ifs {
		%help:	short "Configure the input output interface(s)";
		%set:;
	    }

	    distance {
		%help:	short "Configure the routing distance.  Lower value wins";
		%allow-range: $(@) "0" "7" %help: "The routing distance";
		%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=";
		}
	    }
	}
    }
}
