/* $XORP: xorp/etc/templates/policy.tp,v 1.31 2008/08/06 08:25:26 abittau Exp $ */

policy {
    targetname: txt = "policy";
    policy-statement @: txt {
	term @: txt {
	    from {
		protocol:	txt;
		network4:	ipv4net;
		network6:	ipv6net;
		network4-list:	txt;
		network6-list:	txt;
		prefix-length4:	u32range;
		prefix-length6:	u32range;
		policy:		txt;
		tag:		u32range;
		nexthop4:	ipv4range;
		nexthop6:	ipv6range;
	    }
	    to {
		network4:	ipv4net;
		network6:	ipv6net;
		network4-list:	txt;
		network6-list:	txt;
		prefix-length4:	u32range;
		prefix-length6:	u32range;
		policy:		txt;
		tag:		u32range;
		nexthop4:	ipv4range;
		nexthop6:	ipv6range;
	    }
	    then {
	    	nexthop4:	ipv4;
		nexthop6:	ipv6;
		nexthop4-var:	txt;
		nexthop6-var:	txt;
		trace:		u32;
		tag:		u32;
		next:		txt;
		accept {}
		reject {}
	    }
	}
	then {
		accept {}
		reject {}
	}
    }

    network4-list @: txt {
	elements: txt;				/* %deprecated */
	network @: ipv4net {
		modifier: txt;
	}
    }

    network6-list @: txt {
	elements: txt;				/* %deprecated */
	network @: ipv6net {
		modifier: txt;
	}
    }
}

policy {
    %help:      short "Configure routing policies";
    %modinfo:   provides policy;
    %modinfo:   depends rib;
    %modinfo:   path "xorp_policy";
    %modinfo:   default_targetname "policy";
    %modinfo:   status_method xrl "$(policy.targetname)/common/0.1/get_status->status:u32&reason:txt";
    %modinfo:	startup_method	xrl "$(policy.targetname)/common/0.1/startup";
    %modinfo:   shutdown_method xrl "$(policy.targetname)/common/0.1/shutdown";
    %modinfo:   end_commit xrl "$(policy.targetname)/policy/0.1/done_global_policy_conf";
    %mandatory: $(@.targetname);

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

    policy-statement @: txt {
	%help: short "Routing policy";
	%create: xrl "$(policy.targetname)/policy/0.1/create_policy?policy:txt=$(@)";
	%delete: xrl "$(policy.targetname)/policy/0.1/delete_policy?policy:txt=$(@)";

	term @: txt {
	    %help: short "Term of the routing policy";
	    %create: xrl "$(policy.targetname)/policy/0.1/create_term?policy:txt=$(policy-statement.@)&order:txt=$(#)&term:txt=$(@)";
	    %delete: xrl "$(policy.targetname)/policy/0.1/delete_term?policy:txt=$(policy-statement.@)&term:txt=$(@)";

	    from {
		%help: short "Conditions to match the source of a route";
		protocol {
		    %help: short "Protocol from which route was learned";
		    %allow: $(@) "bgp" %help: "BGP routes";
		    %allow: $(@) "connected" %help: "Directly connected sub-network routes";
		    %allow: $(@) "fib2mrib" %help: "FIB2MRIB routes";
		    %allow: $(@) "olsr4" %help: "OLSRv1 IPv4 routes";
		    %allow: $(@) "ospf4" %help: "OSPF IPv4 routes";
		    %allow: $(@) "ospf6" %help: "OSPF IPv6 routes";
		    %allow: $(@) "rip" %help: "RIP routes";
		    %allow: $(@) "ripng" %help: "RIPng routes";
		    %allow: $(@) "static" %help: "Static routes";
                    %allow: $(@) "wrapper4" %help: "Wrapper IPv4 routes";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=protocol $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}

                nexthop4 {
                    %help: short "IPv4 nexthop";
                    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=nexthop4 $(<>) $(@);";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
                }

                nexthop6 {
                    %help: short "IPv6 nexthop";
                    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=nexthop6 $(<>) $(@);";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
                }

		network4 {
		    %help: short "IPv4 network";
		    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=" "exact" "not" "shorter" "longer" "orshorter" "orlonger";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network4 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}

		network6 {
		    %help: short "IPv6 network";
		    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=" "exact" "not" "shorter" "longer" "orshorter" "orlonger";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network6 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}

		network4-list {
		    %help: short "Valid named set of IPv4 networks";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network4 <= SET $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}
		network6-list {
		    %help: short "Valid named set of IPv6 networks";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network6 <= SET $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}

		prefix-length4 {
		    %help: short "IPv4 prefix length range";
		    %allow-operator: "==" "!=" "<" "<=" ">" ">=";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network4 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}
		prefix-length6 {
		    %help: short "IPv6 prefix length range";
		    %allow-operator: "==" "!=" "<" "<=" ">" ">=";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=network6 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}

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

		tag {
		    %help: short "Tag 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=tag $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
		}
	    }

	    to {
		%help: short "Conditions to match the destination of a route";
		network4 {
		    %help: short "IPv4 network";
		    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=" "exact" "not" "shorter" "longer" "orshorter" "orlonger";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network4 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}

		network6 {
		    %help: short "IPv6 network";
		    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=" "exact" "not" "shorter" "longer" "orshorter" "orlonger";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network6 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}

                nexthop4 {
                    %help: short "IPv4 nexthop";
                    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=nexthop4 $(<>) $(@);";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
                }

                nexthop6 {
                    %help: short "IPv6 nexthop";
                    %allow-operator: ":" "==" "!=" "<" ">" "<=" ">=";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=nexthop6 $(<>) $(@);";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
                }

		network4-list {
		    %help: short "Valid named set of IPv4 networks";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network4 <= SET $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}
		network6-list {
		    %help: short "Valid named set of IPv6 networks";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network6 <= SET $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}

		prefix-length4 {
		    %help: short "IPv4 prefix length range";
		    %allow-operator: "==" "!=" "<" "<=" ">" ">=";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network4 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}
		prefix-length6 {
		    %help: short "IPv6 prefix length range";
		    %allow-operator: "==" "!=" "<" "<=" ">" ">=";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=network6 $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}

		policy {
		    %help: short "Policy subroutine";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=policy $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=1&order:txt=$(#)&statement:txt=";
		}

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

	    then {
		%help: short "Actions to take if conditions match";
		trace {
		    %help: short "Set the tracing";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=trace = $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}

		nexthop4 {
		    %help: short "Set the IPv4 nexthop";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=nexthop4 $(<>) (ctr 'ipv4nexthop' '$(@)');";     
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}

                nexthop6 {
		    %help: short "Set the IPv6 nexthop";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=nexthop6 $(<>) (ctr 'ipv6nexthop' '$(@)');";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
                }

		nexthop4-var {
                    %help: short "Set the IPv4 nexthop";                                                                 %allow: $(@) "peer-address" %help: "Peer address";
                    %allow: $(@) "self" %help: "Self";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=nexthop4 $(<>) (ctr 'ipv4nexthop' '$(@)');";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
                }

                nexthop6-var {
                    %help: short "Set the IPv6 nexthop";
                    %allow: $(@) "peer-address" %help: "Peer address";
                    %allow: $(@) "self" %help: "Self";
                    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=nexthop6 $(<>) (ctr 'ipv6nexthop' '$(@)');";
                    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
                }

		tag {
		    %help: short "Tag value";
		    %allow-operator: ":" "=" "sub" "add" "mul" "div" "lshift" "rshift" "bit_and" "bit_or" "bit_xor" "+=" "-=" "*=" "/=" "<<=" ">>=" "&=" "|=" "^=";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=tag $(<>) $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}
		
		next {
		    %help: short "Change control flow to next term or policy";
		    %allow: $(@) "policy" %help: "Skip to next policy";
		    %allow: $(@) "term" %help: "Skip to next term";
		    %set: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=next $(@);";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}

		accept {
		    %help: short "Accept a route";
		    %create: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=accept;";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}
		reject {
		    %help: short "Reject a route";
		    %create: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=reject;";
		    %delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=$(term.@)&block:u32=2&order:txt=$(#)&statement:txt=";
		}
	    }
	} /* term */

	/* unnamed term */
        then {
	    %help: short "Final action";
	    %create: xrl "$(policy.targetname)/policy/0.1/create_term?policy:txt=$(policy-statement.@)&order:txt=$(#)&term:txt=__final";
	    %delete: xrl "$(policy.targetname)/policy/0.1/delete_term?policy:txt=$(policy-statement.@)&term:txt=__final";

	    accept {
	        %help: short "Accept a route";
		%create: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=__final&block:u32=2&order:txt=$(#)&statement:txt=accept;";
		%delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=__final&block:u32=2&order:txt=$(#)&statement:txt=";
            }

	    reject {
	        %help: short "Reject a route";
		%create: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=__final&block:u32=2&order:txt=$(#)&statement:txt=reject;";
		%delete: xrl "$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-statement.@)&term:txt=__final&block:u32=2&order:txt=$(#)&statement:txt=";
	    }
        }
    }

    network4-list @: txt {
	%help: short "Named set of IPv4 networks";
	%delete: xrl "$(policy.targetname)/policy/0.1/delete_set?set:txt=$(@)";
	%create: xrl "$(policy.targetname)/policy/0.1/create_set?set:txt=$(@)";

	elements {
	    %deprecated: "Statement 'elements' is replaced with 'network'";
	    %help: short "Elements in the named set of IPv4 networks";
	    %set: xrl "$(policy.targetname)/policy/0.1/update_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&elements:txt=$(@)";
	}

	network @: ipv4net {
	    %help: short "Element in the named set of IPv4 networks";
	    %create: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(@)";
	    %delete: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(@)";

	    modifier {
		%help: short "Set prefix modifier";
		%allow: $(@) ":" %help: "Exact";
		%allow: $(@) "==" %help: "Exact";
		%allow: $(@) "exact" %help: "Exact";
		%allow: $(@) "!=" %help: "Not";
		%allow: $(@) "not" %help: "Not";
		%allow: $(@) ">=" %help: "Or shorter";
		%allow: $(@) "orshorter" %help: "Or shorter";
		%allow: $(@) ">" %help: "Shorter";
		%allow: $(@) "shorter" %help: "Shorter";
		%allow: $(@) "<" %help: "Longer";
		%allow: $(@) "longer" %help: "Longer";
		%allow: $(@) "<=" %help: "Or longer";
		%allow: $(@) "orlonger" %help: "Or longer";
		%set: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(network.@)";
		%set: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(network.@)~$(@)";
		%delete: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(network.@)";
		%delete: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv4net&set:txt=$(network4-list.@)&element:txt=$(network.@)";
	    }
	}
    }

    network6-list @: txt {
	%help: short "Named set of IPv6 networks";
	%delete: xrl "$(policy.targetname)/policy/0.1/delete_set?set:txt=$(@)";
	%create: xrl "$(policy.targetname)/policy/0.1/create_set?set:txt=$(@)";

	elements {
	    %deprecated: "Statement 'elements' is replaced with 'network'";
	    %help: short "Elements in the named set of IPv6 networks";
	    %set: xrl "$(policy.targetname)/policy/0.1/update_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&elements:txt=$(@)";
	}

	network @: ipv6net {
	    %help: short "Element in the named set of IPv6 networks";
	    %create: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(@)";
	    %delete: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(@)";

	    modifier {
		%help: short "Set prefix modifier";
		%allow: $(@) ":" %help: "Exact";
		%allow: $(@) "==" %help: "Exact";
		%allow: $(@) "exact" %help: "Exact";
		%allow: $(@) "!=" %help: "Not";
		%allow: $(@) "not" %help: "Not";
		%allow: $(@) ">=" %help: "Or shorter";
		%allow: $(@) "orshorter" %help: "Or shorter";
		%allow: $(@) ">" %help: "Shorter";
		%allow: $(@) "shorter" %help: "Shorter";
		%allow: $(@) "<" %help: "Longer";
		%allow: $(@) "longer" %help: "Longer";
		%allow: $(@) "<=" %help: "Or longer";
		%allow: $(@) "orlonger" %help: "Or longer";
		%set: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(network.@)";
		%set: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(network.@)~$(@)";
		%delete: xrl "$(policy.targetname)/policy/0.1/delete_from_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(network.@)";
		%delete: xrl "$(policy.targetname)/policy/0.1/add_to_set?type:txt=set_ipv6net&set:txt=$(network6-list.@)&element:txt=$(network.@)";
	    }
	}
    }
}
