-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding Zside Port Service Token resource (#817)
-Added Zside Port Service Token Resource Acc Tests - Updated docs for Service Token Resource
- Loading branch information
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,35 @@ resource "equinix_fabric_service_token" "test" { | |
} | ||
``` | ||
|
||
Zside 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 = "<port_uuid>" | ||
} | ||
link_protocol { | ||
type = "DOT1Q" | ||
vlan_tag = "2087" | ||
} | ||
} | ||
} | ||
} | ||
notifications { | ||
type = "ALL" | ||
emails = ["[email protected]", "[email protected]"] | ||
} | ||
} | ||
``` | ||
|
||
Zside Virtual Device Service Token | ||
```terraform | ||
resource "equinix_fabric_service_token" "test" { | ||
|
25 changes: 25 additions & 0 deletions
25
examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "<port_uuid>" | ||
} | ||
link_protocol { | ||
type = "DOT1Q" | ||
vlan_tag = "2087" | ||
} | ||
} | ||
} | ||
} | ||
notifications { | ||
type = "ALL" | ||
emails = ["[email protected]", "[email protected]"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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_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, | ||
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 = ["[email protected]", "[email protected]"] | ||
} | ||
} | ||
`, serviceTokenName, serviceTokenDescription, portUuid) | ||
} | ||
|
||
func CheckServiceTokenDelete(s *terraform.State) error { | ||
ctx := context.Background() | ||
for _, rs := range s.RootModule().Resources { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters