Components of NSH Based Service Chaining
NSH defines a new service plane protocol specifically for the creation of dynamic service chains and is composed of the following elements:
Service Function Path (SFP) identification
Transport independent service function chain
Per-packet network and service metadata or optional variable type-length-value (TLV) metadata
A service classifier (SC) performs packet classification for incoming or outgoing flows and directs the matched traffic to service function paths. It may direct one or more flows to a particular service function (SF) path and may direct several such streams to different service function paths. Subsequent classification may occur on different SFs.
A classifier may be applied for incoming traffic. The classfifier action parameters include service path identifier and service function index. It may also include context metadata.
Service Function Forwarder
A Service Function Forwarder (SFF) performs the following tasks:
Remove the outer encapsulation and trigger a lookup based on service path index (SPI) and service index (SI) to identify the outgoing encapsulation.
Add new encapsulation and forward the packet to the Service Function (SF) or to the next SFF.
Support proxy function, that is without adding NSH in case the SF is non-NSH aware.
Service Function (SF) is responsible for specific treatment of received packets.
Flow of Packets in NSH Based Service Chaining
The following is the flow of packets in NSH based service chaining:
Packet arrives from the source through an input interface. Service policy is applied. Packet is classified to find the service chain (SPI, SI).
SFF looks up the service chain for the next hop (SF or SFF).
SFF encapsulates the packet with NSH and forwards the frame to SF. If there are multiple SNs per SF, load balancing occurs.
SF de-encapsulates the frame and restores the packet. SF processes the packet, decrements the service index, encapsulates the packet, and returns the frame back to SFF.
Steps 2 to 4 are repeated for each service index in the service function chain. After the last service function has serviced the packet, SFF decapsulates the NSH header and forwards the packet normally.
An NSH is composed of a 4-byte Base Header, a 4-byte Service Path Header and Context Headers. The Base Header provides information about the service header and the payload protocol. The Service Path Header provides path identification and location within a service path. The Context Headers carry metadata (context data) along a service path.
See https://tools.ietf.org/html/draft-ietf-sfc-nsh-05 for more details.