@@ -43,6 +43,8 @@ const map<CrmResourceType, string> crmResTypeNameMap =
43
43
{ CrmResourceType::CRM_DNAT_ENTRY, " DNAT_ENTRY" },
44
44
{ CrmResourceType::CRM_MPLS_INSEG, " MPLS_INSEG" },
45
45
{ CrmResourceType::CRM_MPLS_NEXTHOP, " MPLS_NEXTHOP" },
46
+ { CrmResourceType::CRM_SRV6_MY_SID_ENTRY, " SRV6_MY_SID_ENTRY" },
47
+ { CrmResourceType::CRM_SRV6_NEXTHOP, " SRV6_NEXTHOP" },
46
48
};
47
49
48
50
const map<CrmResourceType, uint32_t > crmResSaiAvailAttrMap =
@@ -65,6 +67,8 @@ const map<CrmResourceType, uint32_t> crmResSaiAvailAttrMap =
65
67
{ CrmResourceType::CRM_DNAT_ENTRY, SAI_SWITCH_ATTR_AVAILABLE_DNAT_ENTRY },
66
68
{ CrmResourceType::CRM_MPLS_INSEG, SAI_OBJECT_TYPE_INSEG_ENTRY },
67
69
{ CrmResourceType::CRM_MPLS_NEXTHOP, SAI_SWITCH_ATTR_AVAILABLE_IPV4_NEXTHOP_ENTRY },
70
+ { CrmResourceType::CRM_SRV6_MY_SID_ENTRY, SAI_OBJECT_TYPE_MY_SID_ENTRY },
71
+ { CrmResourceType::CRM_SRV6_NEXTHOP, SAI_SWITCH_ATTR_AVAILABLE_IPV6_NEXTHOP_ENTRY },
68
72
};
69
73
70
74
const map<string, CrmResourceType> crmThreshTypeResMap =
@@ -87,6 +91,8 @@ const map<string, CrmResourceType> crmThreshTypeResMap =
87
91
{ " dnat_entry_threshold_type" , CrmResourceType::CRM_DNAT_ENTRY },
88
92
{ " mpls_inseg_threshold_type" , CrmResourceType::CRM_MPLS_INSEG },
89
93
{ " mpls_nexthop_threshold_type" , CrmResourceType::CRM_MPLS_NEXTHOP },
94
+ { " srv6_my_sid_entry_threshold_type" , CrmResourceType::CRM_SRV6_MY_SID_ENTRY },
95
+ { " srv6_nexthop_threshold_type" , CrmResourceType::CRM_SRV6_NEXTHOP },
90
96
};
91
97
92
98
const map<string, CrmResourceType> crmThreshLowResMap =
@@ -109,6 +115,8 @@ const map<string, CrmResourceType> crmThreshLowResMap =
109
115
{" dnat_entry_low_threshold" , CrmResourceType::CRM_DNAT_ENTRY },
110
116
{" mpls_inseg_low_threshold" , CrmResourceType::CRM_MPLS_INSEG },
111
117
{" mpls_nexthop_low_threshold" , CrmResourceType::CRM_MPLS_NEXTHOP },
118
+ {" srv6_my_sid_entry_low_threshold" , CrmResourceType::CRM_SRV6_MY_SID_ENTRY },
119
+ {" srv6_nexthop_low_threshold" , CrmResourceType::CRM_SRV6_NEXTHOP },
112
120
};
113
121
114
122
const map<string, CrmResourceType> crmThreshHighResMap =
@@ -131,6 +139,8 @@ const map<string, CrmResourceType> crmThreshHighResMap =
131
139
{" dnat_entry_high_threshold" , CrmResourceType::CRM_DNAT_ENTRY },
132
140
{" mpls_inseg_high_threshold" , CrmResourceType::CRM_MPLS_INSEG },
133
141
{" mpls_nexthop_high_threshold" , CrmResourceType::CRM_MPLS_NEXTHOP },
142
+ {" srv6_my_sid_entry_high_threshold" , CrmResourceType::CRM_SRV6_MY_SID_ENTRY },
143
+ {" srv6_nexthop_high_threshold" , CrmResourceType::CRM_SRV6_NEXTHOP },
134
144
};
135
145
136
146
const map<string, CrmThresholdType> crmThreshTypeMap =
@@ -160,6 +170,8 @@ const map<string, CrmResourceType> crmAvailCntsTableMap =
160
170
{ " crm_stats_dnat_entry_available" , CrmResourceType::CRM_DNAT_ENTRY },
161
171
{ " crm_stats_mpls_inseg_available" , CrmResourceType::CRM_MPLS_INSEG },
162
172
{ " crm_stats_mpls_nexthop_available" , CrmResourceType::CRM_MPLS_NEXTHOP },
173
+ { " crm_stats_srv6_my_sid_entry_available" , CrmResourceType::CRM_SRV6_MY_SID_ENTRY },
174
+ { " crm_stats_srv6_nexthop_available" , CrmResourceType::CRM_SRV6_NEXTHOP },
163
175
};
164
176
165
177
const map<string, CrmResourceType> crmUsedCntsTableMap =
@@ -182,6 +194,8 @@ const map<string, CrmResourceType> crmUsedCntsTableMap =
182
194
{ " crm_stats_dnat_entry_used" , CrmResourceType::CRM_DNAT_ENTRY },
183
195
{ " crm_stats_mpls_inseg_used" , CrmResourceType::CRM_MPLS_INSEG },
184
196
{ " crm_stats_mpls_nexthop_used" , CrmResourceType::CRM_MPLS_NEXTHOP },
197
+ { " crm_stats_srv6_my_sid_entry_used" , CrmResourceType::CRM_SRV6_MY_SID_ENTRY },
198
+ { " crm_stats_srv6_nexthop_used" , CrmResourceType::CRM_SRV6_NEXTHOP },
185
199
};
186
200
187
201
CrmOrch::CrmOrch (DBConnector *db, string tableName):
@@ -614,6 +628,62 @@ void CrmOrch::getResAvailableCounters()
614
628
break ;
615
629
}
616
630
631
+ case CrmResourceType::CRM_SRV6_MY_SID_ENTRY:
632
+ {
633
+ sai_object_type_t objType = static_cast <sai_object_type_t >(crmResSaiAvailAttrMap.at (res.first ));
634
+ uint64_t availCount = 0 ;
635
+ sai_status_t status = sai_object_type_get_availability (gSwitchId , objType, 0 , nullptr , &availCount);
636
+ if (status != SAI_STATUS_SUCCESS)
637
+ {
638
+ if ((status == SAI_STATUS_NOT_SUPPORTED) ||
639
+ (status == SAI_STATUS_NOT_IMPLEMENTED) ||
640
+ SAI_STATUS_IS_ATTR_NOT_SUPPORTED (status) ||
641
+ SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED (status))
642
+ {
643
+ // mark unsupported resources
644
+ res.second .resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED;
645
+ SWSS_LOG_NOTICE (" CRM Resource %s not supported" , crmResTypeNameMap.at (res.first ).c_str ());
646
+ break ;
647
+ }
648
+ SWSS_LOG_ERROR (" Failed to get availability for object_type %u , rv:%d" , objType, status);
649
+ break ;
650
+ }
651
+
652
+ res.second .countersMap [CRM_COUNTERS_TABLE_KEY].availableCounter = static_cast <uint32_t >(availCount);
653
+
654
+ break ;
655
+ }
656
+
657
+ case CrmResourceType::CRM_SRV6_NEXTHOP:
658
+ {
659
+ sai_object_type_t objType = static_cast <sai_object_type_t >(crmResSaiAvailAttrMap.at (res.first ));
660
+ sai_attribute_t attr;
661
+ uint64_t availCount = 0 ;
662
+
663
+ attr.id = SAI_NEXT_HOP_ATTR_TYPE;
664
+ attr.value .s32 = SAI_NEXT_HOP_TYPE_SRV6_SIDLIST;
665
+ sai_status_t status = sai_object_type_get_availability (gSwitchId , objType, 1 , &attr, &availCount);
666
+ if (status != SAI_STATUS_SUCCESS)
667
+ {
668
+ if ((status == SAI_STATUS_NOT_SUPPORTED) ||
669
+ (status == SAI_STATUS_NOT_IMPLEMENTED) ||
670
+ SAI_STATUS_IS_ATTR_NOT_SUPPORTED (status) ||
671
+ SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED (status))
672
+ {
673
+ // mark unsupported resources
674
+ res.second .resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED;
675
+ SWSS_LOG_NOTICE (" CRM Resource %s not supported" , crmResTypeNameMap.at (res.first ).c_str ());
676
+ break ;
677
+ }
678
+ SWSS_LOG_ERROR (" Failed to get availability for object_type %u , rv:%d" , objType, status);
679
+ break ;
680
+ }
681
+
682
+ res.second .countersMap [CRM_COUNTERS_TABLE_KEY].availableCounter = static_cast <uint32_t >(availCount);
683
+
684
+ break ;
685
+ }
686
+
617
687
default :
618
688
SWSS_LOG_ERROR (" Failed to get CRM resource type %u. Unknown resource type.\n " , static_cast <uint32_t >(res.first ));
619
689
return ;
0 commit comments