LCOV - code coverage report
Current view: top level - coll_communicator_mgr/rank_graph/rank_table_info - control_plane.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 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              : namespace Hccl {
      21              : constexpr unsigned int MIN_VALUE_LISTENPORT = 1;
      22              : constexpr unsigned int MAX_VALUE_LISTENPORT = 65536;
      23              : constexpr unsigned int MIN_VALUE_ADDR = 1;
      24              : constexpr unsigned int MAX_VALUE_ADDR = 256;
      25              : class ControlPlane {
      26              : public:
      27          134 :     ControlPlane() {};
      28              :     AddrType addrType;
      29              :     IpAddress addr;
      30              :     u32 listenPort{0};
      31              :     void Deserialize(const nlohmann::json& controlPlaneJson);
      32              :     void GetBinStream(BinaryStream& binaryStream) const;
      33              :     explicit ControlPlane(BinaryStream& binStream);
      34              :     std::string Describe() const;
      35              : 
      36              : private:
      37              :     static const std::unordered_map<std::string, AddrType> strToAddrType;
      38              :     void EidToAddr(std::string str);
      39              :     void IPV4ToAddr(std::string str);
      40              :     void IPV6ToAddr(std::string str);
      41              : 
      42            6 :     static bool IsStringInAddrType(std::string str) { return strToAddrType.count(str) > 0; }
      43              : };
      44              : 
      45              : } // namespace Hccl
      46              : 
      47              : #endif // CONTROL_PLANE_H
        

Generated by: LCOV version 2.0-1