|
24 | 24 | DATA_DIR, |
25 | 25 | check_manager_ip_is_free, |
26 | 26 | configure_manager_basic_settings, |
| 27 | + get_cml_sdwan_image_definition, |
27 | 28 | get_sdwan_lab_parameters, |
28 | 29 | load_certificate_details, |
29 | 30 | onboard_control_components, |
@@ -118,20 +119,38 @@ def main( |
118 | 119 | ) |
119 | 120 |
|
120 | 121 | # Verify if requested software version is defined in CML |
| 122 | + if contr_version: |
| 123 | + manager_image = get_cml_sdwan_image_definition( |
| 124 | + cml, "cat-sdwan-manager", contr_version |
| 125 | + ) |
| 126 | + controller_image = get_cml_sdwan_image_definition( |
| 127 | + cml, "cat-sdwan-controller", contr_version |
| 128 | + ) |
| 129 | + validator_image = get_cml_sdwan_image_definition( |
| 130 | + cml, "cat-sdwan-validator", contr_version |
| 131 | + ) |
121 | 132 | cml_image_definitions = cml.definitions.image_definitions() |
122 | 133 | defined_images = set(image["id"] for image in cml_image_definitions) |
123 | 134 | missing_images = [] |
124 | 135 | for node in cml_topology_dict["nodes"]: |
125 | | - if ( |
126 | | - node["node_definition"] |
127 | | - in ["cat-sdwan-controller", "cat-sdwan-manager", "cat-sdwan-validator"] |
128 | | - and contr_version |
129 | | - ): |
| 136 | + if node["node_definition"] in ["cat-sdwan-manager"] and contr_version: |
| 137 | + if ( |
| 138 | + f"{manager_image}" not in defined_images |
| 139 | + and f"{manager_image}" not in missing_images |
| 140 | + ): |
| 141 | + missing_images.append(f"{manager_image}") |
| 142 | + elif node["node_definition"] in ["cat-sdwan-controller"] and contr_version: |
| 143 | + if ( |
| 144 | + f"{controller_image}" not in defined_images |
| 145 | + and f"{controller_image}" not in missing_images |
| 146 | + ): |
| 147 | + missing_images.append(f"{controller_image}") |
| 148 | + elif node["node_definition"] in ["cat-sdwan-validator"] and contr_version: |
130 | 149 | if ( |
131 | | - f'{node["node_definition"]}-{contr_version}' not in defined_images |
132 | | - and f'{node["node_definition"]}-{contr_version}' not in missing_images |
| 150 | + f"{validator_image}" not in defined_images |
| 151 | + and f"{validator_image}" not in missing_images |
133 | 152 | ): |
134 | | - missing_images.append(f'{node["node_definition"]}-{contr_version}') |
| 153 | + missing_images.append(f"{validator_image}") |
135 | 154 | elif node["node_definition"] == "cat-sdwan-edge" and edge_version: |
136 | 155 | if ( |
137 | 156 | f'{node["node_definition"]}-{edge_version}' not in defined_images |
@@ -246,14 +265,12 @@ def main( |
246 | 265 | if contr_version: |
247 | 266 | # Overwrite the image definition for control components |
248 | 267 | for node in cml_topology_dict["nodes"]: |
249 | | - if node["node_definition"] in [ |
250 | | - "cat-sdwan-controller", |
251 | | - "cat-sdwan-manager", |
252 | | - "cat-sdwan-validator", |
253 | | - ]: |
254 | | - node["image_definition"] = ( |
255 | | - f'{node["node_definition"]}-{contr_version}' |
256 | | - ) |
| 268 | + if node["node_definition"] in ["cat-sdwan-manager"]: |
| 269 | + node["image_definition"] = f"{manager_image}" |
| 270 | + if node["node_definition"] in ["cat-sdwan-controller"]: |
| 271 | + node["image_definition"] = f"{controller_image}" |
| 272 | + if node["node_definition"] in ["cat-sdwan-validator"]: |
| 273 | + node["image_definition"] = f"{validator_image}" |
257 | 274 | if edge_version: |
258 | 275 | # Overwrite the image definition for control components |
259 | 276 | for node in cml_topology_dict["nodes"]: |
|
0 commit comments