@@ -230,6 +230,22 @@ typedef enum _sai_next_hop_group_type_t
230230
231231} sai_next_hop_group_type_t;
232232
233+ +/**
234+ + * @brief Next hop group admin role to manually control switching between primary and backup, overriding hardware switchover
235+ + */
236+ +typedef enum _sai_next_hop_group_admin_role_t
237+ +{
238+ + /** Auto mode - hardware controlled switching (default) */
239+ + SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO,
240+ +
241+ + /** Force primary role - manual override to primary */
242+ + SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY,
243+ +
244+ + /** Force backup role - manual override to standby */
245+ + SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY,
246+ +
247+ +} sai_next_hop_group_admin_role_t;
248+
233249/**
234250 * @brief Attribute id for next hop
235251 */
@@ -273,6 +289,20 @@ typedef enum _sai_next_hop_group_attr_t
273289+ * @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_PROTECTION
274290+ */
275291+ SAI_NEXT_HOP_GROUP_ATTR_SET_SWITCHOVER,
292+ +
293+ + /**
294+ + * @brief Admin role to manually control switching between primary and backup
295+ + *
296+ + * This attribute allows manual switching between primary and standby roles,
297+ + * overriding hardware-controlled switching when not set to auto mode.
298+ + * Enables planned operations without any traffic loss.
299+ + *
300+ + * @type sai_next_hop_group_admin_role_t
301+ + * @flags CREATE_AND_SET
302+ + * @default SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO
303+ + * @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_HW_PROTECTION
304+ + */
305+ + SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE,
276306
277307 /**
278308 * @brief End of attributes
@@ -560,6 +590,64 @@ for (attr_id = 0; attr_id < attr_count; attr_id++) {
560590
561591```
562592
593+ ## Manual Admin Role Control
594+
595+ ### Force primary role
596+ ```
597+ // Force the next hop group to use primary path regardless of hardware state
598+ nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
599+ nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY;
600+ saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
601+ if (saistatus != SAI_STATUS_SUCCESS) {
602+ return saistatus;
603+ }
604+
605+ ```
606+
607+ ### Force standby role
608+ ```
609+ // Force the next hop group to use backup path regardless of hardware state
610+ nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
611+ nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY;
612+ saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
613+ if (saistatus != SAI_STATUS_SUCCESS) {
614+ return saistatus;
615+ }
616+
617+ ```
618+
619+ ### Reset to auto mode
620+ ```
621+ // Return control back to hardware-based switching
622+ nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
623+ nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO;
624+ saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
625+ if (saistatus != SAI_STATUS_SUCCESS) {
626+ return saistatus;
627+ }
628+
629+ ```
630+
631+ ### Query current admin role
632+ ```
633+ // Get the current admin role setting
634+ nhg_entry_attrs[0].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
635+ saistatus = sai_get_next_hop_group_attribute_fn(nhg_id, 1, nhg_entry_attrs);
636+ if (saistatus != SAI_STATUS_SUCCESS) {
637+ return saistatus;
638+ }
639+
640+ // Check the current admin role
641+ if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO) {
642+ // Hardware-controlled switching is active
643+ } else if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY) {
644+ // Forced to use primary path
645+ } else if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY) {
646+ // Forced to use backup path
647+ }
648+
649+ ```
650+
563651# Pipeline
564652
565653TBD
0 commit comments