Comments (5)
i think SAI was designed to be generic interface and not vendor specific, currently there is no specific interface to query underlying vendoer, and we should not specifically design any macros for that
from sai.
what is your motivation to have workaroudns for specific vendor ? if some apis are not implemented you will get not implemented or not supported error code and this should be your information
from sai.
Happy to hear! I agree that not relying on the vendor is a good stance to take and try to hold on to.
In my case it is only for debugging, so having something like sai_query_api_vendor_version
that outputs an opaque string would suffice - like bsv
(e.g. BRCM SAI ver: [8.4.0.2], OCP SAI ver: [1.11.0], SDK ver: [sdk-6.5.27] CANCUN ver: [06.04.01]
).
Right now I have to resort to vendor-specific ways to get that information for my test logs, which ironically requires me to care about what module I load so I can query its non-SAI API to get the data.
That said, I based some debugging code on saithrift
from this very repo and it used ifdef
macros per vendor.
E.g.:
SAI/test/saithrift/src/saiserver.cpp
Lines 457 to 460 in e2a3d44
In my case I just removed that particular ifdef
and always spawned a debug shell, but if it is indeed the case that SAI tries to be vendor agnostic maybe we should remove those from the code people otherwise use as references.
from sai.
SAI headers are generic, and there will be no vendor specific macro here, that will let you decide which SAI vendor is internally, and at SAI headers this is even impossible, since there are no vendor specific headers here. investigate SAI_SWITCH_ATTR_SWITCH_SHELL_ENABLE attribute.
We could discuss to introduce vendor string api or something like this that will return something like that, or have an enum in which will return actual vendor as unique integer, but this is broader discussion at SAI community meeting @rlhui
from sai.
For reference, this is how I currently get the data I want in my logs if anyone wants something similar:
typedef struct {
const char* sai_api_version;
const char* bcm_sai_version;
const char* build_release;
/* these are only populated after create_switch */
const char* cancun_version;
const char* npl_version;
} brcm_sai_version_t;
extern "C" {
extern brcm_sai_version_t* brcm_sai_version_get(brcm_sai_version_t*) __attribute__((weak));
extern void ifcs_get_version(int* major, int* minor, int* rev) __attribute__((weak));
}
/* ... */
{
sai_api_version_t version;
if (sai_query_api_version(&version) == SAI_STATUS_SUCCESS) {
int major = version / 10000;
int minor = (version - major * 10000) / 100;
int rev = version - major * 10000 - minor * 100;
printf("================================\n");
printf(" Loaded SAI version %d.%d.%d\n", major, minor, rev);
}
if (brcm_sai_version_get != NULL) {
brcm_sai_version_t brcm_version;
brcm_sai_version_get(&brcm_version);
printf(
"\n Broadcom SAI detected\n SAI API version: %s\n BRCM SAI version: %s\n Build release: %s\n",
brcm_version.sai_api_version,
brcm_version.bcm_sai_version,
brcm_version.build_release);
}
if (ifcs_get_version != NULL) {
int major = 0;
int minor = 0;
int rev = 0;
ifcs_get_version(&major, &minor, &rev);
printf(
"\n Innovium SAI detected\n IFCS version: %d.%d.%d\n",
major, minor, rev);
}
printf("================================\n");
}
Output:
================================
Loaded SAI version 1.11.0
Innovium SAI detected
IFCS version: 0.15.4
================================
================================
Loaded SAI version 1.11.0
Broadcom SAI detected
SAI API version: 8.4.0.2
BRCM SAI version: 1.11.0
Build release: sdk-6.5.27
================================
from sai.
Related Issues (20)
- SAI_API_MPLS not supported for Mellanox/Nvidia Spectrum chips
- Possible SAI API struct *_api_t mismatch
- Question: Google Proto Buff for SAI-RPC available? HOT 10
- Correct version in saithrift package HOT 3
- Too many saithrift servers in SAI repo HOT 18
- buffer overflow vulnerability in sai_serialize_attribute function HOT 3
- Unused code? HOT 3
- Some generated metadata items are not binary backward compatible HOT 1
- Query: Shared threshold mode for the buffer profile HOT 5
- wrong size of sai_acl_capability_t HOT 3
- outside the range of type ‘sai_object_type_t’ HOT 8
- WEIGHT is valid for SAI_SCHEDULING_TYPE_WRR as well
- How to generate test report for SAI PTF test case
- test
- Clarification on Conflicting Actions Resolution in ACL Table HOT 5
- [information request] do we have a way to set the type of hash algo?
- saithrift build issue for bookworm HOT 1
- GCC 12 error in saimetadatatest.c HOT 1
- checkenumlock.sh fails with SAI v1.11 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sai.