add classify session action set-sr-policy-index
[vpp.git] / src / vnet / srv6 / sr_steering.md
1 # Steering packets into a SR Policy     {#srv6_steering_doc}
2
3 ## steer packets uging the sr steering policy
4
5 To steer packets in Transit into an SR policy (T.Insert, T.Encaps and T.Encaps.L2 behaviors), the user needs to create an 'sr steering policy'.
6
7     sr steer l3 2001::/64 via sr policy index 1
8     sr steer l3 2001::/64 via sr policy bsid cafe::1
9     sr steer l3 2001::/64 via sr policy bsid cafe::1 fib-table 3
10     sr steer l3 10.0.0.0/16 via sr policy bsid cafe::1
11     sr steer l2 TenGE0/1/0 via sr policy bsid cafe::1
12
13 Disclaimer: The T.Encaps.L2 will steer L2 frames into an SR Policy. Notice that creating an SR steering policy for L2 frames will actually automatically *put the interface into promiscous mode*.
14
15 ## steer packets using the classifier
16
17 Another way to steer packet is to use the classifier.
18
19 First the user need to manually add the source routing node to the list of the
20 ip6-inacl next nodes.
21 Using the python api this can be donne with:
22
23     # jsonfiles = get list of json api files
24     vpp = VPP(jsonfiles)
25     vpp.add_node_next(node_name='ip6-inacl', next_name='sr-pl-rewrite-insert')
26
27 Below is a classifier mask filtering all the packets from the interface
28 TenGigabitEthernet5/0/0 on ip version and moving all ipv6 packets to the
29 sr-pl-rewrite-insert node (dropping the others) and applying the source routing
30 index 2.
31 In essence, this means "apply this sr policy to all the packets from this interface)
32
33     vpp# classify table miss-next 0 current-data-flag 1  mask hex f000000000000000 skip 0
34     vpp# classify session acl-hit-next 1 table-index 0 match hex 6000000000000000 action set-sr-policy-index 2
35     vpp# set interface input acl intfc TenGigabitEthernet5/0/0 ip6-table 0