@@ -52,6 +52,14 @@ const map<string, sai_my_sid_entry_endpoint_behavior_flavor_t> end_flavor_map =
52
52
{" ua" , SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD}
53
53
};
54
54
55
+ const map<string, sai_srv6_sidlist_type_t > sidlist_type_map =
56
+ {
57
+ {" insert" , SAI_SRV6_SIDLIST_TYPE_INSERT},
58
+ {" insert.red" , SAI_SRV6_SIDLIST_TYPE_INSERT_RED},
59
+ {" encaps" , SAI_SRV6_SIDLIST_TYPE_ENCAPS},
60
+ {" encaps.red" , SAI_SRV6_SIDLIST_TYPE_ENCAPS_RED}
61
+ };
62
+
55
63
void Srv6Orch::srv6TunnelUpdateNexthops (const string srv6_source, const NextHopKey nhkey, bool insert)
56
64
{
57
65
if (insert)
@@ -267,7 +275,7 @@ bool Srv6Orch::srv6Nexthops(const NextHopGroupKey &nhgKey, sai_object_id_t &next
267
275
return true ;
268
276
}
269
277
270
- bool Srv6Orch::createUpdateSidList (const string sid_name, const string sid_list)
278
+ bool Srv6Orch::createUpdateSidList (const string sid_name, const string sid_list, const string sidlist_type )
271
279
{
272
280
SWSS_LOG_ENTER ();
273
281
bool exists = (sid_table_.find (sid_name) != sid_table_.end ());
@@ -303,7 +311,16 @@ bool Srv6Orch::createUpdateSidList(const string sid_name, const string sid_list)
303
311
attributes.push_back (attr);
304
312
305
313
attr.id = SAI_SRV6_SIDLIST_ATTR_TYPE;
306
- attr.value .s32 = SAI_SRV6_SIDLIST_TYPE_ENCAPS_RED;
314
+ if (sidlist_type_map.find (sidlist_type) == sidlist_type_map.end ())
315
+ {
316
+ SWSS_LOG_INFO (" Use default sidlist type: ENCAPS_RED" );
317
+ attr.value .s32 = SAI_SRV6_SIDLIST_TYPE_ENCAPS_RED;
318
+ }
319
+ else
320
+ {
321
+ SWSS_LOG_INFO (" sidlist type: %s" , sidlist_type.c_str ());
322
+ attr.value .s32 = sidlist_type_map.at (sidlist_type);
323
+ }
307
324
attributes.push_back (attr);
308
325
status = sai_srv6_api->create_srv6_sidlist (&segment_oid, gSwitchId , (uint32_t ) attributes.size (), attributes.data ());
309
326
if (status != SAI_STATUS_SUCCESS)
@@ -365,18 +382,22 @@ void Srv6Orch::doTaskSidTable(const KeyOpFieldsValuesTuple & tuple)
365
382
SWSS_LOG_ENTER ();
366
383
string sid_name = kfvKey (tuple);
367
384
string op = kfvOp (tuple);
368
- string sid_list;
385
+ string sid_list, sidlist_type ;
369
386
370
387
for (auto i : kfvFieldsValues (tuple))
371
388
{
372
389
if (fvField (i) == " path" )
373
390
{
374
391
sid_list = fvValue (i);
375
392
}
393
+ if (fvField (i) == " type" )
394
+ {
395
+ sidlist_type = fvValue (i);
396
+ }
376
397
}
377
398
if (op == SET_COMMAND)
378
399
{
379
- if (!createUpdateSidList (sid_name, sid_list))
400
+ if (!createUpdateSidList (sid_name, sid_list, sidlist_type ))
380
401
{
381
402
SWSS_LOG_ERROR (" Failed to process sid %s" , sid_name.c_str ());
382
403
}
0 commit comments