From e314c2ba64b6f7a8b88566e6c01fac791c8e4186 Mon Sep 17 00:00:00 2001
From: liuxu <liuxu156@huawei.com>
Date: Wed, 8 Nov 2023 16:03:50 +0800
Subject: [PATCH 05/14] doc:support version opt

---
 .../detailed/Network/cni_1.0.0_change.md      | 24 ++++++++++++++++++-
 .../detailed/Network/cni_operator_design.md   |  8 +++++++
 .../Network/cni_operator_design_zh.md         |  8 +++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/docs/design/detailed/Network/cni_1.0.0_change.md b/docs/design/detailed/Network/cni_1.0.0_change.md
index 35dde2f7..a91225fb 100644
--- a/docs/design/detailed/Network/cni_1.0.0_change.md
+++ b/docs/design/detailed/Network/cni_1.0.0_change.md
@@ -33,7 +33,29 @@ cni_net_conf_runtime_config;
 ## 2. Execution Protocol
 ### VERSION
 
-VERSION操作用于检查插件支持的CNI规范的版本，在spec-v1.0.0中，它增加了输入参数cniVersion，iSulad未使用VERSION功能，因此不涉及。
+VERSION操作用于检查插件支持的CNI规范的版本，在spec-v1.0.0中，它增加了输入参数cniVersion。
+
+整体时序：
+```mermaid
+sequenceDiagram
+	participant conf_bridge
+	participant cni_get_plugins_supported_version
+	participant cni_version_network_list
+	participant version_network
+	participant get_version_info
+    conf_bridge ->> cni_get_plugins_supported_version:post cni_net_conf_list
+    cni_get_plugins_supported_version ->> cni_version_network_list:post cni_net_conf_list
+    loop for each plugin
+        cni_version_network_list ->> version_network:post each cni_net_conf
+        version_network ->> get_version_info:post each cni_net_conf plugin path e.g.
+        get_version_info -->> version_network:get version_result
+        version_network -->> cni_version_network_list:get version_result
+    end
+    cni_version_network_list ->> cni_version_network_list:comb cni_version_info_list
+    cni_version_network_list -->> cni_get_plugins_supported_version:get cni_version_info_list
+    cni_get_plugins_supported_version ->> cni_get_plugins_supported_version:find the latest CNI version supported by all plugins
+    cni_get_plugins_supported_version -->> conf_bridge:get version
+```
 
 ## 3. Execution of Network Configurations
 
diff --git a/docs/design/detailed/Network/cni_operator_design.md b/docs/design/detailed/Network/cni_operator_design.md
index e77f4f94..64aaf2ed 100644
--- a/docs/design/detailed/Network/cni_operator_design.md
+++ b/docs/design/detailed/Network/cni_operator_design.md
@@ -73,6 +73,14 @@ int detach_network_plane(const struct cni_manager *manager, const struct cni_net
 * Return value: return 0 on success, non-zero on failure
 */
 int check_network_plane(const struct cni_manager *manager, const struct cni_network_list_conf *list, struct cni_opt_result **result);
+
+/*
+* Description: get the CNI version information supported by the plugins required for the single network plane of the container;
+* list: network configuration;
+* result_version_list: record the CNI version supported by the plugins;
+* Return value: return 0 on success, non-zero on failure
+*/
+int version_network_plane(const struct cni_network_list_conf *list, struct cni_result_version_list **result_version_list);
 ````
 
 # 4. Detailed Design
diff --git a/docs/design/detailed/Network/cni_operator_design_zh.md b/docs/design/detailed/Network/cni_operator_design_zh.md
index ac88806e..6aa3c51a 100644
--- a/docs/design/detailed/Network/cni_operator_design_zh.md
+++ b/docs/design/detailed/Network/cni_operator_design_zh.md
@@ -73,6 +73,14 @@ int detach_network_plane(const struct cni_manager *manager, const struct cni_net
 * 返回值：成功返回0，失败返回非0
 */
 int check_network_plane(const struct cni_manager *manager, const struct cni_network_list_conf *list, struct cni_opt_result **result);
+
+/*
+* 说明：获取容器单网络平面所需的插件支持的CNI版本信息；
+* list: 网络配置；
+* result_version_list：记录插件支持的CNI版本信息；
+* 返回值：成功返回0，失败返回非0
+*/
+int version_network_plane(const struct cni_network_list_conf *list, struct cni_result_version_list **result_version_list);
 ```
 
 # 4.详细设计
-- 
2.42.0

