Skip to content

Conversation

@wni0812
Copy link

@wni0812 wni0812 commented Dec 5, 2025

Add API definitions for Optical Circuit Switch, mainly including:

  1. Creation and remove of OCS cross-connects, including both individual switching and simultaneous switching with multiple connections.
  2. OCS ports operation, including the ability to set a state to any specified group of ports.
  3. Retrieval of current operational status on OCS port.
  4. Retrieval of hardware-specific OCS module data, such as port physical mapping information and factory insertion loss values etc.

Signed-off-by: Nathan Ni <nathan.ni@coherent.com>
@wni0812 wni0812 reopened this Dec 9, 2025
@tjchadaga tjchadaga added the reviewed PR is discussed in SAI Meeting label Dec 12, 2025
@jjin62
Copy link

jjin62 commented Dec 19, 2025

Need to add new SAI objects and types for OCS in SAI extension header files. Without the following change, the SAI OCS object/api will not be processed by parser to generating meta data.

saiextensions.h

/* OCS extension */
#include "saiexperimentalocs.h"

...
   SAI_API_DASH_APPLIANCE,

   SAI_API_OCS_CROSS_CONNECT,

   SAI_API_OCS_PORT,

    /* Add new experimental APIs above this line */

   SAI_API_EXTENSIONS_RANGE_END

} sai_api_extensions_t;

#endif /* __SAIEXTENSIONS_H_ */

saitypesextensions.h‎

    SAI_OBJECT_TYPE_DASH_APPLIANCE,

    SAI_OBJECT_TYPE_OCS_CROSS_CONNECT,

    SAI_OBJECT_TYPE_OCS_PORT,

    /* Add new experimental object types above this line */

    SAI_OBJECT_TYPE_EXTENSIONS_RANGE_END

} sai_object_type_extensions_t

* @objects SAI_OBJECT_TYPE_OCS_PORT
*/
SAI_OCS_CROSS_CONNECT_ATTR_B_SIDE_PORT_ID,

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add operational status so user know if a connection is up or down, without looking at the corresponding port status?

/**
     * @brief Cross connect operation status
     *
     * @type sai_ocs_cross_connect_oper_status_t
     * @flags READ_ONLY
     */
    SAI_OCS_CROSS_CONNECT_ATTR_OPER_STATUS,

/**
* @brief Default status for any port which is with no configuration
*/
SAI_OCS_PORT_STATUS_BLOCKED,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default value (SAI_OCS_PORT_STATUS_BLOCKED) conflicts to the default of override_state_t, SAI_OCS_PORT_OVERRIDE_STATE_NORMAL??

* @brief Overrides the status imposed by the programmed cross-connects
*
* @type sai_ocs_port_override_state_t
* @flags CREATE_AND_SET
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In latest SAI version, for CREATE_AND_SET attributors, it is required to have default value flag:
@default SAI_OCS_PORT_OVERRIDE_STATE_NORMAL
Otherwise parser and compile will be error-out. All CREATE_AND_SET attributes need to add @default

SAI_OCS_PORT_OVERRIDE_STATE_POWERED_OFF,

/**
* @brief Default, state to be determined by presence of cross-connect
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is port state NORMAL is determined connection present or not?

/**
* @brief Start of attributes
*/
SAI_OCS_CROSS_CONNECT_ATTR_START,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All new acronyms (non-English words), such as OCS need to be add the in the meta dictionary meta/aspell.en.pws. compile will fail without this.

* List of center frequency values. Use int32 for representation of decimal value with 3 fraction digits
*
* @type sai_s32_list_t
* @flags READ_ONLY
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To convert sai_s32_list_t -> decimal, how does the application code (ex. SWSS) know that it should have 3 decimal digits, without hard code to SAI_OCS_CROSS_CONNECT_FACTORY_DATA_ATTR_FREQUENCY_THZ? For decimal -> sai_s32_list_t, how do we validate that the decimal string is 3 precision digits in redis/NBI?

The decimal precision info should be part of the meta data, so the conversion can done generically. One way is to use sai_s32_t and add a new tag @precision n and so the application can retrieve the number of decimal digits from meta data. The proposal to introduce a new type sai_double_t is dropped due to NAN issue.

Same comments for all decimal representation below.

* @brief End of attributes
*/
SAI_OCS_CROSS_CONNECT_ATTR_END,

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add custom rang for vendor extension (see DASH SAI). same for port attributes.

/** Custom range base value */
    SAI_OCS_CROSS_CONNECT_ATTR_CUSTOM_RANGE_START = 0x10000000,

    /** End of custom range base */
    SAI_OCS_CROSS_CONNECT_ATTR_CUSTOM_RANGE_END

/**
* @brief Unique identifier for a port
*
* @type sai_u8_list_t
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for port name why not using @type char?

*
* @brief This module defines SAI OCS
*/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the following to compatible with SAI extension common practice:

 *
 * @warning This module is a SAI experimental module.
 */

/**
* @brief A side port
*
* @type sai_object_id_t
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you don't use port name (a string) in the port attributes? sai_object_id is auto-generated when SAI object is created. Do you want to enforce creating cross-connect after creating ports? This would need extra logic in SWSS? In any case, I think port name A and B are useful info.

Signed-off-by: Nathan Ni <nathan.ni@coherent.com>
Signed-off-by: Nathan Ni <nathan.ni@coherent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed PR is discussed in SAI Meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants