From e4c77771697e384a0853eff9f89ba60d9e91538d Mon Sep 17 00:00:00 2001 From: Srushti Patel <137830748+srushti-patl@users.noreply.github.com> Date: Thu, 4 Apr 2024 18:08:00 -0700 Subject: [PATCH] CXF 88608: UAT Terratest workflow for Cloud Router Connectivity (#44) * feat: Adding GHA workflow for Terra tests * feat: Adding new terratests for port-2port connection and updating variables * misc: removing cloud router changes from the PR * misc: fixing UAT terra-tests workflow * misc: Adding versions file to uat/tests examples * fix: Updating UAT tests workflow and moving terra tests under one file * fix: Appending Secret values directly to the file in UAT workflow * fix: fixing setup variables files job in UAT workflow * fix: deleting old terra tests files * nit: fixing indentation * misc:Updating workflow file * misc:reverting the latest change in UAT workflow * misc:Updating UAT workflow file and variable files * feat: Adding UAT workflow & terratests for cloud router and routing protocol connectivity * feat: Adding UAT workflow for cloud router and routing protocol * fix: Changing variable name for vlan_tag in FCR 2 Port connectivity * fix: Updating vlan_c_tag logical condition in virtual-device module * fix: fixing additional_info variable name in ibm1 example * fix:updating uat terra tests workflow with env client_id & client_secret * fix:updating terra tests functions with postfix PNFV & PFCR * fix:Updating worklfow name and removing extra files from uat folder --- .github/workflows/terratests-uat-suite.yaml | 80 ++++++++++--- .../cloud-router-2-wan-connection/outputs.tf | 2 +- examples/port-2-ibm1-connection/main.tf | 2 +- modules/virtual-device-connection/main.tf | 4 +- .../cloud-router-2-aws-connection/main.tf | 28 +++++ .../cloud-router-2-aws-connection/outputs.tf | 3 + .../variables.tf | 81 ++++++++++++++ .../versions.tf | 0 .../cloud-router-2-azure-connection/main.tf | 27 +++++ .../outputs.tf | 3 + .../variables.tf | 75 +++++++++++++ .../versions.tf | 9 ++ .../main.tf | 45 ++++++++ .../outputs.tf | 10 ++ .../variables.tf | 105 ++++++++++++++++++ .../versions.tf | 9 ++ .../port-2-aws-connection/main.tf | 0 .../port-2-aws-connection/outputs.tf | 0 .../port-2-aws-connection/variables.tf | 0 .../port-2-aws-connection/versions.tf | 9 ++ .../port-2-azure-connection/main.tf | 0 .../port-2-azure-connection/outputs.tf | 0 .../port-2-azure-connection/variables.tf | 0 .../port-2-azure-connection/versions.tf | 0 tests/uat/uat_sanity_suite_test.go | 95 ++++++++++++++-- 25 files changed, 560 insertions(+), 27 deletions(-) create mode 100644 tests/examples-without-external-providers/cloud-router-2-aws-connection/main.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-aws-connection/outputs.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-aws-connection/variables.tf rename tests/{uat/port-2-aws-connection => examples-without-external-providers/cloud-router-2-aws-connection}/versions.tf (100%) create mode 100644 tests/examples-without-external-providers/cloud-router-2-azure-connection/main.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-azure-connection/outputs.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-azure-connection/variables.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-azure-connection/versions.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/main.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/outputs.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/variables.tf create mode 100644 tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/versions.tf rename tests/{uat => examples-without-external-providers}/port-2-aws-connection/main.tf (100%) rename tests/{uat => examples-without-external-providers}/port-2-aws-connection/outputs.tf (100%) rename tests/{uat => examples-without-external-providers}/port-2-aws-connection/variables.tf (100%) create mode 100644 tests/examples-without-external-providers/port-2-aws-connection/versions.tf rename tests/{uat => examples-without-external-providers}/port-2-azure-connection/main.tf (100%) rename tests/{uat => examples-without-external-providers}/port-2-azure-connection/outputs.tf (100%) rename tests/{uat => examples-without-external-providers}/port-2-azure-connection/variables.tf (100%) rename tests/{uat => examples-without-external-providers}/port-2-azure-connection/versions.tf (100%) diff --git a/.github/workflows/terratests-uat-suite.yaml b/.github/workflows/terratests-uat-suite.yaml index bbc8df7b..50798563 100644 --- a/.github/workflows/terratests-uat-suite.yaml +++ b/.github/workflows/terratests-uat-suite.yaml @@ -5,18 +5,69 @@ on: workflow_dispatch: jobs: - setup-tests: - name: Setup UAT Tests + test-PNFV: + name: Setup UAT PNFV Tests runs-on: ubuntu-latest env: + TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID_PNFV }} + TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET_PNFV }} EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com" TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION }} + + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: './go.mod' + id: go + + - name: Get dependencies + run: | + go mod download + + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ matrix.terraform }} + terraform_wrapper: false + + - name: Setup Variables Files + run: | + echo $TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION >> "./examples/port-2-alibaba-connection/terraform.tfvars.json" + + - name: Run Go Tests + run: + go test ./tests/uat -v -coverprofile coverage_uat_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(PNFV)" -timeout 180m + + - name: Upload test coverage to Codecov + if: ${{ always() }} + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage_uat_modules.txt + + test-PFCR: + name: Setup UAT PFCR Tests + runs-on: ubuntu-latest + env: + TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID_PFCR }} + TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET_PFCR }} + EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com" TEST_DATA_UAT_PORT_2_AWS_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_AWS_CONNECTION }} TEST_DATA_UAT_PORT_2_AZURE_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_AZURE_CONNECTION }} TEST_DATA_UAT_PORT_2_IBM2_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_IBM2_CONNECTION }} TEST_DATA_UAT_PORT_2_PORT_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_PORT_CONNECTION }} TEST_DATA_UAT_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION }} TEST_DATA_UAT_PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION }} + TEST_DATA_UAT_CLOUD_ROUTER_2_AWS_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_AWS_CONNECTION}} + TEST_DATA_UAT_CLOUD_ROUTER_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_AZURE_CONNECTION}} + TEST_DATA_UAT_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION}} + TEST_DATA_UAT_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION}} + TEST_DATA_UAT_CLOUD_ROUTER_2_WAN_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_WAN_CONNECTION}} steps: - name: Check out code into the Go module directory @@ -32,7 +83,8 @@ jobs: - name: Get dependencies run: | - go mod download + go mod download + - uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ matrix.terraform }} @@ -40,26 +92,26 @@ jobs: - name: Setup Variables Files run: | - echo $TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION >> "./examples/port-2-alibaba-connection/terraform.tfvars.json" - echo $TEST_DATA_UAT_PORT_2_AWS_CONNECTION >> "./tests/uat/port-2-aws-connection/terraform.tfvars.json" - echo $TEST_DATA_UAT_PORT_2_AZURE_CONNECTION >> "./tests/uat/port-2-azure-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_PORT_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/port-2-aws-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_PORT_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/port-2-azure-connection/terraform.tfvars.json" echo $TEST_DATA_UAT_PORT_2_IBM2_CONNECTION >> "./examples/port-2-ibm2-connection/terraform.tfvars.json" echo $TEST_DATA_UAT_PORT_2_PORT_CONNECTION >> "./examples/port-2-port-connection/terraform.tfvars.json" echo $TEST_DATA_UAT_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION >> "./examples/port-2-private-service-profile-connection/terraform.tfvars.json" echo $TEST_DATA_UAT_PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION >> "./examples/port-2-public-service-profile-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-aws-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-azure-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION >> "./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json" + echo $TEST_DATA_UAT_CLOUD_ROUTER_2_WAN_CONNECTION >> "./examples/cloud-router-2-wan-connection/terraform.tfvars.json" + - name: Run Go Tests run: - go test ./tests/uat -v -coverprofile coverage_uat_modules.txt -covermode=atomic -count 1 -parallel 8 -timeout 180m - - - name: Setup Node.js 20.11.1 - uses: actions/setup-node@v2 - with: - node-version: 20.11.1 + go test ./tests/uat -v -coverprofile coverage_uat_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(PFCR)" -timeout 180m - name: Upload test coverage to Codecov if: ${{ always() }} uses: codecov/codecov-action@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage_uat_modules.txt + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage_uat_modules.txt diff --git a/examples/cloud-router-2-wan-connection/outputs.tf b/examples/cloud-router-2-wan-connection/outputs.tf index 1b64fc52..cedeaf6d 100644 --- a/examples/cloud-router-2-wan-connection/outputs.tf +++ b/examples/cloud-router-2-wan-connection/outputs.tf @@ -1,3 +1,3 @@ -output "module_output" { +output "wan_connection_id" { value = module.cloud_router_wan_connection.primary_connection_id } diff --git a/examples/port-2-ibm1-connection/main.tf b/examples/port-2-ibm1-connection/main.tf index eec0127b..988b0604 100644 --- a/examples/port-2-ibm1-connection/main.tf +++ b/examples/port-2-ibm1-connection/main.tf @@ -25,5 +25,5 @@ module "create_port_2_ibm1_connection" { zside_location = var.zside_location zside_seller_region = var.zside_seller_region zside_sp_name = var.zside_sp_name - primary_additional_info = var.additional_info + additional_info = var.additional_info } diff --git a/modules/virtual-device-connection/main.tf b/modules/virtual-device-connection/main.tf index 4114b4b8..edbd7182 100644 --- a/modules/virtual-device-connection/main.tf +++ b/modules/virtual-device-connection/main.tf @@ -59,7 +59,7 @@ resource "equinix_fabric_connection" "virtual_device_connection" { type = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type vlan_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "DOT1Q" ? var.zside_vlan_tag : null vlan_s_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" ? var.zside_vlan_tag : null - vlan_c_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" && one(data.equinix_fabric_ports.aside_port.data.0.encapsulation).type != "QINQ" ? var.zside_vlan_inner_tag : null + vlan_c_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" ? var.zside_vlan_inner_tag : null } location { metro_code = var.zside_location @@ -167,7 +167,7 @@ resource "equinix_fabric_connection" "secondary_virtual_device_connection" { type = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type vlan_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "DOT1Q" ? var.zside_vlan_tag : null vlan_s_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" ? var.zside_vlan_tag : null - vlan_c_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" && one(data.equinix_fabric_ports.aside_port.data.0.encapsulation).type != "QINQ" ? var.zside_vlan_inner_tag : null + vlan_c_tag = one(data.equinix_fabric_ports.zside_port[0].data.0.encapsulation).type == "QINQ" ? var.zside_vlan_inner_tag : null } location { metro_code = var.zside_location diff --git a/tests/examples-without-external-providers/cloud-router-2-aws-connection/main.tf b/tests/examples-without-external-providers/cloud-router-2-aws-connection/main.tf new file mode 100644 index 00000000..5539655f --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-aws-connection/main.tf @@ -0,0 +1,28 @@ +provider "equinix" { + client_id = var.equinix_client_id + client_secret = var.equinix_client_secret +} + +module "cloud_router_aws_connection" { + source = "equinix/fabric/equinix//modules/cloud-router-connection" + + connection_name = var.connection_name + connection_type = var.connection_type + notifications_type = var.notifications_type + notifications_emails = var.notifications_emails + additional_info = var.additional_info + bandwidth = var.bandwidth + purchase_order_number = var.purchase_order_number + + #Aside + aside_fcr_uuid = var.aside_fcr_uuid + aside_ap_type = var.aside_ap_type + + #Zside + zside_ap_type = var.zside_ap_type + zside_ap_authentication_key = var.zside_ap_authentication_key + zside_ap_profile_type = var.zside_ap_profile_type + zside_location = var.zside_location + zside_seller_region = var.zside_seller_region + zside_fabric_sp_name = var.zside_fabric_sp_name +} diff --git a/tests/examples-without-external-providers/cloud-router-2-aws-connection/outputs.tf b/tests/examples-without-external-providers/cloud-router-2-aws-connection/outputs.tf new file mode 100644 index 00000000..7e2deb53 --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-aws-connection/outputs.tf @@ -0,0 +1,3 @@ +output "aws_connection_id" { + value = module.cloud_router_aws_connection.primary_connection_id +} diff --git a/tests/examples-without-external-providers/cloud-router-2-aws-connection/variables.tf b/tests/examples-without-external-providers/cloud-router-2-aws-connection/variables.tf new file mode 100644 index 00000000..505e79d4 --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-aws-connection/variables.tf @@ -0,0 +1,81 @@ +variable "equinix_client_id" { + description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "equinix_client_secret" { + description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "connection_name" { + description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" + type = string +} +variable "connection_type" { + description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC" + default = "" + type = string +} +variable "notifications_type" { + description = "Notification Type - ALL is the only type currently supported" + type = string + default = "ALL" +} +variable "notifications_emails" { + description = "Array of contact emails" + type = list(string) +} +variable "bandwidth" { + description = "Connection bandwidth in Mbps" + type = number +} +variable "purchase_order_number" { + description = "Purchase order number" + type = string + default = "" +} +variable "aside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string +} +variable "aside_fcr_uuid" { + description = "Equinix-assigned Fabric Cloud Router identifier" + type = string +} +variable "zside_ap_authentication_key" { + description = "Authentication key for provider based connections" + type = string + sensitive = true +} +variable "zside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string + default = "SP" +} +variable "zside_ap_profile_type" { + description = "Service profile type - L2_PROFILE, L3_PROFILE, ECIA_PROFILE, ECMC_PROFILE" + type = string + default = "L2_PROFILE" +} +variable "zside_location" { + description = "Access point metro code" + type = string + default = "SP" +} +variable "zside_fabric_sp_name" { + description = "Equinix Service Profile Name" + type = string + default = "" +} +variable "zside_seller_region" { + description = "Access point seller region" + type = string + default = "" +} +variable "additional_info" { + description = "Additional parameters required for some service profiles. It should be a list of maps containing 'key' and 'value e.g. `[{ key='asn' value = '65000'}, { key='ip' value = '192.168.0.1'}]`" + type = list(object({ key = string, value = string })) + default = [] + sensitive = true +} diff --git a/tests/uat/port-2-aws-connection/versions.tf b/tests/examples-without-external-providers/cloud-router-2-aws-connection/versions.tf similarity index 100% rename from tests/uat/port-2-aws-connection/versions.tf rename to tests/examples-without-external-providers/cloud-router-2-aws-connection/versions.tf diff --git a/tests/examples-without-external-providers/cloud-router-2-azure-connection/main.tf b/tests/examples-without-external-providers/cloud-router-2-azure-connection/main.tf new file mode 100644 index 00000000..26e0b96e --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-azure-connection/main.tf @@ -0,0 +1,27 @@ +provider "equinix" { + client_id = var.equinix_client_id + client_secret = var.equinix_client_secret +} + +module "cloud_router_azure_connection" { + source = "equinix/fabric/equinix//modules/cloud-router-connection" + + connection_name = var.connection_name + connection_type = var.connection_type + notifications_type = var.notifications_type + notifications_emails = var.notifications_emails + bandwidth = var.bandwidth + purchase_order_number = var.purchase_order_number + + #Aside + aside_ap_type = var.aside_ap_type + aside_fcr_uuid = var.aside_fcr_uuid + + #Zside + zside_ap_type = var.zside_ap_type + zside_ap_authentication_key = var.zside_ap_authentication_key + zside_ap_profile_type = var.zside_ap_profile_type + zside_location = var.zside_location + zside_peering_type = var.zside_peering_type + zside_fabric_sp_name = var.zside_fabric_sp_name +} diff --git a/tests/examples-without-external-providers/cloud-router-2-azure-connection/outputs.tf b/tests/examples-without-external-providers/cloud-router-2-azure-connection/outputs.tf new file mode 100644 index 00000000..d695266a --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-azure-connection/outputs.tf @@ -0,0 +1,3 @@ +output "azure_connection_id" { + value = module.cloud_router_azure_connection.primary_connection_id +} diff --git a/tests/examples-without-external-providers/cloud-router-2-azure-connection/variables.tf b/tests/examples-without-external-providers/cloud-router-2-azure-connection/variables.tf new file mode 100644 index 00000000..1ec7983b --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-azure-connection/variables.tf @@ -0,0 +1,75 @@ +variable "equinix_client_id" { + description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "equinix_client_secret" { + description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "connection_name" { + description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" + type = string +} +variable "connection_type" { + description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC" + type = string + default = "" +} +variable "bandwidth" { + description = "Connection bandwidth in Mbps" + type = number +} +variable "notifications_type" { + description = "Notification Type - ALL is the only type currently supported" + type = string + default = "ALL" +} +variable "notifications_emails" { + description = "Array of contact emails" + type = list(string) +} +variable "purchase_order_number" { + description = "Purchase order number" + type = string + default = "" +} +variable "aside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string +} +variable "aside_fcr_uuid" { + description = "Equinix-assigned Fabric Cloud Router identifier" + type = string +} +variable "zside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string + default = "SP" +} +variable "zside_ap_profile_type" { + description = "Service profile type - L2_PROFILE, L3_PROFILE, ECIA_PROFILE, ECMC_PROFILE" + type = string + default = "L2_PROFILE" +} +variable "zside_location" { + description = "Access point metro code" + type = string + default = "SP" +} +variable "zside_peering_type" { + description = "Access point peering type - PRIVATE, MICROSOFT, PUBLIC, MANUAL" + default = "PRIVATE" +} + +variable "zside_fabric_sp_name" { + description = "Equinix Service Profile Name" + type = string + default = "" +} +variable "zside_ap_authentication_key" { + description = "Authentication key for provider based connections" + type = string + sensitive = true +} diff --git a/tests/examples-without-external-providers/cloud-router-2-azure-connection/versions.tf b/tests/examples-without-external-providers/cloud-router-2-azure-connection/versions.tf new file mode 100644 index 00000000..a0794547 --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-azure-connection/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 1.25.1" + } + } +} diff --git a/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/main.tf b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/main.tf new file mode 100644 index 00000000..0f5d3f43 --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/main.tf @@ -0,0 +1,45 @@ +provider "equinix" { + client_id = var.equinix_client_id + client_secret = var.equinix_client_secret +} + +module "cloud_router_port_connection" { + source = "equinix/fabric/equinix//modules/cloud-router-connection" + + connection_name = var.connection_name + connection_type = var.connection_type + notifications_type = var.notifications_type + notifications_emails = var.notifications_emails + bandwidth = var.bandwidth + purchase_order_number = var.purchase_order_number + + #Aside + aside_ap_type = var.aside_ap_type + aside_fcr_uuid = var.aside_fcr_uuid + + #Zside + zside_ap_type = var.zside_ap_type + zside_location = var.zside_location + zside_port_name = var.zside_port_name + zside_vlan_tag = var.zside_vlan_tag +} + +module "routing_protocols" { + depends_on = [module.cloud_router_port_connection] + source = "equinix/fabric/equinix//modules/routing-protocols" + + connection_uuid = module.cloud_router_port_connection.primary_connection_id + + # Direct RP Details + direct_rp_name = var.direct_rp_name + direct_equinix_ipv4_ip = var.direct_equinix_ipv4_ip + direct_equinix_ipv6_ip = var.direct_equinix_ipv6_ip + + # BGP RP Details + bgp_rp_name = var.bgp_rp_name + bgp_customer_asn = var.bgp_customer_asn + bgp_customer_peer_ipv4 = var.bgp_customer_peer_ipv4 + bgp_enabled_ipv4 = var.bgp_enabled_ipv4 + bgp_customer_peer_ipv6 = var.bgp_customer_peer_ipv6 + bgp_enabled_ipv6 = var.bgp_enabled_ipv6 +} diff --git a/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/outputs.tf b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/outputs.tf new file mode 100644 index 00000000..50254adf --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/outputs.tf @@ -0,0 +1,10 @@ +output "port_connection_id" { + value = module.cloud_router_port_connection.primary_connection_id +} +output "direct_rp_id" { + value = module.routing_protocols.direct_routing_protocol_id +} + +output "bgp_rp_id" { + value = module.routing_protocols.bgp_routing_protocol_id +} diff --git a/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/variables.tf b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/variables.tf new file mode 100644 index 00000000..5d2a400a --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/variables.tf @@ -0,0 +1,105 @@ +variable "equinix_client_id" { + description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "equinix_client_secret" { + description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "connection_name" { + description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" + type = string +} +variable "connection_type" { + description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC" + type = string + default = "" +} +variable "notifications_type" { + description = "Notification Type - ALL is the only type currently supported" + type = string + default = "ALL" +} +variable "notifications_emails" { + description = "Array of contact emails" + type = list(string) +} +variable "bandwidth" { + description = "Connection bandwidth in Mbps" + type = number +} +variable "purchase_order_number" { + description = "Purchase order number" + type = string + default = "" +} +variable "aside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string +} +variable "aside_fcr_uuid" { + description = "Equinix-assigned Fabric Cloud Router identifier" + type = string +} +variable "zside_port_name" { + description = "Equinix Zside Port Name" + type = string +} +variable "zside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string + default = "SP" +} +variable "zside_vlan_tag" { + description = "Access point protocol Vlan tag number for DOT1Q or QINQ connections" + default = "" +} +variable "zside_location" { + description = "Access point metro code" + type = string + default = "SP" +} +variable "direct_rp_name" { + description = "Name of the Direct Routing Protocol" + type = string +} +variable "direct_equinix_ipv4_ip" { + description = "IPv4 Address for Direct Routing Protocol" + type = string +} +variable "direct_equinix_ipv6_ip" { + description = "IPv6 Address for Direct Routing Protocol" + type = string +} +variable "bgp_rp_name" { + description = "Name of the BGP Routing Protocol" + type = string + default = "" +} +variable "bgp_customer_peer_ipv4" { + description = "Customer Peering IPv4 Address for BGP Routing Protocol" + type = string + default = "" +} +variable "bgp_customer_peer_ipv6" { + description = "Customer Peering IPv6 Address for BGP Routing Protocol" + type = string + default = "" +} +variable "bgp_enabled_ipv4" { + description = "Boolean Enable Flag for IPv4 Peering on BGP Routing Protocol" + type = bool + default = true +} +variable "bgp_enabled_ipv6" { + description = "Boolean Enable Flag for IPv6 Peering on BGP Routing Protocol" + type = bool + default = true +} +variable "bgp_customer_asn" { + description = "Customer ASN for BGP Routing Protocol" + type = string + default = "" +} diff --git a/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/versions.tf b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/versions.tf new file mode 100644 index 00000000..8e226867 --- /dev/null +++ b/tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 1.20.0" + } + } +} diff --git a/tests/uat/port-2-aws-connection/main.tf b/tests/examples-without-external-providers/port-2-aws-connection/main.tf similarity index 100% rename from tests/uat/port-2-aws-connection/main.tf rename to tests/examples-without-external-providers/port-2-aws-connection/main.tf diff --git a/tests/uat/port-2-aws-connection/outputs.tf b/tests/examples-without-external-providers/port-2-aws-connection/outputs.tf similarity index 100% rename from tests/uat/port-2-aws-connection/outputs.tf rename to tests/examples-without-external-providers/port-2-aws-connection/outputs.tf diff --git a/tests/uat/port-2-aws-connection/variables.tf b/tests/examples-without-external-providers/port-2-aws-connection/variables.tf similarity index 100% rename from tests/uat/port-2-aws-connection/variables.tf rename to tests/examples-without-external-providers/port-2-aws-connection/variables.tf diff --git a/tests/examples-without-external-providers/port-2-aws-connection/versions.tf b/tests/examples-without-external-providers/port-2-aws-connection/versions.tf new file mode 100644 index 00000000..8e226867 --- /dev/null +++ b/tests/examples-without-external-providers/port-2-aws-connection/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 1.20.0" + } + } +} diff --git a/tests/uat/port-2-azure-connection/main.tf b/tests/examples-without-external-providers/port-2-azure-connection/main.tf similarity index 100% rename from tests/uat/port-2-azure-connection/main.tf rename to tests/examples-without-external-providers/port-2-azure-connection/main.tf diff --git a/tests/uat/port-2-azure-connection/outputs.tf b/tests/examples-without-external-providers/port-2-azure-connection/outputs.tf similarity index 100% rename from tests/uat/port-2-azure-connection/outputs.tf rename to tests/examples-without-external-providers/port-2-azure-connection/outputs.tf diff --git a/tests/uat/port-2-azure-connection/variables.tf b/tests/examples-without-external-providers/port-2-azure-connection/variables.tf similarity index 100% rename from tests/uat/port-2-azure-connection/variables.tf rename to tests/examples-without-external-providers/port-2-azure-connection/variables.tf diff --git a/tests/uat/port-2-azure-connection/versions.tf b/tests/examples-without-external-providers/port-2-azure-connection/versions.tf similarity index 100% rename from tests/uat/port-2-azure-connection/versions.tf rename to tests/examples-without-external-providers/port-2-azure-connection/versions.tf diff --git a/tests/uat/uat_sanity_suite_test.go b/tests/uat/uat_sanity_suite_test.go index a347346f..c3ce8e0f 100644 --- a/tests/uat/uat_sanity_suite_test.go +++ b/tests/uat/uat_sanity_suite_test.go @@ -6,93 +6,170 @@ import ( "testing" ) -func TestPort2AlibabaCreateConnection(t *testing.T) { +func TestPort2AlibabaCreateConnection_PNFV(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../../examples/port-2-alibaba-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "alibaba_connection_id") assert.NotNil(t, output) } -func TestPort2AwsCreateConnection(t *testing.T) { +func TestPort2AwsCreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ - TerraformDir: "../../tests/uat/port-2-aws-connection", + TerraformDir: "../../tests/examples-without-external-providers/port-2-aws-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "aws_connection_id") assert.NotNil(t, output) } -func TestPort2AzureCreateConnection(t *testing.T) { +func TestPort2AzureCreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ - TerraformDir: "../../tests/uat/port-2-azure-connection", + TerraformDir: "../../tests/examples-without-external-providers/port-2-azure-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "azure_connection_id") assert.NotNil(t, output) } -func TestPort2Ibm2CreateConnection(t *testing.T) { +func TestPort2Ibm2CreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../../examples/port-2-ibm2-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "ibm2_connection_id") assert.NotNil(t, output) } -func TestPort2PortCreateConnection(t *testing.T) { +func TestPort2PortCreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../../examples/port-2-port-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "port_connection_id") assert.NotNil(t, output) } -func TestPort2PrivateServiceProfileCreateConnection(t *testing.T) { +func TestPort2PrivateServiceProfileCreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../../examples/port-2-private-service-profile-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "private_sp_connection_id") assert.NotNil(t, output) } -func TestPort2PublicServiceProfileCreateConnection(t *testing.T) { +func TestPort2PublicServiceProfileCreateConnection_PFCR(t *testing.T) { terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../../examples/port-2-public-service-profile-connection", }) defer terraform.Destroy(t, terraformOptions) + t.Parallel() terraform.InitAndApply(t, terraformOptions) output := terraform.Output(t, terraformOptions, "public_sp_connection_id") assert.NotNil(t, output) } + +func TestCloudRouter2AwsCreateConnection_PFCR(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-aws-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "aws_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2AzureCreateConnection_PFCR(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-azure-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "azure_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2PortRoutingProtocolCreateConnection_PFCR(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "port_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2ServiceProfileCreateConnection_PFCR(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/cloud-router-2-service-profile-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "service_profile_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2WanCreateConnection_PFCR(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/cloud-router-2-wan-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "wan_connection_id") + assert.NotNil(t, output) +}