aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools
diff options
context:
space:
mode:
authorMaros Mullner <maros.mullner@pantheon.tech>2020-05-22 08:27:07 +0200
committerPeter Mikus <pmikus@cisco.com>2020-05-27 13:11:10 +0000
commit5d4c299d02072fd18ef175bfbf7c694e94db79a6 (patch)
tree2c68868b5fd42a86197aeae205557a435f4eef16 /resources/tools
parent3ea4fcebabfaac866d469a7b4355ac8df7732a0f (diff)
Terraform and ansible changes for Cloud environment (AWS, Azure).
Signed-off-by: Maros Mullner <maros.mullner@pantheon.tech> Change-Id: Ic78b5dae22b67763b99c50a5f15d7dd16152d5d5
Diffstat (limited to 'resources/tools')
-rw-r--r--resources/tools/terraform/aws/main.tf9
-rw-r--r--resources/tools/terraform/azure/main.tf69
-rw-r--r--resources/tools/terraform/azure/nic.tf12
-rw-r--r--resources/tools/testbed-setup/ansible/roles/aws/handlers/main.yaml7
-rw-r--r--resources/tools/testbed-setup/ansible/roles/azure/files/10-dtap.link4
-rw-r--r--resources/tools/testbed-setup/ansible/roles/azure/handlers/main.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/roles/azure/tasks/main.yaml14
-rw-r--r--resources/tools/testbed-setup/ansible/roles/calibration/defaults/main.yaml4
-rw-r--r--resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/roles/dpdk/files/dpdk-mlx5.patch19
-rw-r--r--resources/tools/testbed-setup/ansible/roles/trex/files/t-rex.patch12
-rw-r--r--resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/sut_aws.yaml4
-rw-r--r--resources/tools/testbed-setup/ansible/sut_azure.yaml4
-rw-r--r--resources/tools/testbed-setup/ansible/templates/topology_azure.j212
-rw-r--r--resources/tools/testbed-setup/ansible/tg_aws.yaml4
-rw-r--r--resources/tools/testbed-setup/ansible/tg_azure.yaml4
17 files changed, 129 insertions, 55 deletions
diff --git a/resources/tools/terraform/aws/main.tf b/resources/tools/terraform/aws/main.tf
index 49ef73e17f..edb179990a 100644
--- a/resources/tools/terraform/aws/main.tf
+++ b/resources/tools/terraform/aws/main.tf
@@ -194,6 +194,9 @@ resource "aws_instance" "tg" {
key_name = aws_key_pair.CSIT.key_name
associate_public_ip_address = true
subnet_id = aws_subnet.mgmt.id
+ root_block_device {
+ volume_size = 50
+ }
private_ip = var.tg_mgmt_ip
vpc_security_group_ids = [aws_security_group.CSIT.id]
depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT]
@@ -209,6 +212,9 @@ resource "aws_instance" "dut1" {
key_name = aws_key_pair.CSIT.key_name
associate_public_ip_address = true
subnet_id = aws_subnet.mgmt.id
+ root_block_device {
+ volume_size = 50
+ }
private_ip = var.dut1_mgmt_ip
vpc_security_group_ids = [aws_security_group.CSIT.id]
depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT]
@@ -224,6 +230,9 @@ resource "aws_instance" "dut2" {
key_name = aws_key_pair.CSIT.key_name
associate_public_ip_address = true
subnet_id = aws_subnet.mgmt.id
+ root_block_device {
+ volume_size = 50
+ }
private_ip = var.dut2_mgmt_ip
vpc_security_group_ids = [aws_security_group.CSIT.id]
depends_on = [aws_vpc.CSIT, aws_placement_group.CSIT]
diff --git a/resources/tools/terraform/azure/main.tf b/resources/tools/terraform/azure/main.tf
index 96b8065d5a..89f1905800 100644
--- a/resources/tools/terraform/azure/main.tf
+++ b/resources/tools/terraform/azure/main.tf
@@ -4,6 +4,11 @@ provider "azurerm" {
# Variables
+variable "vpc_addr_space_a" {
+ type = string
+ default = "172.16.0.0/16"
+}
+
variable "vpc_cidr_a" {
type = string
default = "172.16.0.0/24"
@@ -11,44 +16,42 @@ variable "vpc_cidr_a" {
variable "vpc_cidr_b" {
type = string
- default = "192.168.10.0/24"
+ default = "172.16.10.0/24"
}
variable "vpc_cidr_c" {
type = string
- default = "200.0.0.0/24"
+ default = "172.16.200.0/24"
}
variable "vpc_cidr_d" {
type = string
- default = "192.168.20.0/24"
+ default = "172.16.20.0/24"
}
variable "trex_dummy_cidr_port_0" {
type = string
- default = "10.0.0.0/24"
+ default = "172.16.11.0/24"
}
variable "trex_dummy_cidr_port_1" {
type = string
- default = "20.0.0.0/24"
+ default = "172.16.21.0/24"
}
# Create resource group and resources
resource "azurerm_resource_group" "CSIT" {
name = "CSIT"
- location = "East US"
+ #location = "East US"
+ location = "UK South"
}
resource "azurerm_virtual_network" "CSIT" {
name = "CSIT-network"
resource_group_name = azurerm_resource_group.CSIT.name
location = azurerm_resource_group.CSIT.location
- address_space = [ var.vpc_cidr_a,
- var.vpc_cidr_b,
- var.vpc_cidr_c,
- var.vpc_cidr_d ]
+ address_space = [ var.vpc_addr_space_a ]
depends_on = [ azurerm_resource_group.CSIT ]
}
@@ -239,21 +242,21 @@ resource "azurerm_route_table" "b" {
disable_bgp_route_propagation = false
route {
name = "route-10"
- address_prefix = "10.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_0
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.10.254"
+ next_hop_in_ip_address = data.azurerm_network_interface.tg_if1.private_ip_address
}
route {
name = "route-20"
- address_prefix = "20.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_1
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.10.11"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut1_if1.private_ip_address
}
route {
name = "tg2"
- address_prefix = "192.168.20.0/24"
+ address_prefix = var.vpc_cidr_d
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.10.11"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut1_if1.private_ip_address
}
}
@@ -266,27 +269,33 @@ resource "azurerm_route_table" "c" {
disable_bgp_route_propagation = false
route {
name = "route-10"
- address_prefix = "10.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_0
+ next_hop_type = "VirtualAppliance"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address
+ }
+ route {
+ name = "route-100"
+ address_prefix = "100.0.0.0/8"
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "200.0.0.101"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address
}
route {
name = "route-20"
- address_prefix = "20.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_1
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "200.0.0.102"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut2_if1.private_ip_address
}
route {
name = "tg1"
- address_prefix = "192.168.10.0/24"
+ address_prefix = var.vpc_cidr_b
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "200.0.0.101"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut1_if2.private_ip_address
}
route {
name = "tg2"
- address_prefix = "192.168.20.0/24"
+ address_prefix = var.vpc_cidr_d
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "200.0.0.102"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut2_if1.private_ip_address
}
}
@@ -299,21 +308,21 @@ resource "azurerm_route_table" "d" {
disable_bgp_route_propagation = false
route {
name = "route-10"
- address_prefix = "10.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_0
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.20.11"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut2_if2.private_ip_address
}
route {
name = "route-20"
- address_prefix = "20.0.0.0/24"
+ address_prefix = var.trex_dummy_cidr_port_1
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.20.254"
+ next_hop_in_ip_address = data.azurerm_network_interface.tg_if2.private_ip_address
}
route {
name = "tg1"
- address_prefix = "192.168.10.0/24"
+ address_prefix = var.vpc_cidr_b
next_hop_type = "VirtualAppliance"
- next_hop_in_ip_address = "192.168.20.11"
+ next_hop_in_ip_address = data.azurerm_network_interface.dut2_if2.private_ip_address
}
}
diff --git a/resources/tools/terraform/azure/nic.tf b/resources/tools/terraform/azure/nic.tf
index 8bacd4ad33..51692593c6 100644
--- a/resources/tools/terraform/azure/nic.tf
+++ b/resources/tools/terraform/azure/nic.tf
@@ -12,7 +12,7 @@ resource "azurerm_network_interface" "dut1_if2" {
name = "dut1_if2"
subnet_id = azurerm_subnet.c.id
private_ip_address_allocation = "Static"
- private_ip_address = "200.0.0.101"
+ private_ip_address = "172.16.200.101"
}
}
@@ -34,7 +34,7 @@ resource "azurerm_network_interface" "dut2_if1" {
name = "dut2_if1"
subnet_id = azurerm_subnet.c.id
private_ip_address_allocation = "Static"
- private_ip_address = "200.0.0.102"
+ private_ip_address = "172.16.200.102"
}
}
@@ -56,7 +56,7 @@ resource "azurerm_network_interface" "dut1_if1" {
name = "dut1_if1"
subnet_id = azurerm_subnet.b.id
private_ip_address_allocation = "Static"
- private_ip_address = "192.168.10.11"
+ private_ip_address = "172.16.10.11"
}
}
@@ -78,7 +78,7 @@ resource "azurerm_network_interface" "dut2_if2" {
name = "dut2_if2"
subnet_id = azurerm_subnet.d.id
private_ip_address_allocation = "Static"
- private_ip_address = "192.168.20.11"
+ private_ip_address = "172.16.20.11"
}
}
@@ -100,7 +100,7 @@ resource "azurerm_network_interface" "tg_if1" {
name = "tg1"
subnet_id = azurerm_subnet.b.id
private_ip_address_allocation = "Static"
- private_ip_address = "192.168.10.254"
+ private_ip_address = "172.16.10.250"
}
}
@@ -122,7 +122,7 @@ resource "azurerm_network_interface" "tg_if2" {
name = "tg2"
subnet_id = azurerm_subnet.d.id
private_ip_address_allocation = "Static"
- private_ip_address = "192.168.20.254"
+ private_ip_address = "172.16.20.250"
}
}
diff --git a/resources/tools/testbed-setup/ansible/roles/aws/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/aws/handlers/main.yaml
index b155b4b246..7363dc2c34 100644
--- a/resources/tools/testbed-setup/ansible/roles/aws/handlers/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/aws/handlers/main.yaml
@@ -6,3 +6,10 @@
reboot_timeout: 3600
tags:
- reboot-server
+
+- name: AWS - Reload systemd-modules
+ systemd:
+ name: "systemd-modules-load"
+ state: "restarted"
+ tags:
+ - reload-systemd-modules
diff --git a/resources/tools/testbed-setup/ansible/roles/azure/files/10-dtap.link b/resources/tools/testbed-setup/ansible/roles/azure/files/10-dtap.link
new file mode 100644
index 0000000000..a8e0aa10f3
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/azure/files/10-dtap.link
@@ -0,0 +1,4 @@
+[Match]
+OriginalName=dtap*
+[Link]
+NamePolicy=kernel
diff --git a/resources/tools/testbed-setup/ansible/roles/azure/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/azure/handlers/main.yaml
index 246e8dbfe0..f0d46062d9 100644
--- a/resources/tools/testbed-setup/ansible/roles/azure/handlers/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/azure/handlers/main.yaml
@@ -7,7 +7,7 @@
tags:
- reboot-server
-- name: Reload systemd-modules
+- name: Azure - Reload systemd-modules
systemd:
name: "systemd-modules-load"
state: "restarted"
diff --git a/resources/tools/testbed-setup/ansible/roles/azure/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/azure/tasks/main.yaml
index 3513bb7132..c8d72475d8 100644
--- a/resources/tools/testbed-setup/ansible/roles/azure/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/azure/tasks/main.yaml
@@ -11,7 +11,7 @@
- "ib_uverbs"
- "mlx4_ib"
- "mlx5_ib"
- notify: "Reload systemd-modules"
+ notify: "Azure - Reload systemd-modules"
tags:
- load-kernel-modules
@@ -24,3 +24,15 @@
reload: "yes"
tags:
- set-sysctl
+
+- name: Azure - prevent interface renaming
+ copy:
+ src: "files/10-dtap.link"
+ dest: "/etc/systemd/network/"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+ notify:
+ - "Reboot server"
+ tags:
+ - prevent-interface-renaming
diff --git a/resources/tools/testbed-setup/ansible/roles/calibration/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/calibration/defaults/main.yaml
index 5be9fa93a5..c639f11088 100644
--- a/resources/tools/testbed-setup/ansible/roles/calibration/defaults/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/calibration/defaults/main.yaml
@@ -19,12 +19,14 @@ packages_by_arch:
- []
# Kernel version to check.
-kernel_version: "{{ kernel_version_by_distro_by_arch[ansible_distribution | lower][ansible_machine] | join(' ') }}"
+kernel_version: "{{ kernel_version_by_distro_by_arch[ansible_distribution | lower][ansible_machine] }}"
kernel_version_by_distro_by_arch:
ubuntu:
x86_64:
- "4.15.0-72-generic"
+ - "5.3.0-1020-azure"
+ - "5.3.0-1017-aws"
aarch64:
- "4.15.0-54-generic"
diff --git a/resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml
index 02a9ef3d00..e88c39c180 100644
--- a/resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml
@@ -24,7 +24,7 @@
register: current_kernel_version
changed_when: false
failed_when: |
- kernel_version not in current_kernel_version.stdout
+ current_kernel_version.stdout not in kernel_version
tags:
- check-kernel-version
diff --git a/resources/tools/testbed-setup/ansible/roles/dpdk/files/dpdk-mlx5.patch b/resources/tools/testbed-setup/ansible/roles/dpdk/files/dpdk-mlx5.patch
new file mode 100644
index 0000000000..a3928d70f7
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/dpdk/files/dpdk-mlx5.patch
@@ -0,0 +1,19 @@
+diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
+index d7d3bc73c..c21c38485 100644
+--- a/drivers/net/mlx5/mlx5_ethdev.c
++++ b/drivers/net/mlx5/mlx5_ethdev.c
+@@ -1032,11 +1032,14 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
+ ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX);
+ dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+ ETH_LINK_SPEED_FIXED);
++#if 0
++ /* FIXME: this does not work on Azure w/ CX4-LX */
+ if (((dev_link.link_speed && !dev_link.link_status) ||
+ (!dev_link.link_speed && dev_link.link_status))) {
+ rte_errno = EAGAIN;
+ return -rte_errno;
+ }
++#endif
+ *link = dev_link;
+ return 0;
+ }
diff --git a/resources/tools/testbed-setup/ansible/roles/trex/files/t-rex.patch b/resources/tools/testbed-setup/ansible/roles/trex/files/t-rex.patch
index 65b437588d..e7db647779 100644
--- a/resources/tools/testbed-setup/ansible/roles/trex/files/t-rex.patch
+++ b/resources/tools/testbed-setup/ansible/roles/trex/files/t-rex.patch
@@ -534,3 +534,15 @@ index 782de540..8cedea84 100644
#ifdef HAVE_TC_ACT_BPF
#include <linux/tc_act/tc_bpf.h>
#endif
+diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
+index 0f66b07a..8c37ea15 100644
+--- a/src/main_dpdk.cpp
++++ b/src/main_dpdk.cpp
+@@ -6969,6 +6969,7 @@ COLD_FUNC bool DpdkTRexPortAttr::update_link_status_nowait(){
+ bool changed = false;
+ rte_eth_link_get_nowait(m_repid, &new_link);
+
++ new_link.link_speed = ETH_SPEED_NUM_50G;
+ if (new_link.link_speed != m_link.link_speed ||
+ new_link.link_duplex != m_link.link_duplex ||
+ new_link.link_autoneg != m_link.link_autoneg ||
diff --git a/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
index d8f35cbc17..0e139a22e6 100644
--- a/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
@@ -46,7 +46,7 @@
strip: 1
loop: "{{ trex_version }}"
when:
- - azure is defined
+ - azure is defined and "{{ item }}" == "2.73"
tags:
- install-trex
diff --git a/resources/tools/testbed-setup/ansible/sut_aws.yaml b/resources/tools/testbed-setup/ansible/sut_aws.yaml
index 5b2fc8d3e1..a7642abfef 100644
--- a/resources/tools/testbed-setup/ansible/sut_aws.yaml
+++ b/resources/tools/testbed-setup/ansible/sut_aws.yaml
@@ -21,5 +21,5 @@
tags: docker
- role: cleanup
tags: cleanup
- - role: calibration
- tags: calibration
+# - role: calibration
+# tags: calibration
diff --git a/resources/tools/testbed-setup/ansible/sut_azure.yaml b/resources/tools/testbed-setup/ansible/sut_azure.yaml
index 669e4097c6..835ab63d83 100644
--- a/resources/tools/testbed-setup/ansible/sut_azure.yaml
+++ b/resources/tools/testbed-setup/ansible/sut_azure.yaml
@@ -21,5 +21,5 @@
tags: dpdk
- role: cleanup
tags: cleanup
- - role: calibration
- tags: calibration
+# - role: calibration
+# tags: calibration
diff --git a/resources/tools/testbed-setup/ansible/templates/topology_azure.j2 b/resources/tools/testbed-setup/ansible/templates/topology_azure.j2
index df595fd4b8..e4dd6cdbf2 100644
--- a/resources/tools/testbed-setup/ansible/templates/topology_azure.j2
+++ b/resources/tools/testbed-setup/ansible/templates/topology_azure.j2
@@ -21,13 +21,13 @@ nodes:
mac_address: "{{ tg_if1_mac | lower | replace('-',':') }}"
pci_address: "0002:00:02.0"
link: link1
- model: azure-mlx-40g
+ model: Azure-MLX-40G
port2:
# tg_instance/p2 - 40GE port2 on Mellanox NIC.
mac_address: "{{ tg_if2_mac | lower | replace('-',':') }}"
pci_address: "0003:00:02.0"
link: link2
- model: azure-mlx-40g
+ model: Azure-MLX-40G
DUT1:
type: DUT
host: "{{ dut1_public_ip }}"
@@ -47,13 +47,13 @@ nodes:
mac_address: "{{ dut1_if1_mac | lower | replace('-',':') }}"
pci_address: "0002:00:02.0"
link: link1
- model: azure-mlx-40g
+ model: Azure-MLX-40G
port2:
# dut2_instance/p1 - 40GE port2 on Mellanox NIC.
mac_address: "{{ dut1_if2_mac | lower | replace('-',':') }}"
pci_address: "0003:00:02.0"
link: link21
- model: azure-mlx-40g
+ model: Azure-MLX-40G
DUT2:
type: DUT
host: "{{ dut2_public_ip }}"
@@ -73,10 +73,10 @@ nodes:
mac_address: "{{ dut2_if1_mac | lower | replace('-',':') }}"
pci_address: "0002:00:02.0"
link: link21
- model: azure-mlx-40g
+ model: Azure-MLX-40G
port2:
# dut2_instance/p1 - 40GE port2 on Mellanox NIC.
mac_address: "{{ dut2_if2_mac | lower | replace('-',':') }}"
pci_address: "0003:00:02.0"
link: link2
- model: azure-mlx-40g
+ model: Azure-MLX-40G
diff --git a/resources/tools/testbed-setup/ansible/tg_aws.yaml b/resources/tools/testbed-setup/ansible/tg_aws.yaml
index eb3a303825..dda50f416e 100644
--- a/resources/tools/testbed-setup/ansible/tg_aws.yaml
+++ b/resources/tools/testbed-setup/ansible/tg_aws.yaml
@@ -25,5 +25,5 @@
tags: docker
- role: cleanup
tags: cleanup
- - role: calibration
- tags: calibration
+# - role: calibration
+# tags: calibration
diff --git a/resources/tools/testbed-setup/ansible/tg_azure.yaml b/resources/tools/testbed-setup/ansible/tg_azure.yaml
index e28d0d3336..afe2d11c4a 100644
--- a/resources/tools/testbed-setup/ansible/tg_azure.yaml
+++ b/resources/tools/testbed-setup/ansible/tg_azure.yaml
@@ -23,5 +23,5 @@
tags: docker
- role: cleanup
tags: cleanup
- - role: calibration
- tags: calibration
+# - role: calibration
+# tags: calibration