summaryrefslogtreecommitdiffstats
path: root/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_e_rest_config.sh
blob: 01408a159d0d0f9309776d3a3e899bcdbdc5a59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/usr/bin/env bash
echo "VPPE - configuring routing table for SIDs and policy via HC"
curl --insecure --request PUT \
  --url https://172.17.0.6:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \
  --header 'accept: application/json' \
  --header 'authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'content-type: application/json' \
  --data '{
    "vpp-fib-table-management:table": [
        {
            "table-id": 0,
            "address-family": "vpp-fib-table-management:ipv6",
            "name": "ipv6-VRF:0"
        }
    ]
}'
sleep 1

echo "VPPE - configuring local sid E::201 via HC"
curl --insecure --request PUT \
  --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/e::/ \
  --header 'accept: application/json' \
  --header 'authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'content-type: application/json' \
  --data '{
    "hc2vpp-ietf-srv6-base:locator": [
        {
            "name": "e::",
            "is-default": false,
            "prefix": {
                "address": "e::",
                "length": 64
            },
            "enable": true,
            "vpp-ietf-srv6-base:fib-table" : {
                "table-id": 0,
                "address-family": "vpp-fib-table-management:ipv6"
            }
        }
    ]
}'
sleep 1

curl --insecure --request PUT \
  --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/e::/static/local-sids/sid/513/ \
  --header 'accept: application/json' \
  --header 'authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'content-type: application/json' \
  --data '{
    "hc2vpp-ietf-srv6-static:sid": [
        {
            "opcode": 513,
            "end-behavior-type": "ietf-srv6-types:End.DX6",
            "end-dx6": {
                "paths": {
                    "path": [
                        {
                            "path-index": 1,
                            "interface": "host-veth0",
                            "next-hop": "e::1",
                            "weight": 1,
                            "role": "PRIMARY"
                        }
                    ]
                }
            }
        }
    ]
}'

echo "VPPE - configuring encapsulation source via HC"
curl --insecure --request PUT \
  --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation/ \
  --header 'accept: application/json' \
  --header 'authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'content-type: application/json' \
  --data '{
    "hc2vpp-ietf-srv6-base:encapsulation": {
        "ip-ttl-propagation": false,
        "source-address": "e::1"
    }
}'
sleep 1

echo "VPPE - configuring SRv6 policy via HC"
curl --insecure --request PUT \
  --url https://172.17.0.6:8445/restconf/config/hc2vpp-oc-srte-policy:segment-routing \
  --header 'accept: application/json' \
  --header 'authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'content-type: application/json' \
  --data '{
    "hc2vpp-oc-srte-policy:segment-routing": {
        "traffic-engineering": {
            "named-segment-lists": {
                "named-segment-list": [{
                    "name": "e::a-1",
                    "config": {
                        "name": "e::a-1"
                    },
                    "segments": {
                        "segment": [{
                            "index": 1,
                            "config": {
                                "index": 1,
                                "type": "type-2",
                                "sid-value": "d::100"
                            }
                        },
                        {
                            "index": 2,
                            "config": {
                                "index": 2,
                                "type": "type-2",
                                "sid-value": "b::100"
                            }
                        },
                        {
                            "index": 3,
                            "config": {
                                "index": 3,
                                "type": "type-2",
                                "sid-value": "a::201"
                            }
                        }]
                    }
                }]
            },
            "policies": {
                "policy": [{
                    "name": "e::a",
                    "config": {
                        "name": "e::a",
                        "color": 1,
                        "endpoint": "a::1",
                        "admin-state": "UP"
                    },
                    "color": 1,
                    "endpoint": "a::1",
                    "candidate-paths": {
                        "candidate-path": [{
                            "name": "candidatePath1",
                            "provisioning-method": "provisioning-method-config",
                            "preference": 100,
                            "distinguisher": 0,
                            "config": {
                                "name": "candidatePath1",
                                "provisioning-method": "provisioning-method-config",
                                "computation-method": "path-explicitly-defined",
                                "preference": 100,
                                "distinguisher": 0
                            },
                            "binding-sid": {
                                "config": {
                                    "alloc-mode": "explicit",
                                    "type": "srv6",
                                    "value": "e::a"
                                }
                            },
                            "segment-lists": {
                                "segment-list": [{
                                    "name": "e::a-1",
                                    "config": {
                                        "name": "e::a-1",
                                        "weight": 1
                                    }
                                }]
                            }
                        }]
                    },
                    "autoroute-include": {
                        "config": {
                            "metric-type": "constant",
                            "metric-constant": 0
                        },
                        "prefixes": {
                            "config": {
                                "prefixes-all": false
                            },
                            "prefix": [{
                                "ip-prefix": "a::/64",
                                "config": {
                                    "ip-prefix": "a::/64"
                                }
                            }]
                        }
                    },
                    "binding-sid": {
                        "config": {
                            "alloc-mode": "explicit",
                            "type": "srv6",
                            "value": "e::a"
                        }
                    },
                    "vpp-oc-srte-policy:vpp-sr-policy": {
                        "config": {
                            "policy-type": "Default",
                            "policy-behavior": "Encapsulation",
                            "table-id": 0,
                            "address-family": "vpp-fib-table-management:ipv6"
                        }
                    }
                }]
            }
        }
    }
}'
sleep 1