Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Router Rules define which set of routers to use when sending messages to a destination NID(s). It can also be used to identify preferred routers for primary source NID.

When defining a network there could be paths which are more optimal than others. To have more control over the path traffic takes, admins configure interfaces on different networks, and split up the router pools among the networks. However, this results in complex configuration, which is hard to maintain and error prone. It is much more desirable to configure all interfaces on the same network, and then define which routers to use when sending to a remote peer or from a source peer. Router Rules allow this functionality

Matching Criteria

There are two mutually exclusive matching criteria: source NID and Destination NID.

A router rule can take A Router rule takes two expressions describing the destination NIDs and the router NIDs which should be preferred when sending to the matching destination NIDs. The matching rules for each of the supplied NID expressions is the same as the NID Rules above.

A router rule can take two expressions describing the source NID and the router NIDs which should be preferred when sending from the specified source NID.

Only the source NID descriptor or the destination NID descriptor can be provided as a matching criteria but not both.

Matching Action

The remote NIDs available in the system are examined. Each remote NID which matches the destination or source NID expression in the policy, will have a set of router NIDs, which match the router NID expression in the policy, added to its preferred router NID list. If no router NID matches the router NID expression in the policy, then the action is a no-op.

...

Gliffy Diagram
nameSelectionFlow
pagePin89

The diagram shows the integration of the UDSP provided actions in the logical flow of the selection algorithm.

...

  1. iterate over all the networks that a peer can be reached on and select the best local network
    1. The remote network with the highest priority is examined
      1. Network Rule
    2. The local network with the highest priority is selected
      1. Netword Rule
    3. The local NI with the highest priority is selected
      1. NID Rule
  2. If the peer is a remote peer and has no local networks,
    1. then select the remote peer network with the highest priority
      1. Network Rule
    2. Select the highest priority remote peer_ni on the network selected
      1. NID Rule
    3. Now that the peer's network and NI are decided select the router in round robin from the source primary NI and peer NI's preferred router list. The preferred list on the source primary NI takes precedence.
      1. Router Rule
  3. Otherwise for local peers, select the peer_ni from the peer.
    1. highest priority peer NI is selected
      1. NID Rule
    2. Select the peer NI which has the local NI selected on its preferred list.
      1. NID Pair Rule

...

Code Block
# Adding a local network udsp
# if multiple local networks are available, each one can have a priority. 
# The one with the highest priority is preferred
lnetctl policy add --src <net type><net number expression>
                   --<action type> <action context sensitive value> 
                   --idx <value>
	--src: is defined in ip2nets syntax. '<net type><expr>' syntax indicates the network.
		   <net type> is one of o2ib, tcp, gni, etc
           <expr> is an ip2nets expression describing a network number.
	--<action type>: 'priority' is the only implemented action type
	--<action context sensitive value>: is a value specific to the action type.
					  For 'priority' it's a value for [0 - 255], with 0 as the highest
                      priority
	--idx: The index of where to insert the rule. If it's larger than the policy list size it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# Adding a local NID udsp
# After a local network is chosen, if there are multiple NIs in the network the
# one with highest priority is preferred.
lnetct policy add --src <Address descriptor>@<net type><expr>
                  --<action type> <action context sensitive value>
				  --idx <value>
	--src: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--<action type>: 'priority' is the only implemented action type
	--<action context sensitive value>: is a value specific to the action type.
					  For 'priority' it's a value for [0 - 255], with 0 as the highest
                      priority
	--idx: The index of where to insert the rule. If it's larger than the policy list it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# Adding a remote NID udsp
# select the peer NID with the highest priority.
lnetct policy add --dst <Address descriptor>@<net type><expr>
                  --<action type> <action context sensitive value>
				  --idx <value>
	--dst: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--<action type>: 'priority' is the only implemented action type
	--<action context sensitive value>: is a value specific to the action type.
					  For 'priority' it's a value for [0 - 255], with 0 as the highest
                      priority
	--idx: The index of where to insert the rule. If it's larger than the policy list it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# Adding a NID pair udsp
# When this rule is instantiated the local NIDs which match the rule are added on a list
# on the peer NIs matching the rule. When selecting the peer NI, the one with the 
# local NID being used on its list is preferred.
lnetct policy add --src <Address descriptor>@<net type><expr>
                  --dst <Address descriptor>@<net type><expr>
				  --idx <value>
	--src: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--dst: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
           Destination NIDs can be local or remote.
	--idx: The index of where to insert the rule. If it's larger than the policy list it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# Adding a Router udsp
# similar to the NID pair udsp. The router NIDs matching the rule are added on a list
# on the peer NIs matching the rule. When sending to a remote peer, the router which
# has its nid on the peer NI list is preferred.
lnetct policy add --dst <Address descriptor>@<net type><expr>
                  --rte <Address descriptor>@<net type><expr>
				  --idx <value>
	--dst: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--rte: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--idx: The index of where to insert the rule. If it's larger than the policy list it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# Adding a Router udsp
# similar to the NID pair udsp. The router NIDs matching the rule are added on a list
# on the source's primary NIs matching the rule. When sending from on of the constituents of this
# primary NI, then , the router which has its nid on the peer NI list is preferred. If there are two
# UDSPs setting the preference of router selection based on the source primary NID and the peer 
# primary NID, then the preferred list on the source's primary NID takes precedence.
lnetct policy add --src <Address descriptor>@<net type><expr>
                  --rte <Address descriptor>@<net type><expr>
				  --idx <value>
	--dst: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--rte: the address descriptor defined in ip2nets syntax as described in the manual
		   <net type><expr> is similar to what has been described previously.
	--idx: The index of where to insert the rule. If it's larger than the policy list it's
		   appended to the end of the list. If not specified the default behaviour is to append
		   to the end of the list

# show all policies in the system.
# the policies are dumped in YAML form.
# Each policy is assigned an index.
# The index is part of the policy YAML block
lnetctl policy show

# to delete a policy the index must be specified.
# The normal behaviour then is to first show the list of policies
# grab the index and use it in the delete command.
lnetctl policy del --idx <value>

# generally, the syntax is as follows
 lnetctl policy <add | del | show>
  --src: ip2nets syntax specifying the local NID to match
  --dst: ip2nets syntax specifying the remote NID to match
  --rte: ip2nets syntax specifying the router NID to match
  --priority: Priority to apply to rule matches
  --idx: Index of where to insert the rule. By default it appends to
		 the end of the rule list 

...