
interfaces {
    targetname:		txt = "fea";
    restore-original-config-on-shutdown:	bool = false;

    interface @: txt {
	description:	txt = "";
	disable:	toggle = false;
	enabled:	bool;			/* %deprecated */
	discard:	toggle = false;
	unreachable:	toggle = false;
	management:	toggle = false;
	mac:		macaddr;
	mtu:		u32;

	/* Virtual-interface settings, leave blank if not a VLAN */
	parent-ifname:	txt = ""; /* Parent interface */
	iface-type:	txt = ""; /* VLAN */
	vid:		txt = ""; /* virtual-ID (VLAN-ID for VLANs) */

	vif @: txt {
	    disable:	toggle = false;
	    enabled:	bool;			/* %deprecated */

	    address @: ipv4 {
		prefix-length:		u32;
		broadcast:		ipv4;
		destination:		ipv4;
		multicast-capable:	toggle = false;
		point-to-point:		toggle = false;
		loopback:		toggle = false;
		broadcast-capable:	toggle = false;
		disable:		toggle = false;
		enabled:		bool;	/* %deprecated */
	    }

	    address @: ipv6 {
		prefix-length:		u32;
		destination:		ipv6;
		multicast-capable:	toggle = false;
		point-to-point:		toggle = false;
		loopback:		toggle = false;
		disable:		toggle = false;
		enabled:		bool;	/* %deprecated */
	    }
	}
    }
}

interfaces {
    %help:	short		"Configure network interfaces";
    %modinfo:	provides	interfaces;
    %modinfo:	path		"xorp_fea";
    %modinfo:	default_targetname "fea";
    %modinfo:	status_method	xrl "$(interfaces.targetname)/common/0.1/get_status->status:u32&reason:txt";
    %modinfo:	shutdown_method xrl "$(interfaces.targetname)/common/0.1/shutdown";
    %modinfo:	startup_method	xrl "$(interfaces.targetname)/ifmgr/0.1/startup_ifmgr";
    %modinfo:	start_commit	xrl "$(interfaces.targetname)/ifmgr/0.1/start_transaction->tid:u32=$(interfaces.TID)";
    %modinfo:	end_commit	xrl "$(interfaces.targetname)/ifmgr/0.1/commit_transaction?tid:u32=$(interfaces.TID)";

    %mandatory:	$(@.targetname);

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

    TID {
	%user-hidden: "Transaction ID generated by the FEA";
	%create:;
    }

    restore-original-config-on-shutdown {
	%help:		short "Restore original configuration on shutdown";
	%create:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_restore_original_config_on_shutdown?enable:bool=$(@)";
	%set:		xrl "$(interfaces.targetname)/ifmgr/0.1/set_restore_original_config_on_shutdown?enable:bool=$(@)";
	%delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_restore_original_config_on_shutdown?enable:bool=$(DEFAULT)";
    }

    interface @: txt {
	%help:		short "Configure a network interface";
	%create:	xrl "$(interfaces.targetname)/ifmgr/0.1/create_interface?tid:u32=$(interfaces.TID)&ifname:txt=$(@)";
	%delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/delete_interface?tid:u32=$(interfaces.TID)&ifname:txt=$(@)";
	%list:		xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_interface_names->ifnames:list";

	description {
	    %help:	short "Add a human-readable description of an interface";
	    %set:;
	    %get:;
	    %delete:;
	}

	disable {
	    %help:	short "Disable a network interface";
	    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_interface_enabled?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&enabled:bool=`~$(@)`";
	}

	enabled {
	    %deprecated: "Statement 'enabled: true/false' is replaced with 'disable: false/true'";
	    %help:	short "Enable a network interface";
	    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_interface_enabled?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&enabled:bool=$(@)";
	}

	discard {
	    %help:	short "Configure a discard interface";
	    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_interface_discard?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&discard:bool=$(@)";
	}

	unreachable {
	    %help:	short "Configure an unreachable interface";
	    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_interface_unreachable?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&unreachable:bool=$(@)";
	}

	management {
	    %help:	short "Configure a management interface";
	    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_interface_management?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&management:bool=$(@)";
	}

	default-system-config {
	    %help:	short "Use default values from the system";
	    %create:	xrl "$(interfaces.targetname)/ifmgr/0.1/configure_interface_from_system?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&enable:bool=true";
	    %delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/configure_interface_from_system?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&enable:bool=false";
	}

	mac {
	    %help:	short "Set the MAC address";
	    %set:	xrl  "$(interfaces.targetname)/ifmgr/0.1/set_mac?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&mac:mac=$(@)";
	    %delete:	xrl  "$(interfaces.targetname)/ifmgr/0.1/restore_original_mac?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)";
	    %get:	xrl  "$(interfaces.targetname)/ifmgr/0.1/get_configured_mac?ifname:txt=$(interface.@)->mac:mac=$(@)";
	}

	mtu {
	    %help:	short "Set the MTU";
	    /* Minimum and maximum MTU as defined in RFC 791 and RFC 1191 */
	    %allow-range: $(@) "68" "65535" %help: "The MTU (in octets)";
	    %set:	xrl  "$(interfaces.targetname)/ifmgr/0.1/set_mtu?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&mtu:u32=$(@)";
	    %delete:	xrl  "$(interfaces.targetname)/ifmgr/0.1/restore_original_mtu?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)";
	    %get:	xrl  "$(interfaces.targetname)/ifmgr/0.1/get_configured_mtu?ifname:txt=$(interface.@)->mtu:u32=$(@)";
	}

	parent-ifname {
		%help:	short "Parent interface this virtual belongs to.";
		%set:	xrl  "$(interfaces.targetname)/ifmgr/0.1/set_parent_ifname?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&parent_ifname:txt=$(@)";
	}

	iface-type {
		%help:	short "Interface-type:  VLAN.";
		%set:	xrl  "$(interfaces.targetname)/ifmgr/0.1/set_iface_type?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&iface_type:txt=$(@)";
	}

	vid {
		%help:	short "Virtual Interface Identifier:  VLAN-ID for VLANs.";
		%set:	xrl  "$(interfaces.targetname)/ifmgr/0.1/set_vid?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vid:txt=$(@)";
	}

	vif @: txt {
	    %help:	short "Configure a virtual interface";
	    %create:	xrl "$(interfaces.targetname)/ifmgr/0.1/create_vif?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(@)";
	    %delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/delete_vif?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(@)";
	    %list:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_vif_names?ifname:txt=$(interface.@)->vifs:list";

	    disable {
		%help:	short "Disable a network interface";
		%set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_vif_enabled?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&enabled:bool=`~$(@)`";
	    }

	    enabled {
		%deprecated: "Statement 'enabled: true/false' is replaced with 'disable: false/true'";
		%help:	short "Enable a network interface";
		%set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_vif_enabled?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&enabled:bool=$(@)";
	    }

	    address @: ipv4 {
		%help:		short "Configure an IPv4 address";
		%mandatory:	$(@.prefix-length);

		%create:	xrl "$(interfaces.targetname)/ifmgr/0.1/create_address4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(@)";
		%get:		xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_address_flags4?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(@)->enabled:bool&broadcast:bool=$(@.broadcast-capable)&loopback:bool=$(@.loopback)&point_to_point:bool=$(@.point-to-point)&multicast:bool=$(@.multicast-capable)";
		%delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/delete_address4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(@)";
		%list:		xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_vif_addresses4?ifname:txt=$(interface.@)&vif:txt->addresses:list";

		disable {
		    %help:	short "Disable the address";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_address_enabled4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)&enabled:bool=`~$(@)`";
		}

		enabled {
		    %deprecated: "Statement 'enabled: true/false' is replaced with 'disable: false/true'";
		    %help:	short "Enable the address";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_address_enabled4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)&enabled:bool=$(@)";
		}

		prefix-length {
		    %help:	short "Assign the network prefix length";
		    %allow-range: $(@) "1" "32" %help: "The network prefix length";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_prefix4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)&prefix_len:u32=$(@)";
		    %get:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_prefix4?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)->prefix_len:u32=$(@)";
		}

		broadcast {
		    %help:	short "Assign the network broadcast address";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_broadcast4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)&broadcast:ipv4=$(@)";
		    %get:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_broadcast4?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)->broadcast:ipv4=$(@)";
		}

		destination {
		    %help:	short "Assign the destination address on point-to-point links";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_endpoint4?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)&endpoint:ipv4=$(@)";
		    %get:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_endpoint4?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv4=$(address.@)->endpoint:ipv4=$(@)";
		}

		multicast-capable {
		    %help:	short "Show if this is multicast capable vif";
		}

		point-to-point {
		    %help:	short "Show if this is point-to-point vif";
		}

		loopback {
		    %help:	short "Show if this is a loopback vif";
		}

		broadcast-capable {
		    %help:	short "Show if this is a broadcast capable vif";
		}
	    }

	    address @: ipv6 {
		%help:		short "Configure an IPv6 address";
		%mandatory:	$(@.prefix-length);

		%create:	xrl "$(interfaces.targetname)/ifmgr/0.1/create_address6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(@)";
		%get:		xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_address_flags6?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)->enabled:bool&loopback:bool=$(@.loopback)&point_to_point:bool=$(@.point-to-point)&multicast:bool=$(@.multicast-capable)";
		%delete:	xrl "$(interfaces.targetname)/ifmgr/0.1/delete_address6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(@)";
		%list:		xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_vif_addresses6?ifname:txt=$(interface.@)&vif:txt->addresses:list";

		disable {
		    %help:	short "Disable the address";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_address_enabled6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)&enabled:bool=`~$(@)`";
		}

		enabled {
		    %deprecated: "Statement 'enabled: true/false' is replaced with 'disable: false/true'";
		    %help:	short "Enable the address";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_address_enabled6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)&enabled:bool=$(@)";
		}

		prefix-length {
		    %help:	short "Assign the network prefix length";
		    %allow-range: $(@) "1" "128" %help: "The network prefix length";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_prefix6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)&prefix_len:u32=$(@)";
		    %get:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_prefix6?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)->prefix_len:u32=$(@)";
		}

		destination {
		    %help:	short "Assign the destination address on point-to-point links";
		    %set:	xrl "$(interfaces.targetname)/ifmgr/0.1/set_endpoint6?tid:u32=$(interfaces.TID)&ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)&endpoint:ipv6=$(@)";
		    %get:	xrl "$(interfaces.targetname)/ifmgr/0.1/get_configured_endpoint6?ifname:txt=$(interface.@)&vif:txt=$(vif.@)&address:ipv6=$(address.@)->endpoint:ipv6=$(@)";
		}

		multicast-capable {
		    %help:	short "Show if this is multicast capable vif";
		}

		point-to-point {
		    %help:	short "Show if this is point-to-point vif";
		}

		loopback {
		    %help:	short "Show if this is a loopback vif";
		}
	    }
	}
    }
}
