-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from open-traffic-generator/dev-resource-limit
Minimum resource request for all components
- Loading branch information
Showing
6 changed files
with
268 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
operator-tests/py/default/test_min_resource_custom_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import pytest | ||
import utils | ||
import time | ||
|
||
|
||
def test_min_resource_custom_config(): | ||
""" | ||
Deploy b2b kne topology with default version, | ||
- namespace - 1: ixia-c | ||
Delete b2b kne topology, | ||
- namespace - 1: ixia-c | ||
Validate, | ||
- default minimum resource for all components | ||
""" | ||
namespace1 = 'ixia-c' | ||
namespace1_config = 'ixia_c_default_config.txt' | ||
expected_pods = [ | ||
'otg-controller', | ||
'otg-port-eth1', | ||
'otg-port-eth2' | ||
] | ||
container_extensions = [ | ||
'-protocol-engine', | ||
'-traffic-engine' | ||
] | ||
try: | ||
custom_resource_params = {'protocol-engine':{'cpu': '300m','memory': '50Mi'}, 'traffic-engine':{'cpu': '50m', 'memory': '170Mi'}, 'controller':{'cpu': '50m', 'memory': '190Mi'}, 'gnmi-server':{'cpu': '70m', 'memory': '90Mi'}} | ||
op_rscount = utils.get_operator_restart_count() | ||
print("[Namespace:{}]Deploying KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.load_min_resource_configmap(custom_resource_params) | ||
utils.create_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, expected_pods) | ||
utils.check_min_resource_data('ixia-c', expected_pods[0], namespace1, '190Mi', '50m') | ||
utils.check_min_resource_data('gnmi', expected_pods[0], namespace1, '90Mi', '70m') | ||
utils.check_min_resource_data(expected_pods[1]+container_extensions[0], expected_pods[1], namespace1, '50Mi', '300m') | ||
utils.check_min_resource_data(expected_pods[1]+container_extensions[1], expected_pods[1], namespace1, '170Mi', '50m') | ||
utils.check_min_resource_data(expected_pods[2]+container_extensions[0], expected_pods[2], namespace1, '50Mi', '300m') | ||
utils.check_min_resource_data(expected_pods[2]+container_extensions[1], expected_pods[2], namespace1, '170Mi', '50m') | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
print("[Namespace:{}]Deleting KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
finally: | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
utils.reset_configmap() | ||
|
||
utils.wait_for( | ||
lambda: utils.topology_deleted(namespace1), | ||
'topology deleted', | ||
timeout_seconds=30 | ||
) | ||
time.sleep(5) |
57 changes: 57 additions & 0 deletions
57
operator-tests/py/default/test_min_resource_default_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import pytest | ||
import utils | ||
import time | ||
|
||
|
||
def test_min_resource_default_config(): | ||
""" | ||
Deploy b2b kne topology with default version, | ||
- namespace - 1: ixia-c | ||
Delete b2b kne topology, | ||
- namespace - 1: ixia-c | ||
Validate, | ||
- default minimum resource for all components | ||
""" | ||
namespace1 = 'ixia-c' | ||
namespace1_config = 'ixia_c_default_config.txt' | ||
expected_pods = [ | ||
'otg-controller', | ||
'otg-port-eth1', | ||
'otg-port-eth2' | ||
] | ||
container_extensions = [ | ||
'-protocol-engine', | ||
'-traffic-engine' | ||
] | ||
try: | ||
op_rscount = utils.get_operator_restart_count() | ||
print("[Namespace:{}]Deploying KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.create_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, expected_pods) | ||
utils.check_min_resource_data('ixia-c', expected_pods[0], namespace1, '30Mi', '10m') | ||
utils.check_min_resource_data('gnmi', expected_pods[0], namespace1, '20Mi', '10m') | ||
utils.check_min_resource_data(expected_pods[1]+container_extensions[0], expected_pods[1], namespace1, '350Mi', '200m') | ||
utils.check_min_resource_data(expected_pods[1]+container_extensions[1], expected_pods[1], namespace1, '59Mi', '200m') | ||
utils.check_min_resource_data(expected_pods[2]+container_extensions[0], expected_pods[2], namespace1, '350Mi', '200m') | ||
utils.check_min_resource_data(expected_pods[2]+container_extensions[1], expected_pods[2], namespace1, '59Mi', '200m') | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
print("[Namespace:{}]Deleting KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
finally: | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
|
||
utils.wait_for( | ||
lambda: utils.topology_deleted(namespace1), | ||
'topology deleted', | ||
timeout_seconds=30 | ||
) | ||
time.sleep(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import pytest | ||
import utils | ||
import time | ||
|
||
|
||
def test_lag_min_resource(): | ||
""" | ||
Deploy lag kne topology, | ||
- namespace - 1: ixia-c | ||
Delete lag kne topology, | ||
- namespace - 1: ixia-c | ||
Validate, | ||
- default minimum resource for all components | ||
""" | ||
namespace1 = 'ixia-c' | ||
namespace1_config = 'lag_ixia_c_namespace.txt' | ||
expected_pods = [ | ||
'otg-controller', | ||
'arista1', | ||
'otg-port-eth1', | ||
'otg-port-eth2', | ||
'otg-port-group-lag' | ||
] | ||
container_extensions = [ | ||
'-protocol-engine', | ||
'-traffic-engine' | ||
] | ||
try: | ||
op_rscount = utils.get_operator_restart_count() | ||
print("[Namespace:{}]Deploying KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.create_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, expected_pods) | ||
utils.check_min_resource_data('ixia-c', expected_pods[0], namespace1, '30Mi', '10m') | ||
utils.check_min_resource_data('gnmi', expected_pods[0], namespace1, '20Mi', '10m') | ||
utils.check_min_resource_data(expected_pods[4]+container_extensions[0], expected_pods[4], namespace1, '410Mi', '200m') | ||
utils.check_min_resource_data(expected_pods[4]+container_extensions[1], expected_pods[4], namespace1, '70Mi', '200m') | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
print("[Namespace:{}]Deleting KNE topology".format( | ||
namespace1 | ||
)) | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
op_rscount = utils.ixia_c_operator_ok(op_rscount) | ||
|
||
finally: | ||
utils.delete_kne_config(namespace1_config, namespace1) | ||
utils.ixia_c_pods_ok(namespace1, []) | ||
|
||
utils.wait_for( | ||
lambda: utils.topology_deleted(namespace1), | ||
'topology deleted', | ||
timeout_seconds=30 | ||
) | ||
time.sleep(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
0.3.4 | ||
|
||
0.3.5 |