fboss/lib/phy/SaiPhyManager.cpp
/*
 * macsecGetPhyLinkInfo
 *
 * Get the macsec phy line side link information from SaiPortManager
 * SaiPortHandle attribute
 */
macsecGetPhyLinkInfo
Get the macsec phy line side link information from SaiPortManager
SaiPortHandle attribute
macsecGetPhyLinkInfo Get the macsec phy line side link information from SaiPortManager SaiPortHandle attribute
PortOperState SaiPhyManager::macsecGetPhyLinkInfo(PortID swPort) {
  auto globalPhyID = getGlobalXphyIDbyPortID(swPort);
  auto saiPlatform = getSaiPlatform(globalPhyID);
  auto saiSwitch = static_cast<SaiSwitch*>(saiPlatform->getHwSwitch());
  auto portHandle =
      saiSwitch->managerTable()->portManager().getPortHandle(swPort);
  if (portHandle == nullptr) {
    throw FbossError(folly::sformat(
        "PortHandle not found for port {}", static_cast<int>(swPort)));
  }
  auto portOperStatus = SaiApiTable::getInstance()->portApi().getAttribute(
      portHandle->port->adapterKey(), SaiPortTraits::Attributes::OperStatus{});
  return (portOperStatus == SAI_PORT_OPER_STATUS_UP) ? PortOperState::UP
                                                     : PortOperState::DOWN;
}
PortOperState SaiPhyManager :: macsecGetPhyLinkInfo ( PortID swPort ) { auto globalPhyID = getGlobalXphyIDbyPortID ( swPort ) ; auto saiPlatform = getSaiPlatform ( globalPhyID ) ; auto saiSwitch = static_cast < SaiSwitch * > ( saiPlatform -> getHwSwitch ( ) ) ; auto portHandle = saiSwitch -> managerTable ( ) -> portManager ( ) . getPortHandle ( swPort ) ; if ( portHandle == nullptr ) { throw FbossError ( folly :: sformat ( " " , static_cast < int > ( swPort ) ) ) ; } auto portOperStatus = SaiApiTable :: getInstance ( ) -> portApi ( ) . getAttribute ( portHandle -> port -> adapterKey ( ) , SaiPortTraits :: Attributes :: OperStatus { } ) ; return ( portOperStatus == SAI_PORT_OPER_STATUS_UP ) ? PortOperState :: UP : PortOperState :: DOWN ; }
macsecGetPhyLinkInfo
 Get the macsec phy line side link information from SaiPortManager
 SaiPortHandle attribute
macsecGetPhyLinkInfo Get the macsec phy line side link information from SaiPortManager SaiPortHandle attribute
// Get phy platform // Get port handle and then get port attribute for oper state