Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat! Adding FCR2ServiceProfile example and test scripts #390

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ECX Fabric Layer2 Single Connection from fabric cloud router to Service Profile

This example shows how create single connection from Fabric Cloud Router to Seller Service Profile, on ECX Fabric ports.

## Adjust variables
At minimum, you must set below variables in `terraform.tfvars` file:

* `equinix_client_id` - Equinix client ID (consumer key), obtained after
registering app in the developer platform
* `equinix_client_secret` - Equinix client secret ID (consumer secret),
obtained same way as above

`fcr_uuid` - UUID of ECX Fabric Cloud Router on a-sideshow
`connection_name` - the name of the connection
`connection_type` - connection type, please refer schema
`notifications_type` - notification type
`notifications_emails` - List of emails
`bandwidth` - bandwidth in MBs
`redundancy` - Port redundancy
`aside_ap_type` - Fabric Cloud Router type
`zside_ap_type` - Z side access point type
`zside_ap_profile_type` - Service profile type
`fabric_sp_name` - Service profile name, fetched based on Service Profile get call using Service Profile search schema
`zside_location` - Seller location

## Initialize
- First step is to initialize the terraform directory/resource we are going to work on.
In the given example, the folder to perform CRUD operations on a fcr2serviceprofile connection can be found at examples/fcr2port/.

- Change directory into - `CD cloudRouter2serviceprofile`
- Initialize Terraform plugins - `terraform init`

## Fabric Cloud Router to ServiceProfile connection : Create, Read, Update and Delete(CRUD) operations
Note: `–auto-approve` command does not prompt the user for validating the applying config. Remove it to get a prompt to confirm the operation.

| Operation | Command | Description |
|:----------|:---------------------------------:|-----------------------------------------------------------------------:|
| CREATE | `terraform apply –auto-approve` | Creates a fcr2port connection resource |
| READ | `terraform show` | Reads/Shows the current state of the fcr2port connection resource |
| UPDATE | `terraform apply -refresh` | Updates the fcr2port with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created fcr2port connection resource |
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}

data "equinix_fabric_service_profiles" "sp" {
filter {
property = "/name"
operator = "="
values = [var.fabric_sp_name]
}
}

resource "equinix_fabric_connection" "fcr2profile" {
name = var.connection_name
type = var.connection_type
notifications{
type=var.notifications_type
emails=var.notifications_emails
}
bandwidth = var.bandwidth
redundancy {priority= var.redundancy}
order {
purchase_order_number= var.purchase_order_number
}
a_side {
access_point {
type= var.aside_ap_type
router {
uuid = var.fcr_uuid
}
}
}
z_side {
access_point {
type= var.zside_ap_type
profile {
type= var.zside_ap_profile_type
uuid= data.equinix_fabric_service_profiles.sp.id
}
location {
metro_code= var.zside_location
}
}
}
}

output "connection_result" {
value = equinix_fabric_connection.fcr2profile.id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_providers {
equinix = {
source = "equinix/equinix"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
equinix_client_id = "Equnix_Client_Id"
equinix_client_secret = "Equinix_Client_Secret"
connection_name = "cloudRouter_gen_csp"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["[email protected]"]
bandwidth = 50
redundancy = "SECONDARY" #"PRIMARY" #||
redundancy_group_uuid = "53e04795-e6da-4756-9462-8bdc9b1f96d3" #OPTIONAL
purchase_order_number = "1-323292"
peering_type="PRIVATE"
aside_ap_type = "CLOUD_ROUTER"
fcr_uuid = "Fabric Cloud Router UUID"
zside_ap_type = "SP"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
fabric_sp_name = "Ajith Ops User QnQ"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
variable "equinix_client_id" {}
variable "equinix_client_secret" {}
variable "connection_name" {}
variable "connection_type" {}
variable "notifications_type" {}
variable "notifications_emails" {}
variable "bandwidth" {}
variable "redundancy" {}
variable "redundancy_group_uuid" {}
variable "purchase_order_number" {}
variable "peering_type" {}
variable "aside_ap_type" {}
variable "fcr_uuid" {}
variable "zside_ap_type" {}
variable "zside_ap_profile_type" {}
variable "zside_location" {}
variable "fabric_sp_name" {}
21 changes: 21 additions & 0 deletions tests/connection_e2e_cloudRouter2serviceprofile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tests

import (
"testing"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
)

func TestCloudRouter2ServiceProfileCreateConnection(t *testing.T) {
// retryable errors in terraform testing.
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/fabric/v4/cloudRouterConnectivity/cloudRouter2serviceprofile",
})

defer terraform.Destroy(t, terraformOptions)

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