File tree 2 files changed +67
-0
lines changed
2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -3278,6 +3278,39 @@ sub CreateNotificationEnum
3278
3278
CreateEnumHelperMethod(" sai_switch_notification_type_t" );
3279
3279
}
3280
3280
3281
+ sub CreateSwitchNotificationAttributesList
3282
+ {
3283
+ #
3284
+ # create notification attributes list for easy use on places where only
3285
+ # notifications must be processed instead of looping through all switch
3286
+ # attributes
3287
+ #
3288
+
3289
+ WriteSectionComment " SAI Switch Notification Attributes List" ;
3290
+
3291
+ WriteHeader " extern const sai_attr_metadata_t* const sai_metadata_switch_notify_attr[];" ;
3292
+ WriteSource " const sai_attr_metadata_t* const sai_metadata_switch_notify_attr[] = {" ;
3293
+
3294
+ for my $name (sort keys %NOTIFICATIONS )
3295
+ {
3296
+ next if not $name =~ / ^sai_(\w +)_notification_fn/ ;
3297
+
3298
+ WriteSource " &sai_metadata_attr_SAI_SWITCH_ATTR_" . uc ($1 ) . " _NOTIFY," ;
3299
+ }
3300
+
3301
+ WriteSource " NULL" ;
3302
+ WriteSource " };" ;
3303
+
3304
+ my $count = scalar (keys %NOTIFICATIONS );
3305
+
3306
+ WriteHeader " extern const size_t sai_metadata_switch_notify_attr_count;" ;
3307
+ WriteSource " const size_t sai_metadata_switch_notify_attr_count = $count ;" ;
3308
+
3309
+ WriteSectionComment " Define SAI_METADATA_SWITCH_NOTIFY_ATTR_COUNT" ;
3310
+
3311
+ WriteHeader " #define SAI_METADATA_SWITCH_NOTIFY_ATTR_COUNT $count " ;
3312
+ }
3313
+
3281
3314
sub WriteHeaderHeader
3282
3315
{
3283
3316
WriteSectionComment " AUTOGENERATED FILE! DO NOT EDIT" ;
@@ -3502,6 +3535,8 @@ sub MergeExtensionsEnums
3502
3535
3503
3536
CreateNotificationEnum();
3504
3537
3538
+ CreateSwitchNotificationAttributesList();
3539
+
3505
3540
CreateSerializeMethods();
3506
3541
3507
3542
WriteHeaderFotter();
Original file line number Diff line number Diff line change @@ -4368,9 +4368,39 @@ void check_acl_user_defined_field()
4368
4368
4369
4369
void check_label_size ()
4370
4370
{
4371
+ SAI_META_LOG_ENTER ();
4372
+
4371
4373
META_ASSERT_TRUE (sizeof (sai_label_id_t ) == sizeof (uint32_t ), "label is expected to be 32 bit" );
4372
4374
}
4373
4375
4376
+ void check_switch_notify_list ()
4377
+ {
4378
+ SAI_META_LOG_ENTER ();
4379
+
4380
+ size_t i ;
4381
+
4382
+ for (i = 0 ; i < sai_metadata_switch_notify_attr_count ; ++ i )
4383
+ {
4384
+ META_ASSERT_NOT_NULL (sai_metadata_switch_notify_attr [i ]);
4385
+ }
4386
+
4387
+ /* check for NULL guard */
4388
+
4389
+ META_ASSERT_NULL (sai_metadata_switch_notify_attr [i ]);
4390
+ }
4391
+
4392
+ void check_defines ()
4393
+ {
4394
+ SAI_META_LOG_ENTER ();
4395
+
4396
+ /*
4397
+ * Check if defines are equal to their static values.
4398
+ */
4399
+
4400
+ META_ASSERT_TRUE (SAI_METADATA_SWITCH_NOTIFY_ATTR_COUNT == sai_metadata_switch_notify_attr_count , "notify define must be equal" );
4401
+ META_ASSERT_TRUE (SAI_METADATA_SWITCH_NOTIFY_ATTR_COUNT > 3 , "there must be at least 3 notifications defined" );
4402
+ }
4403
+
4374
4404
int main (int argc , char * * argv )
4375
4405
{
4376
4406
debug = (argc > 1 );
@@ -4411,6 +4441,8 @@ int main(int argc, char **argv)
4411
4441
check_get_attr_metadata ();
4412
4442
check_acl_user_defined_field ();
4413
4443
check_label_size ();
4444
+ check_switch_notify_list ();
4445
+ check_defines ();
4414
4446
4415
4447
i = SAI_OBJECT_TYPE_NULL + 1 ;
4416
4448
You can’t perform that action at this time.
0 commit comments