Using custom RPCs

If an RPC is defined in a YANG module, you can use that RPC to return the associated namespace information defined in its output elements.

For example, to return information about port-profiles to which interfaces are applied, you can use the <get-port-profile-for-intf> RPC defined in the brocade-port-profile-ext.yang file.

The following example shows the <rpc> message and reply. The <get-port-profile-for-intf> element contains an xmlns attribute that identifies the corresponding namespace.

Refer to the Extreme SLX-OS YANG Reference Manual for a list of Custom RPCs, a brief description of their function, and their location.

Retrieving operational data with pagination

Some RPCs return operational data that consists of lists of entities. For example, an RPC might return detailed information about every interface. For these kinds of applications, to make the output manageable, pagination is supported by providing a <has-more> element in the output of the RPC.

The following example shows how the <has-more> element works to provide pagination for the <get-vlan-brief> RPC. In the input, you can request information about a specific VLAN, or about all VLANs by not providing an input parameter. If you request input about all VLANs, you will first receive information about the VLAN with the lowest VLAN ID. You can then check the <has-more> element in the output to determine whether information is available for additional VLANs. If <has-more> is true, use the value returned in <last-vlan-id> as the <last-rcvd--vlan-id> input parameter to the next call to <get-vlan-brief>. The <get-vlan-brief> RPC then returns the next available VLAN. Continue until <has-more> returns false.

+---x get-vlan-brief
	+--ro input
	| +--ro (request-type)?
	| +--:(get-request)
	| | +--ro vlan-id? interface:vlan-type
	| +--:(get-next-request)
	| +--ro last-rcvd-vlan-id? interface:vlan-type
	+--ro output
	  +--ro vlan [vlan-id]
	| +--ro vlan-id interface:vlan-type
	| +--ro vlan-type? enumeration
	| +--ro vlan-name? string
	| +--ro vlan-state? enumeration
	| +--ro interface [interface-type interface-name]
	| +--ro interface-type enumeration
	| +--ro interface-name union
	| +--ro tag? enumeration
	+--ro last-vlan-id? interface:vlan-type
	+--ro has-more? boolean

The following example uses the <get-interface-brief> RPC to return information about the first VLAN. In this case, the first VLAN is VLAN 20.

<rpc message-id="207" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-vlan-brief xmlns="urn:brocade.com:mgmt:brocade-interface-ext">
	</get-vlan-brief>
</rpc>

<rpc-reply message-id="207" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<vlan xmlns="urn:brocade.com:mgmt:brocade-interface-ext">
		<vlanid>20</vlanid>
		<vlan-type>static</vlan-type>
		<vlan-name>vlan-20</vlan-name>
		<vlan-state>active</valan-state>
		<interface>
			<interface-type>ethernet</interface-type>
			<interfce-name>2/5</interface-name>
			<tag>tagged</tag>
		</interface>
	</vlan>
	<last-vlan-id>20</last-vlan-id>
	<has-more>true</has-more>
</rpc-reply>

The <has-more> field is true, so use the value returned in <last-vlan-id> as the <last-rcvd-vlan-id> in the next call to <get-vlan-brief> to return information about the next VLAN.

<rpc message-id="208" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-vlan-brief xmlns="urn:brocade.com:mgmt:brocade-interface-ext">
		<last-rcvd-vlan-id>20</last-rcvd-vlan-id>
	</get-vlan-brief>
</rpc>

<rpc-reply message-id="208" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<vlan xmlns="urn:brocade.com:mgmt:brocade-interface-ext">
		<vlanid>30</vlanid>
		<vlan-type>static</vlan-type>
		<vlan-name>vlan-30</vlan-name>
		<vlan-state>active</valan-state>
		<interface>
			<interface-type>ethernet</interface-type>
			<interfce-name>2/5</interface-name>
			<tag>tagged</tag>
		</interface>
	</vlan>
	<last-vlan-id>30</last-vlan-id>
	<has-more>false</has-more>
</rpc-reply>

If the <has-more> field returns false, no more VLAN data can be retrieved.