Skip to content

Commit 1406623

Browse files
committed
feat(specs): Add spec, tests and examples for panos_multicast_msdp_timer_routing_profile
1 parent 2b8e679 commit 1406623

File tree

5 files changed

+537
-3
lines changed

5 files changed

+537
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# A multicast MSDP timer routing profile can be imported by providing the following base64 encoded object as the ID
2+
# {
3+
# location = {
4+
# template = {
5+
# name = "multicast-routing-template"
6+
# panorama_device = "localhost.localdomain"
7+
# }
8+
# }
9+
#
10+
# name = "msdp-timer-profile-custom"
11+
# }
12+
terraform import panos_multicast_msdp_timer_routing_profile.example $(echo '{"location":{"template":{"name":"multicast-routing-template","panorama_device":"localhost.localdomain"}},"name":"msdp-timer-profile-custom"}' | base64)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Create a template
2+
resource "panos_template" "multicast_template" {
3+
location = { panorama = {} }
4+
name = "multicast-routing-template"
5+
}
6+
7+
# MSDP Timer Profile with custom values
8+
resource "panos_multicast_msdp_timer_routing_profile" "custom_timers" {
9+
location = {
10+
template = {
11+
name = panos_template.multicast_template.name
12+
}
13+
}
14+
15+
name = "msdp-timer-profile-custom"
16+
connection_retry_interval = 15
17+
keep_alive_interval = 30
18+
message_timeout = 45
19+
}
20+
21+
# MSDP Timer Profile with default values
22+
resource "panos_multicast_msdp_timer_routing_profile" "default_timers" {
23+
location = {
24+
template = {
25+
name = panos_template.multicast_template.name
26+
}
27+
}
28+
29+
name = "msdp-timer-profile-default"
30+
# Uses default values:
31+
# connection_retry_interval = 30
32+
# keep_alive_interval = 60
33+
# message_timeout = 75
34+
}
35+
36+
# MSDP Timer Profile with maximum values
37+
resource "panos_multicast_msdp_timer_routing_profile" "max_timers" {
38+
location = {
39+
template = {
40+
name = panos_template.multicast_template.name
41+
}
42+
}
43+
44+
name = "msdp-timer-profile-max"
45+
connection_retry_interval = 60
46+
keep_alive_interval = 60
47+
message_timeout = 75
48+
}
49+
50+
# MSDP Timer Profile with minimum values
51+
resource "panos_multicast_msdp_timer_routing_profile" "min_timers" {
52+
location = {
53+
template = {
54+
name = panos_template.multicast_template.name
55+
}
56+
}
57+
58+
name = "msdp-timer-profile-min"
59+
connection_retry_interval = 1
60+
keep_alive_interval = 1
61+
message_timeout = 1
62+
}
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
package provider_test
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
"github.com/hashicorp/terraform-plugin-testing/config"
8+
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
9+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
10+
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
11+
"github.com/hashicorp/terraform-plugin-testing/statecheck"
12+
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
13+
)
14+
15+
func TestAccMulticastMsdpTimerRoutingProfile_Basic(t *testing.T) {
16+
t.Parallel()
17+
18+
nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
19+
prefix := fmt.Sprintf("test-acc-%s", nameSuffix)
20+
21+
location := config.ObjectVariable(map[string]config.Variable{
22+
"template": config.ObjectVariable(map[string]config.Variable{
23+
"name": config.StringVariable(prefix),
24+
}),
25+
})
26+
27+
resource.Test(t, resource.TestCase{
28+
PreCheck: func() { testAccPreCheck(t) },
29+
ProtoV6ProviderFactories: testAccProviders,
30+
Steps: []resource.TestStep{
31+
{
32+
Config: multicastMsdpTimerRoutingProfile_Basic_Tmpl,
33+
ConfigVariables: map[string]config.Variable{
34+
"prefix": config.StringVariable(prefix),
35+
"location": location,
36+
},
37+
ConfigStateChecks: []statecheck.StateCheck{
38+
statecheck.ExpectKnownValue(
39+
"panos_multicast_msdp_timer_routing_profile.example",
40+
tfjsonpath.New("name"),
41+
knownvalue.StringExact(prefix),
42+
),
43+
statecheck.ExpectKnownValue(
44+
"panos_multicast_msdp_timer_routing_profile.example",
45+
tfjsonpath.New("connection_retry_interval"),
46+
knownvalue.Int64Exact(15),
47+
),
48+
statecheck.ExpectKnownValue(
49+
"panos_multicast_msdp_timer_routing_profile.example",
50+
tfjsonpath.New("keep_alive_interval"),
51+
knownvalue.Int64Exact(30),
52+
),
53+
statecheck.ExpectKnownValue(
54+
"panos_multicast_msdp_timer_routing_profile.example",
55+
tfjsonpath.New("message_timeout"),
56+
knownvalue.Int64Exact(45),
57+
),
58+
},
59+
},
60+
},
61+
})
62+
}
63+
64+
const multicastMsdpTimerRoutingProfile_Basic_Tmpl = `
65+
variable "prefix" { type = string }
66+
variable "location" { type = any }
67+
68+
resource "panos_template" "example" {
69+
location = { panorama = {} }
70+
name = var.prefix
71+
}
72+
73+
resource "panos_multicast_msdp_timer_routing_profile" "example" {
74+
depends_on = [panos_template.example]
75+
location = var.location
76+
77+
name = var.prefix
78+
connection_retry_interval = 15
79+
keep_alive_interval = 30
80+
message_timeout = 45
81+
}
82+
`
83+
84+
func TestAccMulticastMsdpTimerRoutingProfile_MinValues(t *testing.T) {
85+
t.Parallel()
86+
87+
nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
88+
prefix := fmt.Sprintf("test-acc-%s", nameSuffix)
89+
90+
location := config.ObjectVariable(map[string]config.Variable{
91+
"template": config.ObjectVariable(map[string]config.Variable{
92+
"name": config.StringVariable(prefix),
93+
}),
94+
})
95+
96+
resource.Test(t, resource.TestCase{
97+
PreCheck: func() { testAccPreCheck(t) },
98+
ProtoV6ProviderFactories: testAccProviders,
99+
Steps: []resource.TestStep{
100+
{
101+
Config: multicastMsdpTimerRoutingProfile_MinValues_Tmpl,
102+
ConfigVariables: map[string]config.Variable{
103+
"prefix": config.StringVariable(prefix),
104+
"location": location,
105+
},
106+
ConfigStateChecks: []statecheck.StateCheck{
107+
statecheck.ExpectKnownValue(
108+
"panos_multicast_msdp_timer_routing_profile.example",
109+
tfjsonpath.New("name"),
110+
knownvalue.StringExact(prefix),
111+
),
112+
statecheck.ExpectKnownValue(
113+
"panos_multicast_msdp_timer_routing_profile.example",
114+
tfjsonpath.New("connection_retry_interval"),
115+
knownvalue.Int64Exact(1),
116+
),
117+
statecheck.ExpectKnownValue(
118+
"panos_multicast_msdp_timer_routing_profile.example",
119+
tfjsonpath.New("keep_alive_interval"),
120+
knownvalue.Int64Exact(1),
121+
),
122+
statecheck.ExpectKnownValue(
123+
"panos_multicast_msdp_timer_routing_profile.example",
124+
tfjsonpath.New("message_timeout"),
125+
knownvalue.Int64Exact(1),
126+
),
127+
},
128+
},
129+
},
130+
})
131+
}
132+
133+
const multicastMsdpTimerRoutingProfile_MinValues_Tmpl = `
134+
variable "prefix" { type = string }
135+
variable "location" { type = any }
136+
137+
resource "panos_template" "example" {
138+
location = { panorama = {} }
139+
name = var.prefix
140+
}
141+
142+
resource "panos_multicast_msdp_timer_routing_profile" "example" {
143+
depends_on = [panos_template.example]
144+
location = var.location
145+
146+
name = var.prefix
147+
connection_retry_interval = 1
148+
keep_alive_interval = 1
149+
message_timeout = 1
150+
}
151+
`
152+
153+
func TestAccMulticastMsdpTimerRoutingProfile_MaxValues(t *testing.T) {
154+
t.Parallel()
155+
156+
nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
157+
prefix := fmt.Sprintf("test-acc-%s", nameSuffix)
158+
159+
location := config.ObjectVariable(map[string]config.Variable{
160+
"template": config.ObjectVariable(map[string]config.Variable{
161+
"name": config.StringVariable(prefix),
162+
}),
163+
})
164+
165+
resource.Test(t, resource.TestCase{
166+
PreCheck: func() { testAccPreCheck(t) },
167+
ProtoV6ProviderFactories: testAccProviders,
168+
Steps: []resource.TestStep{
169+
{
170+
Config: multicastMsdpTimerRoutingProfile_MaxValues_Tmpl,
171+
ConfigVariables: map[string]config.Variable{
172+
"prefix": config.StringVariable(prefix),
173+
"location": location,
174+
},
175+
ConfigStateChecks: []statecheck.StateCheck{
176+
statecheck.ExpectKnownValue(
177+
"panos_multicast_msdp_timer_routing_profile.example",
178+
tfjsonpath.New("name"),
179+
knownvalue.StringExact(prefix),
180+
),
181+
statecheck.ExpectKnownValue(
182+
"panos_multicast_msdp_timer_routing_profile.example",
183+
tfjsonpath.New("connection_retry_interval"),
184+
knownvalue.Int64Exact(60),
185+
),
186+
statecheck.ExpectKnownValue(
187+
"panos_multicast_msdp_timer_routing_profile.example",
188+
tfjsonpath.New("keep_alive_interval"),
189+
knownvalue.Int64Exact(60),
190+
),
191+
statecheck.ExpectKnownValue(
192+
"panos_multicast_msdp_timer_routing_profile.example",
193+
tfjsonpath.New("message_timeout"),
194+
knownvalue.Int64Exact(75),
195+
),
196+
},
197+
},
198+
},
199+
})
200+
}
201+
202+
const multicastMsdpTimerRoutingProfile_MaxValues_Tmpl = `
203+
variable "prefix" { type = string }
204+
variable "location" { type = any }
205+
206+
resource "panos_template" "example" {
207+
location = { panorama = {} }
208+
name = var.prefix
209+
}
210+
211+
resource "panos_multicast_msdp_timer_routing_profile" "example" {
212+
depends_on = [panos_template.example]
213+
location = var.location
214+
215+
name = var.prefix
216+
connection_retry_interval = 60
217+
keep_alive_interval = 60
218+
message_timeout = 75
219+
}
220+
`
221+
222+
func TestAccMulticastMsdpTimerRoutingProfile_Defaults(t *testing.T) {
223+
t.Parallel()
224+
225+
nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
226+
prefix := fmt.Sprintf("test-acc-%s", nameSuffix)
227+
228+
location := config.ObjectVariable(map[string]config.Variable{
229+
"template": config.ObjectVariable(map[string]config.Variable{
230+
"name": config.StringVariable(prefix),
231+
}),
232+
})
233+
234+
resource.Test(t, resource.TestCase{
235+
PreCheck: func() { testAccPreCheck(t) },
236+
ProtoV6ProviderFactories: testAccProviders,
237+
Steps: []resource.TestStep{
238+
{
239+
Config: multicastMsdpTimerRoutingProfile_Defaults_Tmpl,
240+
ConfigVariables: map[string]config.Variable{
241+
"prefix": config.StringVariable(prefix),
242+
"location": location,
243+
},
244+
ConfigStateChecks: []statecheck.StateCheck{
245+
statecheck.ExpectKnownValue(
246+
"panos_multicast_msdp_timer_routing_profile.example",
247+
tfjsonpath.New("name"),
248+
knownvalue.StringExact(prefix),
249+
),
250+
statecheck.ExpectKnownValue(
251+
"panos_multicast_msdp_timer_routing_profile.example",
252+
tfjsonpath.New("connection_retry_interval"),
253+
knownvalue.Int64Exact(30),
254+
),
255+
statecheck.ExpectKnownValue(
256+
"panos_multicast_msdp_timer_routing_profile.example",
257+
tfjsonpath.New("keep_alive_interval"),
258+
knownvalue.Int64Exact(60),
259+
),
260+
statecheck.ExpectKnownValue(
261+
"panos_multicast_msdp_timer_routing_profile.example",
262+
tfjsonpath.New("message_timeout"),
263+
knownvalue.Int64Exact(75),
264+
),
265+
},
266+
},
267+
},
268+
})
269+
}
270+
271+
const multicastMsdpTimerRoutingProfile_Defaults_Tmpl = `
272+
variable "prefix" { type = string }
273+
variable "location" { type = any }
274+
275+
resource "panos_template" "example" {
276+
location = { panorama = {} }
277+
name = var.prefix
278+
}
279+
280+
resource "panos_multicast_msdp_timer_routing_profile" "example" {
281+
depends_on = [panos_template.example]
282+
location = var.location
283+
284+
name = var.prefix
285+
}
286+
`

0 commit comments

Comments
 (0)