/* $XORP: xorp/etc/templates/fib2mrib.tp,v 1.10 2006/02/22 02:26:10 pavlin Exp $ */

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

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


protocols {
    fib2mrib {
	%help:		short		"Configure the FIB2MRIB module";
	%modinfo:	provides	fib2mrib;
	%modinfo:	depends		rib;
	%modinfo:	depends		policy;
	%modinfo:	path		"xorp_fib2mrib";
	%modinfo:	default_targetname "fib2mrib";
	%modinfo:	status_method	xrl "$(fib2mrib.targetname)/common/0.1/get_status->status:u32&reason:txt";
	%modinfo:	startup_method	xrl "$(fib2mrib.targetname)/common/0.1/startup";
	%modinfo:	shutdown_method	xrl "$(fib2mrib.targetname)/common/0.1/shutdown";

	%mandatory:	$(@.targetname);

	%activate:	xrl "$(fib2mrib.targetname)/fib2mrib/0.1/start_fib2mrib";

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

	disable {
	    %help:	short "Disable the FIB2MRIB module";
	    %create:;
	    %set:	xrl "$(fib2mrib.targetname)/fib2mrib/0.1/enable_fib2mrib?enable:bool=`~$(@)`";
	    %delete:	xrl "$(fib2mrib.targetname)/fib2mrib/0.1/enable_fib2mrib?enable:bool=`~$(DEFAULT)`";
	}

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

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

policy {
    %create: xrl "$(policy.targetname)/policy/0.1/set_proto_target?protocol:txt=fib2mrib&target:txt=fib2mrib";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=fib2mrib&variable:txt=network4&type:txt=ipv4net&access:txt=r&id:u32=10";
    %create: xrl "$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=fib2mrib&variable:txt=metric&type:txt=u32&access:txt=rw&id:u32=14";

    policy-statement @: txt {
	term @: txt {
	    from {
		metric {
		    %help: short "Set the 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=";
		}
	    }
	}
    }
}
