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 NEW_RANK_INFO_H
12 : #define NEW_RANK_INFO_H
13 :
14 : #include <vector>
15 : #include <string>
16 :
17 : #include "types.h"
18 : #include "nlohmann/json.hpp"
19 : #include "rank_level_info.h"
20 : #include "control_plane.h"
21 : #include "orion_adapter_hccp.h"
22 : namespace Hccl {
23 : constexpr unsigned int MAX_VALUE_DEVICEID = 64;
24 : constexpr unsigned int DEFAULT_VALUE_TCPPORT = 16666;
25 : constexpr unsigned int MAX_VALUE_TCPPORT = 65535;
26 : constexpr unsigned int MIN_VALUE_TCPPORT = 1;
27 : constexpr unsigned int MAX_LEVEL_lIST = 8;
28 : const IpAddress DEVICE_PORT_KEY_IPADDRESS = IpAddress(); // 用于socketmanager的端口占用,vnic情况下使用
29 : class NewRankInfo {
30 : public:
31 115 : NewRankInfo() {};
32 345 : ~NewRankInfo() {};
33 :
34 : u32 rankId{0};
35 : u32 deviceId{0};
36 : u32 localId{0};
37 : u32 replacedLocalId{0};
38 : u32 devicePort{DEFAULT_VALUE_TCPPORT};
39 : u32 hostPort{DEFAULT_VALUE_TCPPORT};
40 : std::vector<RankLevelInfo> rankLevelInfos{};
41 : ControlPlane controlPlane{};
42 : TlsStatus tlsStatus{TlsStatus::UNKNOWN};
43 : std::string Describe() const;
44 : void Deserialize(const nlohmann::json& newRankInfoJson);
45 : explicit NewRankInfo(BinaryStream& binStream);
46 : void GetBinStream(bool isContainLoaId, BinaryStream& binStream) const;
47 : };
48 :
49 : } // namespace Hccl
50 :
51 : #endif // NEW_RANK_INFO_H
|