@@ -400,6 +400,14 @@ sai_status_t transfer_attribute(
400
400
RETURN_ON_ERROR (transfer_list (src_attr.value .aclcapability .action_list , dst_attr.value .aclcapability .action_list , countOnly));
401
401
break ;
402
402
403
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG:
404
+ transfer_primitive (src_attr.value .sysportconfig , dst_attr.value .sysportconfig );
405
+ break ;
406
+
407
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
408
+ RETURN_ON_ERROR (transfer_list (src_attr.value .sysportconfiglist , dst_attr.value .sysportconfiglist , countOnly));
409
+ break ;
410
+
403
411
default :
404
412
return SAI_STATUS_NOT_IMPLEMENTED;
405
413
}
@@ -1398,6 +1406,73 @@ std::string sai_serialize_acl_capability(
1398
1406
return mandatory + " :" + list;
1399
1407
}
1400
1408
1409
+ std::string sai_serialize_system_port_config (
1410
+ _In_ const sai_attr_metadata_t &meta,
1411
+ _In_ const sai_system_port_config_t &sysportconfig)
1412
+ {
1413
+ SWSS_LOG_ENTER ();
1414
+
1415
+ json j;
1416
+
1417
+ j[" port_id" ] = sai_serialize_number (sysportconfig.port_id , false );
1418
+ j[" attached_switch_id" ] = sai_serialize_number (sysportconfig.attached_switch_id , false );
1419
+ j[" attached_core_index" ] = sai_serialize_number (sysportconfig.attached_core_index , false );
1420
+ j[" attached_core_port_index" ] = sai_serialize_number (sysportconfig.attached_core_port_index , false );
1421
+ j[" speed" ] = sai_serialize_number (sysportconfig.speed , false );
1422
+ j[" num_voq" ] = sai_serialize_number (sysportconfig.num_voq , false );
1423
+
1424
+ return j.dump ();
1425
+ }
1426
+
1427
+ json sai_serialize_system_port_cfg_list_item (
1428
+ _In_ const sai_system_port_config_t &sysportconfig)
1429
+ {
1430
+ SWSS_LOG_ENTER ();
1431
+
1432
+ json j;
1433
+
1434
+ j[" port_id" ] = sai_serialize_number (sysportconfig.port_id , false );
1435
+ j[" attached_switch_id" ] = sai_serialize_number (sysportconfig.attached_switch_id , false );
1436
+ j[" attached_core_index" ] = sai_serialize_number (sysportconfig.attached_core_index , false );
1437
+ j[" attached_core_port_index" ] = sai_serialize_number (sysportconfig.attached_core_port_index , false );
1438
+ j[" speed" ] = sai_serialize_number (sysportconfig.speed , false );
1439
+ j[" num_voq" ] = sai_serialize_number (sysportconfig.num_voq , false );
1440
+
1441
+ return j;
1442
+ }
1443
+
1444
+ std::string sai_serialize_system_port_config_list (
1445
+ _In_ const sai_attr_metadata_t &meta,
1446
+ _In_ const sai_system_port_config_list_t & sysportconfiglist,
1447
+ _In_ bool countOnly)
1448
+ {
1449
+ SWSS_LOG_ENTER ();
1450
+
1451
+ json j;
1452
+
1453
+ j[" count" ] = sysportconfiglist.count ;
1454
+
1455
+ if (sysportconfiglist.list == NULL || countOnly)
1456
+ {
1457
+ j[" list" ] = nullptr ;
1458
+
1459
+ return j.dump ();
1460
+ }
1461
+
1462
+ json arr = json::array ();
1463
+
1464
+ for (uint32_t i = 0 ; i < sysportconfiglist.count ; ++i)
1465
+ {
1466
+ json item = sai_serialize_system_port_cfg_list_item (sysportconfiglist.list [i]);
1467
+
1468
+ arr.push_back (item);
1469
+ }
1470
+
1471
+ j[" list" ] = arr;
1472
+
1473
+ return j.dump ();
1474
+ }
1475
+
1401
1476
std::string sai_serialize_attr_value (
1402
1477
_In_ const sai_attr_metadata_t & meta,
1403
1478
_In_ const sai_attribute_t &attr,
@@ -1533,6 +1608,12 @@ std::string sai_serialize_attr_value(
1533
1608
case SAI_ATTR_VALUE_TYPE_ACL_CAPABILITY:
1534
1609
return sai_serialize_acl_capability (meta, attr.value .aclcapability , countOnly);
1535
1610
1611
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG:
1612
+ return sai_serialize_system_port_config (meta, attr.value .sysportconfig );
1613
+
1614
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
1615
+ return sai_serialize_system_port_config_list (meta, attr.value .sysportconfiglist , countOnly);
1616
+
1536
1617
default :
1537
1618
SWSS_LOG_THROW (" FATAL: invalid serialization type %d" , meta.attrvaluetype );
1538
1619
}
@@ -2566,6 +2647,77 @@ void sai_deserialize_acl_capability(
2566
2647
sai_deserialize_enum_list (list, &sai_metadata_enum_sai_acl_action_type_t , cap.action_list , false );
2567
2648
}
2568
2649
2650
+ void sai_deserialize_system_port_config (
2651
+ _In_ const std::string& s,
2652
+ _Out_ sai_system_port_config_t & sysportconfig)
2653
+ {
2654
+ SWSS_LOG_ENTER ();
2655
+
2656
+ json j = json::parse (s);
2657
+
2658
+ sai_deserialize_number (j[" port_id" ], sysportconfig.port_id , false );
2659
+ sai_deserialize_number (j[" attached_switch_id" ], sysportconfig.attached_switch_id , false );
2660
+ sai_deserialize_number (j[" attached_core_index" ], sysportconfig.attached_core_index , false );
2661
+ sai_deserialize_number (j[" attached_core_port_index" ], sysportconfig.attached_core_port_index , false );
2662
+ sai_deserialize_number (j[" speed" ], sysportconfig.speed , false );
2663
+ sai_deserialize_number (j[" num_voq" ], sysportconfig.num_voq , false );
2664
+
2665
+ }
2666
+
2667
+ void sai_deserialize_system_port_cfg_list_item (
2668
+ _In_ const json& j,
2669
+ _Out_ sai_system_port_config_t & sysportconfig)
2670
+ {
2671
+ SWSS_LOG_ENTER ();
2672
+
2673
+ sai_deserialize_number (j[" port_id" ], sysportconfig.port_id , false );
2674
+ sai_deserialize_number (j[" attached_switch_id" ], sysportconfig.attached_switch_id , false );
2675
+ sai_deserialize_number (j[" attached_core_index" ], sysportconfig.attached_core_index , false );
2676
+ sai_deserialize_number (j[" attached_core_port_index" ], sysportconfig.attached_core_port_index , false );
2677
+ sai_deserialize_number (j[" speed" ], sysportconfig.speed , false );
2678
+ sai_deserialize_number (j[" num_voq" ], sysportconfig.num_voq , false );
2679
+ }
2680
+
2681
+ void sai_deserialize_system_port_config_list (
2682
+ _In_ const std::string& s,
2683
+ _Out_ sai_system_port_config_list_t & sysportconfiglist,
2684
+ _In_ bool countOnly)
2685
+ {
2686
+ SWSS_LOG_ENTER ();
2687
+
2688
+ json j = json::parse (s);
2689
+
2690
+ sysportconfiglist.count = j[" count" ];
2691
+
2692
+ if (countOnly)
2693
+ {
2694
+ return ;
2695
+ }
2696
+
2697
+ if (j[" list" ] == nullptr )
2698
+ {
2699
+ sysportconfiglist.list = NULL ;
2700
+ return ;
2701
+ }
2702
+
2703
+ json arr = j[" list" ];
2704
+
2705
+ if (arr.size () != (size_t )sysportconfiglist.count )
2706
+ {
2707
+ SWSS_LOG_ERROR (" system port config list count mismatch %lu vs %u" , arr.size (), sysportconfiglist.count );
2708
+ throw std::runtime_error (" system port config list count mismatch" );
2709
+ }
2710
+
2711
+ sysportconfiglist.list = sai_alloc_n_of_ptr_type (sysportconfiglist.count , sysportconfiglist.list );
2712
+
2713
+ for (uint32_t i = 0 ; i < sysportconfiglist.count ; ++i)
2714
+ {
2715
+ const json& item = arr[i];
2716
+
2717
+ sai_deserialize_system_port_cfg_list_item (item, sysportconfiglist.list [i]);
2718
+ }
2719
+ }
2720
+
2569
2721
void sai_deserialize_attr_value (
2570
2722
_In_ const std::string& s,
2571
2723
_In_ const sai_attr_metadata_t & meta,
@@ -2704,6 +2856,12 @@ void sai_deserialize_attr_value(
2704
2856
case SAI_ATTR_VALUE_TYPE_ACL_CAPABILITY:
2705
2857
return sai_deserialize_acl_capability (s, attr.value .aclcapability );
2706
2858
2859
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG:
2860
+ return sai_deserialize_system_port_config (s, attr.value .sysportconfig );
2861
+
2862
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
2863
+ return sai_deserialize_system_port_config_list (s, attr.value .sysportconfiglist , countOnly);
2864
+
2707
2865
default :
2708
2866
SWSS_LOG_THROW (" deserialize type %d is not supportd yet FIXME" , meta.attrvaluetype );
2709
2867
}
@@ -3269,6 +3427,13 @@ void sai_deserialize_free_attribute_value(
3269
3427
sai_free_list (attr.value .aclcapability .action_list );
3270
3428
break ;
3271
3429
3430
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG:
3431
+ break ;
3432
+
3433
+ case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
3434
+ sai_free_list (attr.value .sysportconfiglist );
3435
+ break ;
3436
+
3272
3437
default :
3273
3438
SWSS_LOG_THROW (" unsupported type %d on deserialize free, FIXME" , type);
3274
3439
}
0 commit comments