Skip to content

Commit d819f97

Browse files
authored
[meta] Add support for ignored attributes names (#836)
During SAI development, some existing attributes could be deprecated and marked ignored in headers, but old value name still can be used in redis database in current running systems. When doing sonic upgrade, old value needs to be correctly interpreted and translated to new name. This PR addresses this issue.
1 parent c163238 commit d819f97

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

meta/saiserialize.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -3305,6 +3305,12 @@ void sai_deserialize_attr_id(
33053305

33063306
auto m = sai_metadata_get_attr_metadata_by_attr_id_name(s.c_str());
33073307

3308+
if (m == NULL)
3309+
{
3310+
// check ignored attributes names for backward compatibility
3311+
m = sai_metadata_get_ignored_attr_metadata_by_attr_id_name(s.c_str());
3312+
}
3313+
33083314
if (m == NULL)
33093315
{
33103316
SWSS_LOG_THROW("invalid attr id: %s", s.c_str());

tests/BCM56850.pl

+8
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,16 @@ sub test_sairedis_client
681681
}
682682
}
683683

684+
sub test_ignore_attributes
685+
{
686+
fresh_start;
687+
688+
play "ignore_attributes.rec";
689+
}
690+
684691
# RUN TESTS
685692

693+
test_ignore_attributes;
686694
test_sairedis_client;
687695
test_macsec_p2p_establishment;
688696
test_no_lag_label;

tests/BCM56850/ignore_attributes.rec

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2017-06-14.01:55:46.543987|a|INIT_VIEW
2+
2017-06-14.01:55:46.551164|A|SAI_STATUS_SUCCESS
3+
2017-06-14.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true
4+
2017-06-14.01:56:05.520538|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_NUMBER=0
5+
2017-06-14.01:56:05.525938|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_NUMBER=32
6+
2017-06-14.01:56:06.151337|a|APPLY_VIEW
7+
2017-06-14.01:56:06.156740|A|SAI_STATUS_SUCCESS

0 commit comments

Comments
 (0)