|
45 | 45 |
|
46 | 46 | EXTERNAL_PERF_SERVER = "external-perf-server" |
47 | 47 |
|
48 | | -_SECONDARY_MODES = ( |
49 | | - ConnectionMode.MULTI_HOME, |
50 | | - ConnectionMode.MNP_2ND_DENY, |
51 | | - ConnectionMode.MNP_2ND_ALLOW, |
52 | | -) |
53 | | - |
54 | 48 |
|
55 | 49 | NP_ACTION_ALLOW = "Allow" |
56 | 50 | NP_ACTION_DENY = "Deny" |
@@ -302,6 +296,7 @@ def __init__( |
302 | 296 | self.task_role = task_role |
303 | 297 | self.in_file_template = "" |
304 | 298 | self.pod_name = "" |
| 299 | + self.pod_type: Optional[PodType] = None |
305 | 300 | self._setup_operation: Optional[TaskOperation] = None |
306 | 301 | self._task_operation: Optional[TaskOperation] = None |
307 | 302 | self._result: Optional[BaseOutput] = None |
@@ -485,14 +480,19 @@ def _svc_backend_label(self) -> str: |
485 | 480 |
|
486 | 481 | @property |
487 | 482 | def _network_type(self) -> str: |
488 | | - if ( |
489 | | - self.ts.connection_mode in _SECONDARY_MODES |
490 | | - or self.ts.test_case_id.is_udn_secondary |
491 | | - or self.ts.test_case_id.is_udn_localnet |
492 | | - ): |
| 483 | + assert self.pod_type is not None |
| 484 | + if self.pod_type == PodType.SECONDARY: |
493 | 485 | return "secondary" |
494 | 486 | return "primary" |
495 | 487 |
|
| 488 | + @property |
| 489 | + def uses_secondary_ip(self) -> bool: |
| 490 | + # MNP_PRIMARY_DENY is a SECONDARY pod, but its traffic still flows on the primary IP |
| 491 | + return ( |
| 492 | + self._network_type == "secondary" |
| 493 | + and self.ts.connection_mode != ConnectionMode.MNP_PRIMARY_DENY |
| 494 | + ) |
| 495 | + |
496 | 496 | def render_pod_file(self, log_info: str) -> None: |
497 | 497 | self.render_file( |
498 | 498 | log_info, |
@@ -1115,9 +1115,10 @@ def __init__(self, ts: TestSettings): |
1115 | 1115 | elif connection_mode == ConnectionMode.EXTERNAL_IP: |
1116 | 1116 | in_file_template = "" |
1117 | 1117 | pod_name = EXTERNAL_PERF_SERVER |
1118 | | - elif ( |
1119 | | - self._network_type == "secondary" |
1120 | | - or connection_mode == ConnectionMode.MNP_PRIMARY_DENY |
| 1118 | + elif pod_type == PodType.SECONDARY or ( |
| 1119 | + pod_type == PodType.NORMAL |
| 1120 | + and ts.cfg_descr.get_tft().pre_provision |
| 1121 | + and ts.cfg_descr.get_tft().uses_secondary_network_pod |
1121 | 1122 | ): |
1122 | 1123 | in_file_template = "pod-secondary-network.yaml.j2" |
1123 | 1124 | pod_name = f"normal-pod-secondary-server-{port}" |
@@ -1420,11 +1421,11 @@ def __init__(self, ts: TestSettings, server: ServerTask): |
1420 | 1421 | pod_type = ts.client_pod_type |
1421 | 1422 | node_location = self.node_location |
1422 | 1423 | port = server.port |
1423 | | - connection_mode = ts.connection_mode |
1424 | 1424 |
|
1425 | | - if ( |
1426 | | - self._network_type == "secondary" |
1427 | | - or connection_mode == ConnectionMode.MNP_PRIMARY_DENY |
| 1425 | + if pod_type == PodType.SECONDARY or ( |
| 1426 | + pod_type == PodType.NORMAL |
| 1427 | + and ts.cfg_descr.get_tft().pre_provision |
| 1428 | + and ts.cfg_descr.get_tft().uses_secondary_network_pod |
1428 | 1429 | ): |
1429 | 1430 | in_file_template = "pod-secondary-network.yaml.j2" |
1430 | 1431 | pod_name = f"normal-pod-secondary-{node_location}-client" |
|
0 commit comments