-
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: Updating service token resource to support network token creation
- Loading branch information
1 parent
54796c3
commit 3d610e1
Showing
3 changed files
with
139 additions
and
38 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
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
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 |
---|---|---|
|
@@ -157,7 +157,43 @@ func TestAccFabricZsidePortServiceToken_PNFV(t *testing.T) { | |
}) | ||
} | ||
|
||
func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, virtualDeviceUuid string) string { | ||
func TestAccFabricZsideNetworkServiceToken_PNFV(t *testing.T) { | ||
serviceTokenName, serviceTokenUpdatedName := "token_zwan_PNFV", "UP_Token_zwan_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: testAccFabricZsideNetworkServiceTokenConfig(serviceTokenName, serviceTokenDescription), | ||
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-02-18T06:43:49.981Z"), | ||
resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.network.0.uuid", "ff241e62-42f5-48bc-96c4-e0b5297fbed1"), | ||
), | ||
ExpectNonEmptyPlan: false, | ||
}, | ||
{ | ||
Config: testAccFabricZsideNetworkServiceTokenConfig(serviceTokenUpdatedName, serviceTokenUpdatedDescription), | ||
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-02-18T06:43:49.981Z"), | ||
resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.network.0.uuid", "ff241e62-42f5-48bc-96c4-e0b5297fbed1"), | ||
), | ||
ExpectNonEmptyPlan: false, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { | ||
return fmt.Sprintf( | ||
`resource "equinix_fabric_service_token" "test"{ | ||
type = "VC_TOKEN" | ||
|
@@ -166,16 +202,16 @@ func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, | |
expiration_date_time = "2025-01-18T06:43:49.981Z" | ||
service_token_connection { | ||
type = "EVPL_VC" | ||
supported_bandwidths = [50, 200, 10000] | ||
z_side { | ||
bandwidth_limit = 1000 | ||
a_side { | ||
access_point_selectors{ | ||
type = "VD" | ||
virtual_device{ | ||
type = "EDGE" | ||
type = "COLO" | ||
port { | ||
uuid = "%s" | ||
} | ||
interface{ | ||
type = "NETWORK" | ||
link_protocol { | ||
type = "DOT1Q" | ||
vlan_tag = "2987" | ||
} | ||
} | ||
} | ||
|
@@ -186,10 +222,10 @@ func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, | |
} | ||
} | ||
`, serviceTokenName, serviceTokenDescription, virtualDeviceUuid) | ||
`, serviceTokenName, serviceTokenDescription, portUuid) | ||
} | ||
|
||
func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { | ||
func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { | ||
return fmt.Sprintf( | ||
`resource "equinix_fabric_service_token" "test"{ | ||
type = "VC_TOKEN" | ||
|
@@ -198,16 +234,16 @@ func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTo | |
expiration_date_time = "2025-01-18T06:43:49.981Z" | ||
service_token_connection { | ||
type = "EVPL_VC" | ||
bandwidth_limit = 1000 | ||
a_side { | ||
supported_bandwidths = [50, 200, 10000] | ||
z_side { | ||
access_point_selectors{ | ||
type = "COLO" | ||
port { | ||
uuid = "%s" | ||
} | ||
link_protocol { | ||
type = "DOT1Q" | ||
vlan_tag = "2987" | ||
vlan_tag = "2087" | ||
} | ||
} | ||
} | ||
|
@@ -221,7 +257,7 @@ func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTo | |
`, serviceTokenName, serviceTokenDescription, portUuid) | ||
} | ||
|
||
func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { | ||
func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, virtualDeviceUuid string) string { | ||
return fmt.Sprintf( | ||
`resource "equinix_fabric_service_token" "test"{ | ||
type = "VC_TOKEN" | ||
|
@@ -233,13 +269,13 @@ func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTo | |
supported_bandwidths = [50, 200, 10000] | ||
z_side { | ||
access_point_selectors{ | ||
type = "COLO" | ||
port { | ||
type = "VD" | ||
virtual_device{ | ||
type = "EDGE" | ||
uuid = "%s" | ||
} | ||
link_protocol { | ||
type = "DOT1Q" | ||
vlan_tag = "2087" | ||
interface{ | ||
type = "NETWORK" | ||
} | ||
} | ||
} | ||
|
@@ -250,7 +286,34 @@ func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTo | |
} | ||
} | ||
`, serviceTokenName, serviceTokenDescription, portUuid) | ||
`, serviceTokenName, serviceTokenDescription, virtualDeviceUuid) | ||
} | ||
|
||
func testAccFabricZsideNetworkServiceTokenConfig(serviceTokenName string, serviceTokenDescription string) string { | ||
return fmt.Sprintf( | ||
`resource "equinix_fabric_service_token" "test" { | ||
type = "VC_TOKEN" | ||
name = "%s" | ||
description = "%s" | ||
expiration_date_time = "2025-02-18T06:43:49.981Z" | ||
service_token_connection { | ||
type = "EVPLAN_VC" | ||
supported_bandwidths = [50, 200, 10000] | ||
z_side { | ||
access_point_selectors{ | ||
type = "NETWORK" | ||
network { | ||
uuid = "ff241e62-42f5-48bc-96c4-e0b5297fbed1" | ||
} | ||
} | ||
} | ||
} | ||
notifications { | ||
type = "ALL" | ||
emails = ["[email protected]", "[email protected]"] | ||
} | ||
} | ||
`, serviceTokenName, serviceTokenDescription) | ||
} | ||
|
||
func CheckServiceTokenDelete(s *terraform.State) error { | ||
|