LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/topo/new_topo_builder/rank_table_info - control_plane.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 3 3
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef CONTROL_PLANE_H
      12              : #define CONTROL_PLANE_H
      13              : 
      14              : #include <string>
      15              : #include "nlohmann/json.hpp"
      16              : #include "ip_address.h"
      17              : #include "nlohmann/json.hpp"
      18              : #include "topo_common_types.h"
      19              : 
      20              : 
      21              : namespace Hccl {
      22              : constexpr unsigned int MIN_VALUE_LISTENPORT = 1;
      23              : constexpr unsigned int MAX_VALUE_LISTENPORT = 65536;
      24              : constexpr unsigned int MIN_VALUE_ADDR = 1;
      25              : constexpr unsigned int MAX_VALUE_ADDR = 256;
      26              : class ControlPlane{
      27              : public:
      28          159 :     ControlPlane(){};
      29              :     AddrType                   addrType;
      30              :     IpAddress                  addr;
      31              :     u32                        listenPort{0};
      32              :     void                       Deserialize(const nlohmann::json &controlPlaneJson);
      33              :     void                       GetBinStream(BinaryStream& binaryStream) const;
      34              :     explicit                   ControlPlane(BinaryStream &binStream);
      35              :     std::string                Describe() const;
      36              : 
      37              :     private:
      38              :     static const std::unordered_map<std::string , AddrType> strToAddrType;
      39              :     void EidToAddr(std::string str);
      40              :     void IPV4ToAddr(std::string str);
      41              :     void IPV6ToAddr(std::string str);
      42              :     
      43            6 :     static bool IsStringInAddrType(std::string str)
      44              :     {
      45            6 :         return strToAddrType.count(str) > 0;
      46              :     }
      47              : };
      48              : 
      49              : } // namespace Hccl
      50              : 
      51              : #endif // CONTROL_PLANE_H
        

Generated by: LCOV version 2.0-1