Skip to content

Commit 2a82a9e

Browse files
authored
feat(specs): Add specs, tests and examples for ospf and ospfv3 routing profiles (#712)
1 parent b03edef commit 2a82a9e

31 files changed

Lines changed: 4185 additions & 0 deletions
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# An OSPF authentication routing profile can be imported by providing the following base64 encoded object as the ID
3+
4+
# Import from an NGFW device
5+
# {
6+
# location = {
7+
# ngfw = {
8+
# ngfw_device = "localhost.localdomain"
9+
# }
10+
# }
11+
#
12+
# name = "ospf-simple-password"
13+
# }
14+
terraform import panos_ospf_auth_routing_profile.example $(echo '{"location":{"ngfw":{"ngfw_device":"localhost.localdomain"}},"name":"ospf-simple-password"}' | base64)
15+
16+
# Import from a Panorama template
17+
# {
18+
# location = {
19+
# template = {
20+
# name = "ospf-routing-template"
21+
# panorama_device = "localhost.localdomain"
22+
# ngfw_device = "localhost.localdomain"
23+
# }
24+
# }
25+
#
26+
# name = "ospf-md5-auth"
27+
# }
28+
terraform import panos_ospf_auth_routing_profile.example $(echo '{"location":{"template":{"name":"ospf-routing-template","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospf-md5-auth"}' | base64)
29+
30+
# Import from a Panorama template stack
31+
# {
32+
# location = {
33+
# template_stack = {
34+
# name = "ospf-routing-stack"
35+
# panorama_device = "localhost.localdomain"
36+
# ngfw_device = "localhost.localdomain"
37+
# }
38+
# }
39+
#
40+
# name = "ospf-md5-auth"
41+
# }
42+
terraform import panos_ospf_auth_routing_profile.example $(echo '{"location":{"template_stack":{"name":"ospf-routing-stack","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospf-md5-auth"}' | base64)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Create a template for the OSPF routing configuration
2+
resource "panos_template" "ospf_template" {
3+
location = { panorama = {} }
4+
name = "ospf-routing-template"
5+
}
6+
7+
# OSPF Authentication Profile with MD5 authentication using multiple keys
8+
# This allows for key rotation - the preferred key is used for sending packets
9+
# while all keys can validate incoming packets
10+
resource "panos_ospf_auth_routing_profile" "md5_auth" {
11+
location = {
12+
template = {
13+
name = panos_template.ospf_template.name
14+
}
15+
}
16+
17+
name = "ospf-md5-auth"
18+
19+
md5 = [
20+
{
21+
name = "key-1"
22+
key = "SecureKey123456"
23+
preferred = true
24+
},
25+
{
26+
name = "key-2"
27+
key = "BackupKey987654"
28+
}
29+
]
30+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Create a template for the OSPF routing configuration
2+
resource "panos_template" "ospf_password_template" {
3+
location = { panorama = {} }
4+
name = "ospf-password-template"
5+
}
6+
7+
# OSPF Authentication Profile with simple password authentication
8+
resource "panos_ospf_auth_routing_profile" "password_auth" {
9+
location = {
10+
template = {
11+
name = panos_template.ospf_password_template.name
12+
}
13+
}
14+
15+
name = "ospf-simple-password"
16+
password = "Palo@123"
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Create a template
2+
resource "panos_template" "ospf_simple_template" {
3+
location = { panorama = {} }
4+
name = "ospf-simple-template"
5+
}
6+
7+
# OSPF Authentication Profile using simple password
8+
resource "panos_ospf_auth_routing_profile" "simple_password" {
9+
location = {
10+
template = {
11+
name = panos_template.ospf_simple_template.name
12+
}
13+
}
14+
15+
name = "ospf-simple-auth"
16+
password = "ospf-pass"
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# Import an OSPF interface timer routing profile from a template
3+
location='{"template":{"name":"ospf-routing-template","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}}'
4+
encoded_location=$(echo -n "$location" | base64)
5+
terraform import "panos_ospf_interface_timer_routing_profile.custom_timers" "$encoded_location:custom-if-timer-profile"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Create a template
2+
resource "panos_template" "ospf_template" {
3+
location = { panorama = {} }
4+
name = "ospf-routing-template"
5+
}
6+
7+
# OSPF Interface Timer Profile with custom timer values
8+
resource "panos_ospf_interface_timer_routing_profile" "custom_timers" {
9+
location = {
10+
template = {
11+
name = panos_template.ospf_template.name
12+
}
13+
}
14+
15+
name = "custom-if-timer-profile"
16+
hello_interval = 30
17+
dead_counts = 4
18+
retransmit_interval = 10
19+
transit_delay = 2
20+
gr_delay = 5
21+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# An OSPF redistribution routing profile can be imported by providing the following base64 encoded object as the ID
2+
3+
# Import from an NGFW device
4+
# {
5+
# location = {
6+
# ngfw = {
7+
# ngfw_device = "localhost.localdomain"
8+
# }
9+
# }
10+
#
11+
# name = "ospf-redistribute-connected"
12+
# }
13+
terraform import panos_ospf_redistribution_routing_profile.example $(echo '{"location":{"ngfw":{"ngfw_device":"localhost.localdomain"}},"name":"ospf-redistribute-connected"}' | base64)
14+
15+
# Import from a Panorama template
16+
# {
17+
# location = {
18+
# template = {
19+
# name = "ospf-routing-template"
20+
# panorama_device = "localhost.localdomain"
21+
# ngfw_device = "localhost.localdomain"
22+
# }
23+
# }
24+
#
25+
# name = "ospf-redistribute-connected"
26+
# }
27+
terraform import panos_ospf_redistribution_routing_profile.example $(echo '{"location":{"template":{"name":"ospf-routing-template","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospf-redistribute-connected"}' | base64)
28+
29+
# Import from a Panorama template stack
30+
# {
31+
# location = {
32+
# template_stack = {
33+
# name = "ospf-routing-stack"
34+
# panorama_device = "localhost.localdomain"
35+
# ngfw_device = "localhost.localdomain"
36+
# }
37+
# }
38+
#
39+
# name = "ospf-redistribute-connected"
40+
# }
41+
terraform import panos_ospf_redistribution_routing_profile.example $(echo '{"location":{"template_stack":{"name":"ospf-routing-stack","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospf-redistribute-connected"}' | base64)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Create a template for OSPF redistribution profiles
2+
resource "panos_template" "ospf_template" {
3+
location = { panorama = {} }
4+
name = "ospf-routing-template"
5+
}
6+
7+
# Redistribute connected routes into OSPF with basic configuration
8+
resource "panos_ospf_redistribution_routing_profile" "connected" {
9+
location = {
10+
template = {
11+
name = panos_template.ospf_template.name
12+
}
13+
}
14+
15+
name = "ospf-redistribute-connected"
16+
17+
connected = {
18+
enable = true
19+
metric = 10
20+
metric_type = "type-1"
21+
}
22+
}
23+
24+
# Redistribute BGP routes into OSPF with type-2 metric
25+
resource "panos_ospf_redistribution_routing_profile" "bgp" {
26+
location = {
27+
template = {
28+
name = panos_template.ospf_template.name
29+
}
30+
}
31+
32+
name = "ospf-redistribute-bgp"
33+
34+
bgp = {
35+
enable = true
36+
metric = 100
37+
metric_type = "type-2"
38+
}
39+
}
40+
41+
# Redistribute static routes with route-map filtering
42+
resource "panos_ospf_redistribution_routing_profile" "static_with_map" {
43+
location = {
44+
template = {
45+
name = panos_template.ospf_template.name
46+
}
47+
}
48+
49+
name = "ospf-redistribute-static-filtered"
50+
51+
static = {
52+
enable = true
53+
route_map = "static-route-filter"
54+
# Note: metric and metric_type are ignored when route_map is configured
55+
}
56+
}
57+
58+
# Redistribute multiple sources into OSPF with different configurations
59+
resource "panos_ospf_redistribution_routing_profile" "multiple" {
60+
location = {
61+
template = {
62+
name = panos_template.ospf_template.name
63+
}
64+
}
65+
66+
name = "ospf-redistribute-multiple"
67+
68+
connected = {
69+
enable = true
70+
metric = 10
71+
metric_type = "type-1"
72+
}
73+
74+
static = {
75+
enable = true
76+
metric = 20
77+
metric_type = "type-1"
78+
}
79+
80+
bgp = {
81+
enable = true
82+
metric = 100
83+
metric_type = "type-2"
84+
}
85+
86+
rip = {
87+
enable = true
88+
metric = 50
89+
metric_type = "type-2"
90+
route_map = "rip-filter-map"
91+
}
92+
}
93+
94+
# Default route redistribution with always option
95+
# The 'always' option generates a default route even if one doesn't exist
96+
resource "panos_ospf_redistribution_routing_profile" "default_route" {
97+
location = {
98+
template = {
99+
name = panos_template.ospf_template.name
100+
}
101+
}
102+
103+
name = "ospf-redistribute-default"
104+
105+
default_route = {
106+
enable = true
107+
always = true
108+
metric = 1
109+
metric_type = "type-1"
110+
}
111+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Create a template
2+
resource "panos_template" "ospf_template" {
3+
location = { panorama = {} }
4+
name = "ospf-routing-template"
5+
}
6+
7+
# OSPF SPF Timer Profile with custom timing values
8+
resource "panos_ospf_spf_timer_routing_profile" "custom_timers" {
9+
location = {
10+
template = {
11+
name = panos_template.ospf_template.name
12+
}
13+
}
14+
15+
name = "custom-spf-timer-profile"
16+
spf_calculation_delay = 10
17+
initial_hold_time = 15
18+
max_hold_time = 30
19+
lsa_interval = 8
20+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# An OSPFv3 auth routing profile can be imported by providing the following base64 encoded object as the ID
2+
3+
# Import from an NGFW device
4+
# {
5+
# location = {
6+
# ngfw = {
7+
# ngfw_device = "localhost.localdomain"
8+
# }
9+
# }
10+
#
11+
# name = "ospfv3-ah-sha256-profile"
12+
# }
13+
terraform import panos_ospfv3_auth_routing_profile.example $(echo '{"location":{"ngfw":{"ngfw_device":"localhost.localdomain"}},"name":"ospfv3-ah-sha256-profile"}' | base64)
14+
15+
# Import from a Panorama template
16+
# {
17+
# location = {
18+
# template = {
19+
# name = "my-template"
20+
# panorama_device = "localhost.localdomain"
21+
# ngfw_device = "localhost.localdomain"
22+
# }
23+
# }
24+
#
25+
# name = "ospfv3-esp-secure-profile"
26+
# }
27+
terraform import panos_ospfv3_auth_routing_profile.example $(echo '{"location":{"template":{"name":"my-template","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospfv3-esp-secure-profile"}' | base64)
28+
29+
# Import from a Panorama template stack
30+
# {
31+
# location = {
32+
# template_stack = {
33+
# name = "my-template-stack"
34+
# panorama_device = "localhost.localdomain"
35+
# ngfw_device = "localhost.localdomain"
36+
# }
37+
# }
38+
#
39+
# name = "ospfv3-esp-encrypt-only"
40+
# }
41+
terraform import panos_ospfv3_auth_routing_profile.example $(echo '{"location":{"template_stack":{"name":"my-template-stack","panorama_device":"localhost.localdomain","ngfw_device":"localhost.localdomain"}},"name":"ospfv3-esp-encrypt-only"}' | base64)

0 commit comments

Comments
 (0)