GBP: l3-out subnets
[vpp.git] / src / plugins / srv6-ad / ad_plugin_doc.md
1 # SRv6 endpoint to SR-unaware appliance via dynamic proxy (End.AD) {#srv6_ad_plugin_doc}
2
3 ## Overview
4
5 The dynamic proxy is an improvement over the static proxy (@ref srv6_as_plugin_doc)
6 that dynamically learns the SR information before removing it from the incoming
7 traffic. The same information can then be re-attached to the traffic returning
8 from the SF. As opposed to the static SR proxy, no CACHE information needs to be
9 configured. Instead, the dynamic SR proxy relies on a local caching mechanism on
10 the node instantiating this segment. Therefore, a dynamic proxy segment cannot
11 be the last segment in an SR SC policy. A different SR behavior should thus be
12 used if the SF is meant to be the final destination of an SR SC policy.
13
14 Upon receiving a packet whose active segment matches a dynamic SR proxy
15 function, the proxy node pops the top MPLS label or applies the SRv6 End
16 behavior, then compares the updated SR information with the cache entry for the
17 current segment. If the cache is empty or different, it is updated with the new
18 SR information. The SR information is then removed and the inner packet is sent
19 towards the SF.
20
21 The cache entry is not mapped to any particular packet, but instead to an SR SC
22 policy identified by the receiving interface (IFACE-IN). Any non-link-local IP
23 packet or non-local Ethernet frame received on that interface will be
24 re-encapsulated with the cached headers as described in @ref srv6_as_plugin_doc. The
25 SF may thus drop, modify or generate new packets without affecting the proxy.
26
27 For more information, please see
28 [draft-xuclad-spring-sr-service-chaining](https://datatracker.ietf.org/doc/draft-xuclad-spring-sr-service-chaining/).
29
30 ## CLI configuration
31
32 The following command instantiates a new End.AD segment that sends the inner
33 packets on interface `IFACE-OUT` towards an appliance at address `S-ADDR` and
34 restores the encapsulation headers of the packets coming back on interface
35 `IFACE-IN`.
36
37 ```
38 sr localsid address SID behavior end.ad nh S-ADDR oif IFACE-OUT iif IFACE-IN
39 ```
40
41 For example, the below command configures the SID `1::A1` with an End.AD
42 function for sending traffic on interface `GigabitEthernet0/8/0` to the
43 appliance at address `A1::`, and receiving it back on interface
44 `GigabitEthernet0/9/0`.
45
46 ```
47 sr localsid address 1::A1 behavior end.ad nh A1:: oif GigabitEthernet0/8/0 iif GigabitEthernet0/9/0
48 ```
49
50 ## Pseudocode
51
52 The dynamic proxy SRv6 pseudocode is obtained by inserting the following
53 instructions between lines 1 and 2 of the static proxy SRv6 pseudocode.
54
55 ```
56 IF NH=SRH & SL > 0 THEN
57     Decrement SL and update the IPv6 DA with SRH[SL]
58     IF C(IFACE-IN) different from IPv6 encaps THEN              ;; Ref1
59         Copy the IPv6 encaps into C(IFACE-IN)                   ;; Ref2
60 ELSE
61     Drop the packet
62 ```
63
64 **Ref1:** "IPv6 encaps" represents the IPv6 header and any attached extension
65 header.
66
67 **Ref2:** C(IFACE-IN) represents the cache entry associated to the dynamic SR proxy
68 segment. It is identified with IFACE-IN in order to efficiently retrieve the
69 right SR information when a packet arrives on this interface.
70
71 In addition, the inbound policy should check that C(IFACE-IN) has been defined
72 before attempting to restore the IPv6 encapsulation, and drop the packet
73 otherwise.