File tree 3 files changed +28
-2
lines changed
3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1786,8 +1786,11 @@ sai_status_t Meta::objectTypeGetAvailability(
1786
1786
PARAMETER_CHECK_OID_OBJECT_TYPE (switchId, SAI_OBJECT_TYPE_SWITCH);
1787
1787
PARAMETER_CHECK_OID_EXISTS (switchId, SAI_OBJECT_TYPE_SWITCH);
1788
1788
PARAMETER_CHECK_OBJECT_TYPE_VALID (objectType);
1789
- PARAMETER_CHECK_POSITIVE (attrCount);
1790
- PARAMETER_CHECK_IF_NOT_NULL (attrList);
1789
+ // When checking availability of a resource solely based on OBJECT_TYPE, attrCount is 0
1790
+ if (attrCount)
1791
+ {
1792
+ PARAMETER_CHECK_IF_NOT_NULL (attrList);
1793
+ }
1791
1794
PARAMETER_CHECK_IF_NOT_NULL (count);
1792
1795
1793
1796
auto info = sai_metadata_get_object_type_info (objectType);
Original file line number Diff line number Diff line change 48
48
cpp
49
49
cpu
50
50
CreateObject
51
+ CRM
51
52
currentObj
52
53
currentObject
53
54
currentView
Original file line number Diff line number Diff line change 3
3
#include " ../../lib/inc/PerformanceIntervalTimer.h"
4
4
5
5
#include " swss/logger.h"
6
+ #include " swss/exec.h"
7
+ #include " swss/converter.h"
6
8
7
9
#include " meta/sai_serialize.h"
8
10
#include " meta/SaiAttributeList.h"
@@ -817,6 +819,26 @@ sai_status_t VirtualSwitchSaiInterface::objectTypeGetAvailability(
817
819
*count = 3 ;
818
820
return SAI_STATUS_SUCCESS;
819
821
}
822
+ // MPLS Inseg and MPLS NH CRM use sai_object_type_get_availability() API.
823
+ else if ((objectType == SAI_OBJECT_TYPE_INSEG_ENTRY) ||
824
+ ((objectType == SAI_OBJECT_TYPE_NEXT_HOP) &&
825
+ (attrCount == 1 ) && attrList &&
826
+ (attrList[0 ].id == SAI_NEXT_HOP_ATTR_TYPE) &&
827
+ (attrList[0 ].value .s32 == SAI_NEXT_HOP_TYPE_MPLS)))
828
+ {
829
+ std::string cmd_str (" sysctl net.mpls.platform_labels" );
830
+ std::string ret_str;
831
+ *count = 1000 ;
832
+ if (!swss::exec (cmd_str, ret_str))
833
+ {
834
+ std::string match (" net.mpls.platform_labels = " );
835
+ if (ret_str.find (match) != std::string::npos)
836
+ {
837
+ *count = std::stoul (ret_str.substr (match.length ()).c_str ());
838
+ }
839
+ }
840
+ return SAI_STATUS_SUCCESS;
841
+ }
820
842
821
843
return SAI_STATUS_NOT_SUPPORTED;
822
844
}
You can’t perform that action at this time.
0 commit comments