Added the possibility to set the custom MTU for the VMs
If "default" is set, the MTU will be set automatically
from the newly created SPT internal networks. The default
value in the networks comes from the Neutron configuration.
In case users want to test the bandwidth with some
specific custom MTU, they can set the value in integer or
string formates like 8950.
This possibility saves the time for QAs in case they want
to test the bandwidth with some specific MTU at VMs. This
also helps when the default Neutron MTU seems to be not
correct and QA needs to verify the bandwidth with some new
value.
Change-Id: I0f93b33c4f530b95a5dc214c02cfb3a9ddbd182b
diff --git a/README.md b/README.md
index 45b2213..36e7dc0 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,7 @@
| skipped_nodes | "" | Skip some compute hosts, so they are not selected at CMP_HOSTS pair. To set some nodes to skip, set _skipped_nodes: ["cmp003"]_ in _global_config.yaml_ file, or export skipped_nodes="cmp003".|
| nova_timeout | 300 | Timeout to VM to be ACTIVE, seconds. |
| external_network | public | External network name to allocate the Floating IPs |
+| custom_mtu | default | The MTU to set at the VMs. If "default" is set, the MTU will be set automatically from the newly created SPT internal networks. The default value in the networks comes from the Neutron configuration. In case you want to test the bandwidth with some specific custom MTU, set the value like 8950. |
| ssh_timeout | 500 | Timeout to VM to be reachable via SSH, seconds. |
| iperf_prep_string | "sudo /bin/bash -c 'echo \"91.189.88.161 archive.ubuntu.com\" >> /etc/hosts'" | Preparation string to set ubuntu repository host in /etc/hosts of VMs |
| internet_at_vms | 'true' | In case True, the Internet is present at VMs, and the tests are able to install iperf3 by _apt update; apt install iperf3_. In case VMs have no Internet, set 'false' and the iperf3 will be installed from offline *.deb packages. |
diff --git a/global_config.yaml b/global_config.yaml
index f6213ca..025bd60 100644
--- a/global_config.yaml
+++ b/global_config.yaml
@@ -11,6 +11,7 @@
flavor_disk: 5
nova_timeout: 300
external_network: 'public'
+custom_mtu: 'defaut' # 'default' or some value like 8950
iperf_prep_string: "sudo /bin/bash -c 'echo \"91.189.88.161 archive.ubuntu.com\" >> /etc/hosts'"
internet_at_vms: 'true' # whether Internet is present at OpenStack VMs and iperf can be installed with apt
iperf_deb_package_dir_path: '/opt/packages/'
diff --git a/utils/os_client.py b/utils/os_client.py
index 12aad1b..8ef55de 100644
--- a/utils/os_client.py
+++ b/utils/os_client.py
@@ -376,12 +376,21 @@
def create_network(self, tenant_id):
net_name = "spt-test-net-{}".format(random.randrange(100, 999))
+ config = utils.get_configuration()
+ mtu = config.get('custom_mtu') or 'default'
net_body = {
'network': {
'name': net_name,
'tenant_id': tenant_id
}
}
+ if mtu != 'default':
+ try:
+ net_body['network']['mtu'] = int(mtu)
+ except ValueError as e:
+ raise ValueError("MTU value '{}' is not correct. "
+ "Must be an integer at 'custom_mtu' in "
+ "global_config.yaml.\n{}".format(mtu, e))
net = self.os_clients.network.create_network(net_body)['network']
logger.info("Created internal network {}".format(net_name))
return net