Skip to content

Commit

Permalink
CXF-98764: Add Sanity FCR to VD connections (#111)
Browse files Browse the repository at this point in the history
* CXF-98764: Add sanity tests for FCR to VD connections, in prod and UAT

* CXF-98764: Change secrets to PNFV user for UAT

* CXF-98764: Add example in tests

* CXF-98764: Address PR comments

* CXF-98764: Address PR comments
  • Loading branch information
d-bhola authored Aug 23, 2024
1 parent d85c844 commit 94b3d97
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/terratests-fcr-prod-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION}}

steps:
- name: Check out code into the Go module directory
Expand Down Expand Up @@ -56,7 +57,8 @@ jobs:
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json > ./examples/cloud-router-2-service-profile-connection/tmp.test.json && mv ./examples/cloud-router-2-service-profile-connection/tmp.test.json ./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION >> "./examples/cloud-router-2-wan-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-wan-connection/terraform.tfvars.json > ./examples/cloud-router-2-wan-connection/tmp.test.json && mv ./examples/cloud-router-2-wan-connection/tmp.test.json ./examples/cloud-router-2-wan-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION >> "./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json > ./examples/cloud-router-2-virtual-device-connection/tmp.test.json && mv ./examples/cloud-router-2-virtual-device-connection/tmp.test.json ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json
- name: Run Go Tests
run:
go test ./tests/prod/cloud-router -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/terratests-prod-suite-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION}}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_WAN_CONNECTION: ${{ secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_WAN_CONNECTION }}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION}}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION}}
Expand Down Expand Up @@ -94,6 +95,8 @@ jobs:
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/virtual-device-2-azure-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/virtual-device-2-azure-connection/tmp.test.json && mv ./tests/examples-without-external-providers/virtual-device-2-azure-connection/tmp.test.json ./tests/examples-without-external-providers/virtual-device-2-azure-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION >> "./tests/examples-without-external-providers/virtual-device-2-port-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/virtual-device-2-port-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/virtual-device-2-port-connection/tmp.test.json && mv ./tests/examples-without-external-providers/virtual-device-2-port-connection/tmp.test.json ./tests/examples-without-external-providers/virtual-device-2-port-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION >> "./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json > ./examples/cloud-router-2-virtual-device-connection/tmp.test.json && mv ./examples/cloud-router-2-virtual-device-connection/tmp.test.json ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json
- name: Run Go Tests
run:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/terratests-uat-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
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}}
TEST_DATA_UAT_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION: ${{secrets.TEST_DATA_UAT_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION}}

steps:
- name: Check out code into the Go module directory
Expand Down Expand Up @@ -108,6 +109,7 @@ jobs:
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"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION >> "./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json"
- name: Run Go Tests
run:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}

module "cloud_router_virtual_device_connection" {
source = "../../../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_fcr_uuid = var.aside_fcr_uuid

#Zside
zside_ap_type = var.zside_ap_type
zside_vd_type = var.zside_vd_type
zside_vd_uuid = var.zside_vd_uuid
zside_interface_type = var.zside_interface_type
zside_interface_id = var.zside_interface_id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "FCR_VD_Connection" {
value = module.cloud_router_virtual_device_connection.primary_connection_id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
equinix_client_id = "<MyEquinixClientId>"
equinix_client_secret = "<MyEquinixSecret>"

notifications_type = "ALL"
notifications_emails = ["[email protected]", "[email protected]"]
purchase_order_number = "1-323292"
connection_name = "fcr_2_vd"
connection_type = "IP_VC"
bandwidth = 50

aside_fcr_uuid = "<Fabric Cloud Router UUID>"

zside_ap_type = "VD"
zside_vd_type = "EDGE"
zside_vd_uuid = "<Virtual Device UUID>"
zside_interface_type = "NETWORK"
zside_interface_id = 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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
}
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_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 = "VD"
}
variable "zside_vd_type" {
description = "Virtual Device type - EDGE"
type = string
}
variable "zside_vd_uuid" {
description = "Virtual Device UUID"
type = string
}
variable "zside_interface_type" {
description = "Virtual Device Interface type - CLOUD, NETWORK"
type = string
default = ""
}
variable "zside_interface_id" {
description = "Interface Id"
type = number
default = null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.5.4"
required_providers {
equinix = {
source = "equinix/equinix"
version = ">= 1.31.0"
}
}
}
14 changes: 14 additions & 0 deletions tests/prod/prod_sanity_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,17 @@ func TestVirtualDevice2PortCreateConnection_DIGP(t *testing.T) {
})
terraform.Apply(t, terraformOptions)
}

func TestCloudRouter2VirtualDeviceCreateConnection_DIGP(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-virtual-device-connection",
})

defer terraform.Destroy(t, terraformOptions)
t.Parallel()

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "FCR_VD_Connection")
assert.NotNil(t, output)
}
14 changes: 14 additions & 0 deletions tests/uat/uat_sanity_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,17 @@ func TestVirtualDevice2PortCreateConnection_PNFV(t *testing.T) {
output := terraform.Output(t, terraformOptions, "port_connection_id")
assert.NotNil(t, output)
}

func TestCloudRouter2VirtualDeviceCreateConnection_PFCR(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-virtual-device-connection",
})

defer terraform.Destroy(t, terraformOptions)
t.Parallel()

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "FCR_VD_Connection")
assert.NotNil(t, output)
}

0 comments on commit 94b3d97

Please sign in to comment.