From 49ef34127693cbb2046d74efc59da018771861b5 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 11 Nov 2024 23:10:48 -0800 Subject: [PATCH 1/3] feat: Adding Zside Port Service Token resource --- docs/resources/fabric_service_token.md | 29 +++++++ .../zside_colo_service_token.tf | 25 ++++++ .../fabric/service_token/resource_test.go | 79 +++++++++++++++++++ .../resources/fabric_service_token.md.tmpl | 3 + 4 files changed, 136 insertions(+) create mode 100644 examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf diff --git a/docs/resources/fabric_service_token.md b/docs/resources/fabric_service_token.md index d3c7caf46..a62c2dc2b 100644 --- a/docs/resources/fabric_service_token.md +++ b/docs/resources/fabric_service_token.md @@ -41,6 +41,35 @@ resource "equinix_fabric_service_token" "test" { } ``` +Aside Port Service Token +```terraform +resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + description = "Zside COLO Service Token" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } +} +``` + Zside Virtual Device Service Token ```terraform resource "equinix_fabric_service_token" "test" { diff --git a/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf b/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf new file mode 100644 index 000000000..f4394340f --- /dev/null +++ b/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf @@ -0,0 +1,25 @@ +resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + description = "Zside COLO Service Token" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } +} diff --git a/internal/resources/fabric/service_token/resource_test.go b/internal/resources/fabric/service_token/resource_test.go index be7aa44e7..9fe82d418 100644 --- a/internal/resources/fabric/service_token/resource_test.go +++ b/internal/resources/fabric/service_token/resource_test.go @@ -110,6 +110,53 @@ func TestAccFabricAsidePortServiceToken_PNFV(t *testing.T) { }) } +func TestAccFabricZsidePortServiceToken_PNFV(t *testing.T) { + ports := testing_helpers.GetFabricEnvPorts(t) + var portUuid string + if len(ports) > 0 { + portUuid = ports["pnfv"]["dot1q"][0].GetUuid() + } + serviceTokenName, serviceTokenUpdatedName := "token_port_PNFV", "UP_Token_port_PNFV" + serviceTokenDescription, serviceTokenUpdatedDescription := "aside port token", "Updated aside port token" + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.TestAccPreCheck(t) }, + Providers: acceptance.TestAccProviders, + CheckDestroy: CheckServiceTokenDelete, + Steps: []resource.TestStep{ + { + Config: testAccFabricZsidePortServiceTokenConfig(serviceTokenName, serviceTokenDescription, portUuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("equinix_fabric_service_token.test", "uuid"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "name", serviceTokenName), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "type", "VC_TOKEN"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "description", serviceTokenDescription), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "expiration_date_time", "2025-01-18T06:43:49.981Z"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.supported_bandwidths.#", "3"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.port.0.uuid", portUuid), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.type", "DOT1Q"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.vlan_tag", "2087"), + ), + ExpectNonEmptyPlan: false, + }, + { + Config: testAccFabricZsidePortServiceTokenConfig(serviceTokenUpdatedName, serviceTokenUpdatedDescription, portUuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("equinix_fabric_service_token.test", "uuid"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "name", serviceTokenUpdatedName), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "type", "VC_TOKEN"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "description", serviceTokenUpdatedDescription), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "expiration_date_time", "2025-01-18T06:43:49.981Z"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.supported_bandwidths.#", "3"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.port.0.uuid", portUuid), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.type", "DOT1Q"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.vlan_tag", "2087"), + ), + ExpectNonEmptyPlan: false, + }, + }, + }) +} + func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, virtualDeviceUuid string) string { return fmt.Sprintf( `resource "equinix_fabric_service_token" "test"{ @@ -174,6 +221,38 @@ func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTo `, serviceTokenName, serviceTokenDescription, portUuid) } +func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { + return fmt.Sprintf( + `resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + name = "%s" + description = "%s" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "%s" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } + + } + `, serviceTokenName, serviceTokenDescription, portUuid) +} + func CheckServiceTokenDelete(s *terraform.State) error { ctx := context.Background() for _, rs := range s.RootModule().Resources { diff --git a/templates/resources/fabric_service_token.md.tmpl b/templates/resources/fabric_service_token.md.tmpl index 937d6ae6f..6018d927a 100644 --- a/templates/resources/fabric_service_token.md.tmpl +++ b/templates/resources/fabric_service_token.md.tmpl @@ -19,6 +19,9 @@ Additional documentation: Aside Port Service Token {{tffile "examples/resources/equinix_fabric_service_token/aside_colo_service_token.tf"}} +Aside Port Service Token +{{tffile "examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf"}} + Zside Virtual Device Service Token {{tffile "examples/resources/equinix_fabric_service_token/zside_vd_service_token.tf"}} From 6bd6fce0ee11b5e714dafb3ffd819b75f9eea97d Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Tue, 12 Nov 2024 13:05:42 -0800 Subject: [PATCH 2/3] fix: Updating Zside Port Token Description --- internal/resources/fabric/service_token/resource_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/resources/fabric/service_token/resource_test.go b/internal/resources/fabric/service_token/resource_test.go index 9fe82d418..09a7f4128 100644 --- a/internal/resources/fabric/service_token/resource_test.go +++ b/internal/resources/fabric/service_token/resource_test.go @@ -116,8 +116,8 @@ func TestAccFabricZsidePortServiceToken_PNFV(t *testing.T) { if len(ports) > 0 { portUuid = ports["pnfv"]["dot1q"][0].GetUuid() } - serviceTokenName, serviceTokenUpdatedName := "token_port_PNFV", "UP_Token_port_PNFV" - serviceTokenDescription, serviceTokenUpdatedDescription := "aside port token", "Updated aside port token" + serviceTokenName, serviceTokenUpdatedName := "token_zport_PNFV", "UP_Token_zport_PNFV" + serviceTokenDescription, serviceTokenUpdatedDescription := "zside port token", "Updated zside port token" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.TestAccPreCheck(t) }, Providers: acceptance.TestAccProviders, From 07494ef0b087eccb1b91c4fa8b98e8dbecc83130 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Fri, 15 Nov 2024 16:35:43 -0800 Subject: [PATCH 3/3] fix: Updating Docs for Zside Port Service Token example --- docs/resources/fabric_service_token.md | 2 +- templates/resources/fabric_service_token.md.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/resources/fabric_service_token.md b/docs/resources/fabric_service_token.md index a62c2dc2b..92c1a36da 100644 --- a/docs/resources/fabric_service_token.md +++ b/docs/resources/fabric_service_token.md @@ -41,7 +41,7 @@ resource "equinix_fabric_service_token" "test" { } ``` -Aside Port Service Token +Zside Port Service Token ```terraform resource "equinix_fabric_service_token" "test"{ type = "VC_TOKEN" diff --git a/templates/resources/fabric_service_token.md.tmpl b/templates/resources/fabric_service_token.md.tmpl index 6018d927a..6df858e27 100644 --- a/templates/resources/fabric_service_token.md.tmpl +++ b/templates/resources/fabric_service_token.md.tmpl @@ -19,7 +19,7 @@ Additional documentation: Aside Port Service Token {{tffile "examples/resources/equinix_fabric_service_token/aside_colo_service_token.tf"}} -Aside Port Service Token +Zside Port Service Token {{tffile "examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf"}} Zside Virtual Device Service Token