diff --git a/assets/pango/example/main.go b/assets/pango/example/main.go index 9d9e19f0..3a7df687 100644 --- a/assets/pango/example/main.go +++ b/assets/pango/example/main.go @@ -195,35 +195,6 @@ func checkVr(c *pango.Client, ctx context.Context) { Enable: util.Bool(false), }, }, - RoutingTable: &virtual_router.RoutingTable{ - // Ip: &virtual_router.RoutingTableIp{ - // StaticRoutes: []virtual_router.RoutingTableIpStaticRoutes{ - // { - // Name: "default", - // Destination: util.String("0.0.0.0/0"), - // Interface: util.String("ethernet1/2"), - // NextHop: &virtual_router.RoutingTableIpStaticRoutesNextHop{ - // IpAddress: util.String("1.1.1.1"), - // }, - // Metric: util.Int(64), - // AdminDist: util.Int(120), - // }, - // }, - // }, - // Ipv6: &virtual_router.RoutingTableIpv6{ - // StaticRoutes: []virtual_router.RoutingTableIpv6StaticRoutes{ - // { - // Name: "default", - // Destination: util.String("0.0.0.0/0"), - // NextHop: &virtual_router.RoutingTableIpv6StaticRoutesNextHop{ - // Ipv6Address: util.String("2001:0000:130F:0000:0000:09C0:876A:230D"), - // }, - // Metric: util.Int(24), - // AdminDist: util.Int(20), - // }, - // }, - // }, - }, Ecmp: &virtual_router.Ecmp{ Enable: util.Bool(true), SymmetricReturn: util.Bool(true), diff --git a/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv4/resource.tf b/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv4/resource.tf new file mode 100644 index 00000000..80613637 --- /dev/null +++ b/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv4/resource.tf @@ -0,0 +1,86 @@ +resource "panos_template" "example" { + location = { panorama = {} } + name = "example" +} + +resource "panos_ethernet_interface" "example" { + location = { + template = { + name = panos_template.example.name + } + } + name = "ethernet1/1" + layer3 = { + ips = [{ name = "192.168.1.1/32" }] + } +} + +resource "panos_virtual_router" "example" { + location = { + template = { + name = panos_template.example.name + } + } + name = "example-vr1" + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + location = { + template = { + name = panos_template.example.name + } + } + name = "example-vr2" +} + +resource "panos_virtual_router_static_route_ipv4" "vr1-example-route1" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example.name + name = "example-route" + admin_dist = 15 + destination = "192.168.2.0/24" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ip_address = "192.168.1.254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "192.168.1.1/32" + destination = "192.168.1.254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } +} + +resource "panos_virtual_router_static_route_ipv4" "vr2-example-route1" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example2.name + name = "example-route" + destination = "192.168.1.0/24" + + nexthop = { + next_vr = panos_virtual_router.example.name + } +} diff --git a/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv6/resource.tf b/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv6/resource.tf new file mode 100644 index 00000000..7335fabc --- /dev/null +++ b/assets/terraform/examples/resources/panos_virtual_router_static_route_ipv6/resource.tf @@ -0,0 +1,71 @@ +resource "panos_template" "example" { + location = { panorama = {} } + name = "example-template" +} + +resource "panos_ethernet_interface" "example" { + location = panos_template.example.location + name = "ethernet1/1" + layer3 = { + ipv6 = { + enabled = true + addresses = [{ name = "2001:db8:1::1/64" }] + } + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + location = panos_template.example.location + name = "example-vr1" + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + location = panos_template.example.location + name = "example-vr2" +} + +resource "panos_virtual_router_static_route_ipv6" "example" { + location = panos_template.example.location + virtual_router = panos_virtual_router.example.name + name = "example-route" + admin_dist = 15 + destination = "2001:db8:2::/64" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ipv6_address = "2001:db8:1::254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "2001:db8:1::1/64" + destination = "2001:db8:1::254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } +} + +resource "panos_virtual_router_static_route_ipv6" "example2" { + location = panos_template.example.location + virtual_router = panos_virtual_router.example2.name + name = "example-route2" + destination = "2001:db8:1::/64" + + nexthop = { + next_vr = panos_virtual_router.example.name + } +} diff --git a/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv4/resource.tf b/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv4/resource.tf new file mode 100644 index 00000000..de92f1ad --- /dev/null +++ b/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv4/resource.tf @@ -0,0 +1,88 @@ +resource "panos_template" "example" { + location = { panorama = {} } + name = "example-template" +} + +resource "panos_ethernet_interface" "example" { + location = { + template = { + name = panos_template.example.name + } + } + name = "ethernet1/1" + layer3 = { + ips = [{ name = "192.168.1.1/32" }] + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + location = { + template = { + name = panos_template.example.name + } + } + name = "example-vr1" + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + location = { + template = { + name = panos_template.example.name + } + } + name = "example-vr2" +} + +resource "panos_virtual_router_static_routes_ipv4" "example" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example.name + static_routes = [{ + name = "example-route" + admin_dist = 15 + destination = "192.168.2.0/24" + interface = panos_ethernet_interface.example.name + metric = 100 + nexthop = { + ip_address = "192.168.1.254" + } + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "192.168.1.1/32" + destination = "192.168.1.254" + interval = 3 + count = 5 + }] + } + route_table = { + unicast = {} + } + }] +} + +resource "panos_virtual_router_static_routes_ipv4" "example2" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example2.name + static_routes = [{ + name = "example-route" + destination = "192.168.1.0/24" + nexthop = { + next_vr = panos_virtual_router.example.name + } + }] +} diff --git a/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv6/resource.tf b/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv6/resource.tf new file mode 100644 index 00000000..c14eca41 --- /dev/null +++ b/assets/terraform/examples/resources/panos_virtual_router_static_routes_ipv6/resource.tf @@ -0,0 +1,93 @@ +resource "panos_template" "example" { + location = { panorama = {} } + name = "template-example" +} + +resource "panos_ethernet_interface" "example" { + location = { + template = { + name = panos_template.example.name + } + } + name = "ethernet1/1" + layer3 = { + ipv6 = { + enabled = true + addresses = [{ + name = "2001:db8:1::1/64" + }] + } + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + location = { + template = { + name = panos_template.example.name + } + } + name = "vr1" + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + location = { + template = { + name = panos_template.example.name + } + } + name = "vr2" +} + +resource "panos_virtual_router_static_routes_ipv6" "example" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example.name + static_routes = [{ + name = "route1" + admin_dist = 15 + destination = "2001:db8:2::/64" + interface = panos_ethernet_interface.example.name + metric = 100 + nexthop = { + ipv6_address = "2001:db8:1::254" + } + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "2001:db8:1::1/64" + destination = "2001:db8:1::254" + interval = 3 + count = 5 + }] + } + route_table = { + unicast = {} + } + }] +} + +resource "panos_virtual_router_static_routes_ipv6" "example2" { + location = { + template = { + name = panos_template.example.name + } + } + virtual_router = panos_virtual_router.example2.name + static_routes = [{ + name = "route2" + destination = "2001:db8:1::/64" + nexthop = { + next_vr = panos_virtual_router.example.name + } + }] +} diff --git a/assets/terraform/test/resource_virtual_router_static_route_ipv4_test.go b/assets/terraform/test/resource_virtual_router_static_route_ipv4_test.go new file mode 100644 index 00000000..0d47d49f --- /dev/null +++ b/assets/terraform/test/resource_virtual_router_static_route_ipv4_test.go @@ -0,0 +1,209 @@ +package provider_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/config" + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + //"github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccVirtualRouterStaticRouteIpv4(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum) + prefix := fmt.Sprintf("test-acc-%s", nameSuffix) + + location := config.ObjectVariable(map[string]config.Variable{ + "template": config.ObjectVariable(map[string]config.Variable{ + "name": config.StringVariable(prefix), + }), + }) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProviders, + Steps: []resource.TestStep{ + { + Config: virtualRouterStaticRouteIpv4Tmpl1, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("admin_dist"), + knownvalue.Int64Exact(15), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("destination"), + knownvalue.StringExact("192.168.2.0/24"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("interface"), + knownvalue.StringExact("ethernet1/1"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("metric"), + knownvalue.Int64Exact(100), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.StringExact("192.168.1.254"), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("path_monitor"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "enable": knownvalue.Bool(true), + "failure_condition": knownvalue.StringExact("any"), + "hold_time": knownvalue.Int64Exact(2), + "monitor_destinations": knownvalue.ListExact([]knownvalue.Check{ + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "name": knownvalue.StringExact("dest-1"), + "enable": knownvalue.Bool(true), + "source": knownvalue.StringExact("192.168.1.1/32"), + "destination": knownvalue.StringExact("192.168.1.254"), + "interval": knownvalue.Int64Exact(3), + "count": knownvalue.Int64Exact(5), + }), + }), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example", + tfjsonpath.New("route_table"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "unicast": knownvalue.MapExact(map[string]knownvalue.Check{}), + "both": knownvalue.Null(), + "multicast": knownvalue.Null(), + "no_install": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv4.example2", + tfjsonpath.New("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + }, + }) +} + +const virtualRouterStaticRouteIpv4Tmpl1 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ips = [{name = "192.168.1.1/32"}] + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_route_ipv4" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + name = var.prefix + + admin_dist = 15 + destination = "192.168.2.0/24" + interface = panos_ethernet_interface.example.name + metric = 100 + + #bfd = { + # profile = "BFD-profile" + #} + + nexthop = { + ip_address = "192.168.1.254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "192.168.1.1/32" + destination = "192.168.1.254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } +} + +resource "panos_virtual_router_static_route_ipv4" "example2" { + location = var.location + + virtual_router = panos_virtual_router.example2.name + + name = var.prefix + + destination = "192.168.1.0/24" + + nexthop = { + next_vr = panos_virtual_router.example.name + } +} +` diff --git a/assets/terraform/test/resource_virtual_router_static_route_ipv6_test.go b/assets/terraform/test/resource_virtual_router_static_route_ipv6_test.go new file mode 100644 index 00000000..bb97afd3 --- /dev/null +++ b/assets/terraform/test/resource_virtual_router_static_route_ipv6_test.go @@ -0,0 +1,201 @@ +package provider_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/config" + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccVirtualRouterStaticRouteIpv6(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum) + prefix := fmt.Sprintf("test-acc-%s", nameSuffix) + + location := config.ObjectVariable(map[string]config.Variable{ + "template": config.ObjectVariable(map[string]config.Variable{ + "name": config.StringVariable(prefix), + }), + }) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProviders, + Steps: []resource.TestStep{ + { + Config: virtualRouterStaticRouteIpv6Tmpl1, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("admin_dist"), + knownvalue.Int64Exact(15), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("destination"), + knownvalue.StringExact("2001:db8:2::/64"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("interface"), + knownvalue.StringExact("ethernet1/1"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("metric"), + knownvalue.Int64Exact(100), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.StringExact("2001:db8:1::254"), + "discard": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("path_monitor"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "enable": knownvalue.Bool(true), + "failure_condition": knownvalue.StringExact("any"), + "hold_time": knownvalue.Int64Exact(2), + "monitor_destinations": knownvalue.ListExact([]knownvalue.Check{ + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "name": knownvalue.StringExact("dest-1"), + "enable": knownvalue.Bool(true), + "source": knownvalue.StringExact("2001:db8:1::1/64"), + "destination": knownvalue.StringExact("2001:db8:1::254"), + "interval": knownvalue.Int64Exact(3), + "count": knownvalue.Int64Exact(5), + }), + }), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example", + tfjsonpath.New("route_table"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "unicast": knownvalue.MapExact(map[string]knownvalue.Check{}), + "no_install": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_route_ipv6.example2", + tfjsonpath.New("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + }, + }) +} + +const virtualRouterStaticRouteIpv6Tmpl1 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ipv6 = { + enabled = true + addresses = [{name = "2001:db8:1::1/64"}] + } + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_route_ipv6" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + name = var.prefix + admin_dist = 15 + destination = "2001:db8:2::/64" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ipv6_address = "2001:db8:1::254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "2001:db8:1::1/64" + destination = "2001:db8:1::254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } +} + +resource "panos_virtual_router_static_route_ipv6" "example2" { + location = var.location + + virtual_router = panos_virtual_router.example2.name + + name = var.prefix + destination = "2001:db8:1::/64" + + nexthop = { + next_vr = panos_virtual_router.example.name + } +} +` diff --git a/assets/terraform/test/resource_virtual_router_static_routes_ipv4_test.go b/assets/terraform/test/resource_virtual_router_static_routes_ipv4_test.go new file mode 100644 index 00000000..7a3bcd20 --- /dev/null +++ b/assets/terraform/test/resource_virtual_router_static_routes_ipv4_test.go @@ -0,0 +1,382 @@ +package provider_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/config" + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + //"github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccVirtualRouterStaticRoutesIpv4(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum) + prefix := fmt.Sprintf("test-acc-%s", nameSuffix) + + location := config.ObjectVariable(map[string]config.Variable{ + "template": config.ObjectVariable(map[string]config.Variable{ + "name": config.StringVariable(prefix), + }), + }) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProviders, + Steps: []resource.TestStep{ + { + Config: virtualRouterStaticRoutesIpv4Tmpl1, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("virtual_router"), + knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example2", + tfjsonpath.New("virtual_router"), + knownvalue.StringExact(fmt.Sprintf("%s-vr2", prefix)), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example2", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("admin_dist"), + knownvalue.Int64Exact(15), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("destination"), + knownvalue.StringExact("192.168.2.0/24"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("interface"), + knownvalue.StringExact("ethernet1/1"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("metric"), + knownvalue.Int64Exact(100), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.StringExact("192.168.1.254"), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("path_monitor"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "enable": knownvalue.Bool(true), + "failure_condition": knownvalue.StringExact("any"), + "hold_time": knownvalue.Int64Exact(2), + "monitor_destinations": knownvalue.ListExact([]knownvalue.Check{ + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "name": knownvalue.StringExact("dest-1"), + "enable": knownvalue.Bool(true), + "source": knownvalue.StringExact("192.168.1.1/32"), + "destination": knownvalue.StringExact("192.168.1.254"), + "interval": knownvalue.Int64Exact(3), + "count": knownvalue.Int64Exact(5), + }), + }), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("route_table"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "unicast": knownvalue.MapExact(map[string]knownvalue.Check{}), + "both": knownvalue.Null(), + "multicast": knownvalue.Null(), + "no_install": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example2", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + { + Config: virtualRouterStaticRoutesIpv4Tmpl2, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("name"), + knownvalue.StringExact("default"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("admin_dist"), + knownvalue.Int64Exact(20), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("destination"), + knownvalue.StringExact("192.168.2.0/24"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.StringExact("192.168.1.254"), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("destination"), + knownvalue.StringExact("0.0.0.0/0"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv4.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ip_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "fqdn": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr2", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + }, + }) +} + +const virtualRouterStaticRoutesIpv4Tmpl1 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ips = [{name = "192.168.1.1/32"}] + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_routes_ipv4" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + static_routes = [{ + name = var.prefix + admin_dist = 15 + destination = "192.168.2.0/24" + interface = panos_ethernet_interface.example.name + metric = 100 + + #bfd = { + # profile = "BFD-profile" + #} + + nexthop = { + ip_address = "192.168.1.254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "192.168.1.1/32" + destination = "192.168.1.254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } + }] +} + +resource "panos_virtual_router_static_routes_ipv4" "example2" { + location = var.location + + virtual_router = panos_virtual_router.example2.name + + static_routes = [{ + name = var.prefix + destination = "192.168.1.0/24" + + nexthop = { + next_vr = panos_virtual_router.example.name + } + }] +} +` + +const virtualRouterStaticRoutesIpv4Tmpl2 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ips = [{name = "192.168.1.1/32"}] + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_routes_ipv4" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + static_routes = [ + { + name = var.prefix + admin_dist = 20 + destination = "192.168.2.0/24" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ip_address = "192.168.1.254" + } + }, + { + name = "default" + destination = "0.0.0.0/0" + nexthop = { + next_vr = panos_virtual_router.example2.name + } + } + ] +} +` diff --git a/assets/terraform/test/resource_virtual_router_static_routes_ipv6_test.go b/assets/terraform/test/resource_virtual_router_static_routes_ipv6_test.go new file mode 100644 index 00000000..35838e4d --- /dev/null +++ b/assets/terraform/test/resource_virtual_router_static_routes_ipv6_test.go @@ -0,0 +1,377 @@ +package provider_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/config" + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccVirtualRouterStaticRoutesIpv6(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum) + prefix := fmt.Sprintf("test-acc-%s", nameSuffix) + + location := config.ObjectVariable(map[string]config.Variable{ + "template": config.ObjectVariable(map[string]config.Variable{ + "name": config.StringVariable(prefix), + }), + }) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProviders, + Steps: []resource.TestStep{ + { + Config: virtualRouterStaticRoutesIpv6Tmpl1, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("virtual_router"), + knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example2", + tfjsonpath.New("virtual_router"), + knownvalue.StringExact(fmt.Sprintf("%s-vr2", prefix)), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example2", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("admin_dist"), + knownvalue.Int64Exact(15), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("destination"), + knownvalue.StringExact("2001:db8:2::/64"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("interface"), + knownvalue.StringExact("ethernet1/1"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("metric"), + knownvalue.Int64Exact(100), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.StringExact("2001:db8:1::254"), + "discard": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("path_monitor"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "enable": knownvalue.Bool(true), + "failure_condition": knownvalue.StringExact("any"), + "hold_time": knownvalue.Int64Exact(2), + "monitor_destinations": knownvalue.ListExact([]knownvalue.Check{ + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "name": knownvalue.StringExact("dest-1"), + "enable": knownvalue.Bool(true), + "source": knownvalue.StringExact("2001:db8:1::1/64"), + "destination": knownvalue.StringExact("2001:db8:1::254"), + "interval": knownvalue.Int64Exact(3), + "count": knownvalue.Int64Exact(5), + }), + }), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("route_table"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "unicast": knownvalue.MapExact(map[string]knownvalue.Check{}), + "no_install": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example2", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr1", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + { + Config: virtualRouterStaticRoutesIpv6Tmpl2, + ConfigVariables: map[string]config.Variable{ + "location": location, + "prefix": config.StringVariable(prefix), + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("name"), + knownvalue.StringExact(prefix), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("name"), + knownvalue.StringExact("default"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("admin_dist"), + knownvalue.Int64Exact(20), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("destination"), + knownvalue.StringExact("2001:db8:2::/64"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(0). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.StringExact("2001:db8:1::254"), + "discard": knownvalue.Null(), + "next_vr": knownvalue.Null(), + "receive": knownvalue.Null(), + }), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("destination"), + knownvalue.StringExact("::/0"), + ), + statecheck.ExpectKnownValue( + "panos_virtual_router_static_routes_ipv6.example", + tfjsonpath.New("static_routes"). + AtSliceIndex(1). + AtMapKey("nexthop"), + knownvalue.ObjectExact(map[string]knownvalue.Check{ + "ipv6_address": knownvalue.Null(), + "discard": knownvalue.Null(), + "next_vr": knownvalue.StringExact(fmt.Sprintf("%s-vr2", prefix)), + "receive": knownvalue.Null(), + }), + ), + }, + }, + }, + }) +} + +const virtualRouterStaticRoutesIpv6Tmpl1 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ipv6 = { + enabled = true + addresses = [{name = "2001:db8:1::1/64"}] + } + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_routes_ipv6" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + static_routes = [{ + name = var.prefix + admin_dist = 15 + destination = "2001:db8:2::/64" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ipv6_address = "2001:db8:1::254" + } + + path_monitor = { + enable = true + failure_condition = "any" + hold_time = 2 + monitor_destinations = [{ + name = "dest-1" + enable = true + source = "2001:db8:1::1/64" + destination = "2001:db8:1::254" + interval = 3 + count = 5 + }] + } + + route_table = { + unicast = {} + } + }] +} + +resource "panos_virtual_router_static_routes_ipv6" "example2" { + location = var.location + + virtual_router = panos_virtual_router.example2.name + + static_routes = [{ + name = var.prefix + destination = "2001:db8:1::/64" + + nexthop = { + next_vr = panos_virtual_router.example.name + } + }] +} +` + +const virtualRouterStaticRoutesIpv6Tmpl2 = ` +variable "location" { type = any } +variable "prefix" { type = string } + +resource "panos_template" "example" { + location = { panorama = {} } + + name = var.prefix +} + +resource "panos_ethernet_interface" "example" { + location = var.location + + name = "ethernet1/1" + + layer3 = { + ipv6 = { + enabled = true + addresses = [{name = "2001:db8:1::1/64"}] + } + } +} + +resource "panos_virtual_router" "example" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr1", var.prefix) + + interfaces = [panos_ethernet_interface.example.name] +} + +resource "panos_virtual_router" "example2" { + depends_on = [panos_template.example] + + location = var.location + + name = format("%s-vr2", var.prefix) +} + +resource "panos_virtual_router_static_routes_ipv6" "example" { + location = var.location + + virtual_router = panos_virtual_router.example.name + + static_routes = [ + { + name = var.prefix + admin_dist = 20 + destination = "2001:db8:2::/64" + interface = panos_ethernet_interface.example.name + metric = 100 + + nexthop = { + ipv6_address = "2001:db8:1::254" + } + }, + { + name = "default" + destination = "::/0" + nexthop = { + next_vr = panos_virtual_router.example2.name + } + } + ] +} +` diff --git a/specs/network/virtual-router-static-route-ipv4.yaml b/specs/network/virtual-router-static-route-ipv4.yaml new file mode 100644 index 00000000..86e1b3dc --- /dev/null +++ b/specs/network/virtual-router-static-route-ipv4.yaml @@ -0,0 +1,463 @@ +name: Virtual Router IPv4 Static Route +terraform_provider_config: + description: Virtual Router + skip_resource: false + skip_datasource: false + resource_type: entry + resource_variants: + - singular + - plural + suffix: virtual_router_static_route_ipv4 + plural_suffix: virtual_router_static_routes_ipv4 + plural_name: static-routes + plural_description: "" + plural_type: list +go_sdk_config: + skip: false + package: + - network + - virtual_router + - ipv4 + - staticroute +panos_xpath: + path: + - network + - virtual-router + - $parent + - routing-table + - ip + - static-route + - $name + vars: + - name: parent + spec: + type: entry + xpath: /params[@name="virtual-router"] + - name: name + spec: + type: entry + xpath: /params[@name="name"] +locations: + - name: ngfw + xpath: + path: + - config + - devices + - $ngfw_device + vars: + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific NGFW device + devices: + - ngfw + validators: [] + required: false + read_only: false + - name: template + xpath: + path: + - config + - devices + - $panorama_device + - template + - $template + - config + - devices + - $ngfw_device + vars: + - name: panorama_device + description: Specific Panorama device + required: false + default: localhost.localdomain + validators: [] + type: entry + - name: template + description: Specific Panorama template + required: true + validators: [] + type: entry + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific template + devices: + - panorama + validators: [] + required: false + read_only: false + - name: template-stack + xpath: + path: + - config + - devices + - $panorama_device + - template-stack + - $template_stack + - config + - devices + - $ngfw_device + vars: + - name: panorama_device + description: Specific Panorama device + required: false + default: localhost.localdomain + validators: [] + type: entry + - name: template_stack + description: Specific Panorama template stack + required: true + validators: [] + type: entry + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific template stack + devices: + - panorama + validators: [] + required: false + read_only: false +entries: + - name: name + description: "" + validators: [] +imports: [] +spec: + params: + - name: virtual-router + type: string + profiles: + - xpath: [] + codegen_overrides: + gosdk: + skip: true + terraform: + xpath_variable: virtual-router + - name: admin-dist + type: int64 + profiles: + - xpath: + - admin-dist + validators: + - type: length + spec: + min: 10 + max: 240 + spec: {} + description: adminitrative distance + required: false + - name: bfd + type: object + profiles: + - xpath: + - bfd + validators: [] + spec: + params: + - name: profile + type: string + profiles: + - xpath: + - profile + validators: [] + spec: + default: None + description: BFD profile + required: false + variants: [] + description: BFD configuration + required: false + - name: destination + type: string + profiles: + - xpath: + - destination + validators: [] + spec: {} + description: Destination IP address/prefix + required: false + - name: interface + type: string + profiles: + - xpath: + - interface + validators: [] + spec: {} + description: "" + required: false + - name: metric + type: int64 + profiles: + - xpath: + - metric + validators: + - type: length + spec: + min: 1 + max: 65535 + spec: + default: 10 + description: metric value (path cost) + required: false + - name: nexthop + type: object + profiles: + - xpath: + - nexthop + validators: [] + spec: + params: [] + variants: + - name: discard + type: object + profiles: + - xpath: + - discard + validators: [] + spec: + params: [] + variants: [] + description: Discard packet + required: false + - name: fqdn + type: string + profiles: + - xpath: + - fqdn + validators: + - type: length + spec: + max: 255 + spec: {} + description: nexthop address FQDN address object configuration + required: false + - name: ip-address + type: string + profiles: + - xpath: + - ip-address + validators: [] + spec: {} + description: Next hop IP address + required: false + - name: next-vr + type: string + profiles: + - xpath: + - next-vr + validators: [] + spec: {} + description: Next hop virtual router + required: false + - name: receive + type: object + profiles: + - xpath: + - receive + validators: [] + spec: + params: [] + variants: [] + description: Forward packet to host + required: false + description: Next hop to destination + required: false + - name: path-monitor + type: object + profiles: + - xpath: + - path-monitor + validators: [] + spec: + params: + - name: enable + type: bool + profiles: + - xpath: + - enable + validators: [] + spec: {} + description: "" + required: false + - name: failure-condition + type: enum + profiles: + - xpath: + - failure-condition + validators: + - type: values + spec: + values: + - any + - all + spec: + default: any + values: + - value: any + - value: all + description: failure condition + required: false + - name: hold-time + type: int64 + profiles: + - xpath: + - hold-time + validators: + - type: length + spec: + min: 0 + max: 1440 + spec: + default: 2 + description: hold time (minutes) + required: false + - name: monitor-destinations + type: list + profiles: + - xpath: + - monitor-destinations + - entry + type: entry + validators: [] + spec: + type: object + items: + type: object + spec: + params: + - name: enable + type: bool + profiles: + - xpath: + - enable + validators: [] + spec: {} + description: "" + required: false + - name: source + type: string + profiles: + - xpath: + - source + validators: [] + spec: {} + description: Source IP address + required: false + - name: destination + type: string + profiles: + - xpath: + - destination + validators: + - type: length + spec: + max: 63 + spec: {} + description: Destination IP address + required: false + - name: interval + type: int64 + profiles: + - xpath: + - interval + validators: + - type: length + spec: + min: 1 + max: 60 + spec: + default: 3 + description: ping interval + required: false + - name: count + type: int64 + profiles: + - xpath: + - count + validators: + - type: length + spec: + min: 3 + max: 10 + spec: + default: 5 + description: ping count + required: false + variants: [] + description: "" + required: false + variants: [] + description: Static Route Path Monitoring + required: false + - name: route-table + type: object + profiles: + - xpath: + - route-table + validators: [] + spec: + params: [] + variants: + - name: both + type: object + profiles: + - xpath: + - both + validators: [] + spec: + params: [] + variants: [] + description: Install route into both unicast and multicast routing table + required: false + variant_group_id: 0 + - name: multicast + type: object + profiles: + - xpath: + - multicast + validators: [] + spec: + params: [] + variants: [] + description: + Install route into multicast routing table, this will create + multicast routing table if not exists + required: false + variant_group_id: 0 + - name: no-install + type: object + profiles: + - xpath: + - no-install + validators: [] + spec: + params: [] + variants: [] + description: Do not install route into forwarding table + required: false + variant_group_id: 0 + - name: unicast + type: object + profiles: + - xpath: + - unicast + validators: [] + spec: + params: [] + variants: [] + description: Install route into unicast routing table + required: false + variant_group_id: 0 + description: target routing table to install the route + required: false + variants: [] diff --git a/specs/network/virtual-router-static-route-ipv6.yaml b/specs/network/virtual-router-static-route-ipv6.yaml new file mode 100644 index 00000000..ec839140 --- /dev/null +++ b/specs/network/virtual-router-static-route-ipv6.yaml @@ -0,0 +1,425 @@ +name: Virtual Router IPv6 Static Route +terraform_provider_config: + description: Virtual Router + skip_resource: false + skip_datasource: false + resource_type: entry + resource_variants: + - singular + - plural + suffix: virtual_router_static_route_ipv6 + plural_suffix: virtual_router_static_routes_ipv6 + plural_name: static-routes + plural_description: '' + plural_type: list +go_sdk_config: + skip: false + package: + - network + - virtual_router + - ipv6 + - staticroute +panos_xpath: + path: + - network + - virtual-router + - $parent + - routing-table + - ipv6 + - static-route + - $name + vars: + - name: parent + spec: + type: entry + xpath: /params[@name="virtual-router"] + - name: name + spec: + type: entry + xpath: /params[@name="name"] +locations: +- name: ngfw + xpath: + path: + - config + - devices + - $ngfw_device + vars: + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific NGFW device + devices: + - ngfw + validators: [] + required: false + read_only: false +- name: template + xpath: + path: + - config + - devices + - $panorama_device + - template + - $template + - config + - devices + - $ngfw_device + vars: + - name: panorama_device + description: Specific Panorama device + required: false + default: localhost.localdomain + validators: [] + type: entry + - name: template + description: Specific Panorama template + required: true + validators: [] + type: entry + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific template + devices: + - panorama + validators: [] + required: false + read_only: false +- name: template-stack + xpath: + path: + - config + - devices + - $panorama_device + - template-stack + - $template_stack + - config + - devices + - $ngfw_device + vars: + - name: panorama_device + description: Specific Panorama device + required: false + default: localhost.localdomain + validators: [] + type: entry + - name: template_stack + description: Specific Panorama template stack + required: true + validators: [] + type: entry + - name: ngfw_device + description: The NGFW device + required: false + default: localhost.localdomain + validators: [] + type: entry + description: Located in a specific template stack + devices: + - panorama + validators: [] + required: false + read_only: false +entries: +- name: name + description: '' + validators: [] +imports: [] +spec: + params: + - name: virtual-router + type: string + profiles: + - xpath: [] + codegen_overrides: + gosdk: + skip: true + terraform: + xpath_variable: virtual-router + - name: admin-dist + type: int64 + profiles: + - xpath: + - admin-dist + validators: + - type: length + spec: + min: 10 + max: 240 + spec: {} + description: adminitrative distance + required: false + - name: bfd + type: object + profiles: + - xpath: + - bfd + validators: [] + spec: + params: + - name: profile + type: string + profiles: + - xpath: + - profile + validators: [] + spec: + default: None + description: BFD profile + required: false + variants: [] + description: BFD configuration + required: false + - name: destination + type: string + profiles: + - xpath: + - destination + validators: [] + spec: {} + description: Destination IP address/prefix + required: false + - name: interface + type: string + profiles: + - xpath: + - interface + validators: [] + spec: {} + description: '' + required: false + - name: metric + type: int64 + profiles: + - xpath: + - metric + validators: + - type: length + spec: + min: 1 + max: 65535 + spec: + default: 10 + description: metric value (path cost) + required: false + - name: nexthop + type: object + profiles: + - xpath: + - nexthop + validators: [] + spec: + params: [] + variants: + - name: discard + type: object + profiles: + - xpath: + - discard + validators: [] + spec: + params: [] + variants: [] + description: Discard packet + required: false + - name: ipv6-address + type: string + profiles: + - xpath: + - ipv6-address + validators: [] + spec: {} + description: Next hop IP address + required: false + - name: next-vr + type: string + profiles: + - xpath: + - next-vr + validators: [] + spec: {} + description: Next hop virtual router + required: false + - name: receive + type: object + profiles: + - xpath: + - receive + validators: [] + spec: + params: [] + variants: [] + description: Forward packet to host + required: false + description: Next hop to destination + required: false + - name: path-monitor + type: object + profiles: + - xpath: + - path-monitor + validators: [] + spec: + params: + - name: enable + type: bool + profiles: + - xpath: + - enable + validators: [] + spec: {} + description: '' + required: false + - name: failure-condition + type: enum + profiles: + - xpath: + - failure-condition + validators: + - type: values + spec: + values: + - any + - all + spec: + default: any + values: + - value: any + - value: all + description: failure condition + required: false + - name: hold-time + type: int64 + profiles: + - xpath: + - hold-time + validators: + - type: length + spec: + min: 0 + max: 1440 + spec: + default: 2 + description: hold time (minutes) + required: false + - name: monitor-destinations + type: list + profiles: + - xpath: + - monitor-destinations + - entry + type: entry + validators: [] + spec: + type: object + items: + type: object + spec: + params: + - name: enable + type: bool + profiles: + - xpath: + - enable + validators: [] + spec: {} + description: '' + required: false + - name: source + type: string + profiles: + - xpath: + - source + validators: [] + spec: {} + description: Source IP address + required: false + - name: destination + type: string + profiles: + - xpath: + - destination + validators: + - type: length + spec: + max: 63 + spec: {} + description: Destination IP address + required: false + - name: interval + type: int64 + profiles: + - xpath: + - interval + validators: + - type: length + spec: + min: 1 + max: 60 + spec: + default: 3 + description: ping interval + required: false + - name: count + type: int64 + profiles: + - xpath: + - count + validators: + - type: length + spec: + min: 3 + max: 10 + spec: + default: 5 + description: ping count + required: false + variants: [] + description: '' + required: false + variants: [] + description: Static Route Path Monitoring + required: false + - name: route-table + type: object + profiles: + - xpath: + - route-table + validators: [] + spec: + params: [] + variants: + - name: no-install + type: object + profiles: + - xpath: + - no-install + validators: [] + spec: + params: [] + variants: [] + description: Do not install route into forwarding table + required: false + variant_group_id: 0 + - name: unicast + type: object + profiles: + - xpath: + - unicast + validators: [] + spec: + params: [] + variants: [] + description: Install route into unicast routing table + required: false + variant_group_id: 0 + description: target routing table to install the route + required: false + variants: [] diff --git a/specs/network/virtual-router.yaml b/specs/network/virtual-router.yaml index a55ae18b..50fc77aa 100644 --- a/specs/network/virtual-router.yaml +++ b/specs/network/virtual-router.yaml @@ -7630,673 +7630,4 @@ spec: variants: [] description: Routing protocol configuration required: false - - name: routing-table - type: object - profiles: - - xpath: - - routing-table - validators: [] - spec: - params: - - name: ip - type: object - profiles: - - xpath: - - ip - validators: [] - spec: - params: - - name: static-route - type: list - profiles: - - xpath: - - static-route - - entry - type: entry - validators: [] - spec: - type: object - items: - type: object - spec: - params: - - name: destination - type: string - profiles: - - xpath: - - destination - validators: [] - spec: {} - description: Destination IP address/prefix - required: false - - name: interface - type: string - profiles: - - xpath: - - interface - validators: [] - spec: {} - description: '' - required: false - - name: admin-dist - type: int64 - profiles: - - xpath: - - admin-dist - validators: - - type: length - spec: - min: 10 - max: 240 - spec: {} - description: adminitrative distance - required: false - codegen_overrides: - terraform: - name: administrative-distance - - name: metric - type: int64 - profiles: - - xpath: - - metric - validators: - - type: length - spec: - min: 1 - max: 65535 - spec: - default: 10 - description: metric value (path cost) - required: false - - name: nexthop - type: object - profiles: - - xpath: - - nexthop - validators: [] - spec: - params: [] - variants: - - name: receive - type: object - profiles: - - xpath: - - receive - validators: [] - spec: - params: [] - variants: [] - description: Forward packet to host - required: false - - name: discard - type: object - profiles: - - xpath: - - discard - validators: [] - spec: - params: [] - variants: [] - description: Discard packet - required: false - - name: ip-address - type: string - profiles: - - xpath: - - ip-address - validators: [] - spec: {} - description: Next hop IP address - required: false - - name: fqdn - type: string - profiles: - - xpath: - - fqdn - validators: - - type: length - spec: - max: 255 - spec: {} - description: nexthop address FQDN address object configuration - required: false - - name: next-vr - type: string - profiles: - - xpath: - - next-vr - validators: [] - spec: {} - description: Next hop virtual router - required: false - description: Next hop to destination - required: false - - name: route-table - type: object - profiles: - - xpath: - - route-table - validators: [] - spec: - params: [] - variants: - - name: unicast - type: object - profiles: - - xpath: - - unicast - validators: [] - spec: - params: [] - variants: [] - description: Install route into unicast routing table - required: false - variant_group_id: 0 - - name: multicast - type: object - profiles: - - xpath: - - multicast - validators: [] - spec: - params: [] - variants: [] - description: Install route into multicast routing table, this - will create multicast routing table if not exists - required: false - variant_group_id: 0 - - name: both - type: object - profiles: - - xpath: - - both - validators: [] - spec: - params: [] - variants: [] - description: Install route into both unicast and multicast - routing table - required: false - variant_group_id: 0 - - name: no-install - type: object - profiles: - - xpath: - - no-install - validators: [] - spec: - params: [] - variants: [] - description: Do not install route into forwarding table - required: false - variant_group_id: 0 - description: target routing table to install the route - required: false - - name: bfd - type: object - profiles: - - xpath: - - bfd - validators: [] - spec: - params: - - name: profile - type: string - profiles: - - xpath: - - profile - validators: [] - spec: - default: None - description: BFD profile - required: false - variants: [] - description: BFD configuration - required: false - - name: path-monitor - type: object - profiles: - - xpath: - - path-monitor - validators: [] - spec: - params: - - name: enable - type: bool - profiles: - - xpath: - - enable - validators: [] - spec: {} - description: '' - required: false - - name: failure-condition - type: enum - profiles: - - xpath: - - failure-condition - validators: - - type: values - spec: - values: - - any - - all - spec: - default: any - values: - - value: any - - value: all - description: failure condition - required: false - - name: hold-time - type: int64 - profiles: - - xpath: - - hold-time - validators: - - type: length - spec: - min: 0 - max: 1440 - spec: - default: 2 - description: hold time (minutes) - required: false - - name: monitor-destinations - type: list - profiles: - - xpath: - - monitor-destinations - - entry - type: entry - validators: [] - spec: - type: object - items: - type: object - spec: - params: - - name: enable - type: bool - profiles: - - xpath: - - enable - validators: [] - spec: {} - description: '' - required: false - - name: source - type: string - profiles: - - xpath: - - source - validators: [] - spec: {} - description: Source IP address - required: false - - name: destination - type: string - profiles: - - xpath: - - destination - validators: - - type: length - spec: - max: 63 - spec: {} - description: Destination IP address - required: false - - name: interval - type: int64 - profiles: - - xpath: - - interval - validators: - - type: length - spec: - min: 1 - max: 60 - spec: - default: 3 - description: ping interval - required: false - - name: count - type: int64 - profiles: - - xpath: - - count - validators: - - type: length - spec: - min: 3 - max: 10 - spec: - default: 5 - description: ping count - required: false - variants: [] - description: '' - required: false - variants: [] - description: Static Route Path Monitoring - required: false - variants: [] - description: '' - required: false - variants: [] - description: IP routing table - required: false - - name: ipv6 - type: object - profiles: - - xpath: - - ipv6 - validators: [] - spec: - params: - - name: static-route - type: list - profiles: - - xpath: - - static-route - - entry - type: entry - validators: [] - spec: - type: object - items: - type: object - spec: - params: - - name: destination - type: string - profiles: - - xpath: - - destination - validators: [] - spec: {} - description: Destination IP address/prefix - required: false - - name: interface - type: string - profiles: - - xpath: - - interface - validators: [] - spec: {} - description: '' - required: false - - name: admin-dist - type: int64 - profiles: - - xpath: - - admin-dist - validators: - - type: length - spec: - min: 10 - max: 240 - spec: {} - description: adminitrative distance - required: false - codegen_overrides: - terraform: - name: administrative-distance - - name: metric - type: int64 - profiles: - - xpath: - - metric - validators: - - type: length - spec: - min: 1 - max: 65535 - spec: - default: 10 - description: metric value (path cost) - required: false - - name: nexthop - type: object - profiles: - - xpath: - - nexthop - validators: [] - spec: - params: [] - variants: - - name: receive - type: object - profiles: - - xpath: - - receive - validators: [] - spec: - params: [] - variants: [] - description: Forward packet to host - required: false - - name: discard - type: object - profiles: - - xpath: - - discard - validators: [] - spec: - params: [] - variants: [] - description: Discard packet - required: false - - name: ipv6-address - type: string - profiles: - - xpath: - - ipv6-address - validators: [] - spec: {} - description: Next hop IP address - required: false - - name: next-vr - type: string - profiles: - - xpath: - - next-vr - validators: [] - spec: {} - description: Next hop virtual router - required: false - description: Next hop to destination - required: false - - name: route-table - type: object - profiles: - - xpath: - - route-table - validators: [] - spec: - params: [] - variants: - - name: unicast - type: object - profiles: - - xpath: - - unicast - validators: [] - spec: - params: [] - variants: [] - description: Install route into unicast routing table - required: false - variant_group_id: 0 - - name: no-install - type: object - profiles: - - xpath: - - no-install - validators: [] - spec: - params: [] - variants: [] - description: Do not install route into forwarding table - required: false - variant_group_id: 0 - description: target routing table to install the route - required: false - - name: bfd - type: object - profiles: - - xpath: - - bfd - validators: [] - spec: - params: - - name: profile - type: string - profiles: - - xpath: - - profile - validators: [] - spec: - default: None - description: BFD profile - required: false - variants: [] - description: BFD configuration - required: false - - name: path-monitor - type: object - profiles: - - xpath: - - path-monitor - validators: [] - spec: - params: - - name: enable - type: bool - profiles: - - xpath: - - enable - validators: [] - spec: {} - description: '' - required: false - - name: failure-condition - type: enum - profiles: - - xpath: - - failure-condition - validators: - - type: values - spec: - values: - - any - - all - spec: - default: any - values: - - value: any - - value: all - description: failure condition - required: false - - name: hold-time - type: int64 - profiles: - - xpath: - - hold-time - validators: - - type: length - spec: - min: 0 - max: 1440 - spec: - default: 2 - description: hold time (minutes) - required: false - - name: monitor-destinations - type: list - profiles: - - xpath: - - monitor-destinations - - entry - type: entry - validators: [] - spec: - type: object - items: - type: object - spec: - params: - - name: enable - type: bool - profiles: - - xpath: - - enable - validators: [] - spec: {} - description: '' - required: false - - name: source - type: string - profiles: - - xpath: - - source - validators: [] - spec: {} - description: Source IP address - required: false - - name: destination - type: string - profiles: - - xpath: - - destination - validators: - - type: length - spec: - max: 63 - spec: {} - description: Destination IP address - required: false - - name: interval - type: int64 - profiles: - - xpath: - - interval - validators: - - type: length - spec: - min: 1 - max: 60 - spec: - default: 3 - description: ping interval - required: false - - name: count - type: int64 - profiles: - - xpath: - - count - validators: - - type: length - spec: - min: 3 - max: 10 - spec: - default: 5 - description: ping count - required: false - variants: [] - description: '' - required: false - variants: [] - description: Static Route Path Monitoring - required: false - variants: [] - description: '' - required: false - variants: [] - description: IPv6 routing table - required: false - variants: [] - description: Routing table configuration - required: false variants: []