Skip to content

Commit 0b5cdf8

Browse files
afiroshtsagarp337
authored andcommitted
Added ZPR and PSA support
1 parent 442ab82 commit 0b5cdf8

10 files changed

+296
-24
lines changed

examples/vn_monitoring/path_analysis/main.tf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
variable "region" {}
55
variable "compartment_ocid" {}
66

7+
variable "tenancy_ocid" {}
8+
79
variable "path_analysi_destination_endpoint_type" {
810
default = "SUBNET"
911
}
@@ -121,7 +123,7 @@ variable "on_prem_path_analyzer_test_destination_endpoint_type" {
121123
default = "ON_PREM"
122124
}
123125
variable "on_prem_path_analyzer_test_destination_endpoint_address" {
124-
default = "10.2.41.5"
126+
default = "10.50.1.5"
125127
}
126128
variable "on_prem_path_analyzer_test_protocol" {
127129
default = 6
@@ -130,7 +132,7 @@ variable "on_prem_path_analyzer_test_source_endpoint_type" {
130132
default = "IP_ADDRESS"
131133
}
132134
variable "on_prem_path_analyzer_test_source_endpoint_address" {
133-
default = "100.130.10.100"
135+
default = "10.11.1.5"
134136
}
135137
variable "on_prem_path_analyzer_test_display_name" {
136138
default = "On Prem Path Analysis"
@@ -186,3 +188,11 @@ resource "oci_vn_monitoring_path_analysi" "on_prem_test_path_analysis" {
186188
}
187189
}
188190

191+
data "oci_identity_availability_domains" "test_availability_domains" {
192+
compartment_id = var.tenancy_ocid
193+
}
194+
195+
output "ads" {
196+
value = data.oci_identity_availability_domains.test_availability_domains.availability_domains[0].name
197+
}
198+

examples/vn_monitoring/path_analyzer_test/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
variable "region" {}
55
variable "compartment_ocid" {}
66

7+
variable "tenancy_ocid" {}
8+
79
variable "path_analyzer_test_defined_tags_value" {
810
default = "value"
911
}
@@ -212,3 +214,11 @@ data "oci_vn_monitoring_path_analyzer_tests" "test_path_analyzer_tests" {
212214
display_name = var.path_analyzer_test_display_name
213215
state = var.path_analyzer_test_state
214216
}
217+
218+
data "oci_identity_availability_domains" "test_availability_domains" {
219+
compartment_id = var.tenancy_ocid
220+
}
221+
222+
output "ads" {
223+
value = data.oci_identity_availability_domains.test_availability_domains.availability_domains[0].name
224+
}

internal/integrationtest/vn_monitoring_path_analysi_test.go

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,31 @@ var (
3232
"query_options": acctest.RepresentationGroup{RepType: acctest.Optional, Group: pathAnalysiQueryOptionsRepresentation},
3333
"source_endpoint": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiSourceEndpointRepresentation},
3434
}
35+
pathAnalysiRepresentationLoadBalancer = map[string]interface{}{
36+
"type": acctest.Representation{RepType: acctest.Required, Create: `ADHOC_QUERY`},
37+
"cache_control": acctest.Representation{RepType: acctest.Optional, Create: `cacheControl`},
38+
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
39+
"destination_endpoint": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiLoadBalancerDestinationEndpointRepresentation},
40+
"path_analyzer_test_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_vn_monitoring_path_analyzer_test.test_path_analyzer_test.id}`},
41+
"protocol": acctest.Representation{RepType: acctest.Required, Create: `1`},
42+
"protocol_parameters": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiProtocolParametersRepresentation},
43+
"query_options": acctest.RepresentationGroup{RepType: acctest.Optional, Group: pathAnalysiQueryOptionsRepresentation},
44+
"source_endpoint": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiSourceEndpointRepresentation},
45+
}
46+
pathAnalysiRepresentationNetworkLoadBalancer = map[string]interface{}{
47+
"type": acctest.Representation{RepType: acctest.Required, Create: `ADHOC_QUERY`},
48+
"cache_control": acctest.Representation{RepType: acctest.Optional, Create: `cacheControl`},
49+
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
50+
"destination_endpoint": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiNetworkLoadBalancerDestinationEndpointRepresentation},
51+
"path_analyzer_test_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_vn_monitoring_path_analyzer_test.test_path_analyzer_test.id}`},
52+
"protocol": acctest.Representation{RepType: acctest.Required, Create: `1`},
53+
"protocol_parameters": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiProtocolParametersRepresentation},
54+
"query_options": acctest.RepresentationGroup{RepType: acctest.Optional, Group: pathAnalysiQueryOptionsRepresentation},
55+
"source_endpoint": acctest.RepresentationGroup{RepType: acctest.Required, Group: pathAnalysiSourceEndpointRepresentation},
56+
}
3557
pathAnalysiDestinationEndpointRepresentation = map[string]interface{}{
3658
"type": acctest.Representation{RepType: acctest.Required, Create: `IP_ADDRESS`},
37-
"address": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_instance.test_instance.private_ip}`},
59+
"address": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_instance.test_instance.public_ip}`},
3860
"instance_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_core_instance.test_instance.id}`},
3961
"listener_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_load_balancer_listener.test_listener.id}`},
4062
"load_balancer_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_load_balancer_load_balancer.test_load_balancer.id}`},
@@ -43,6 +65,14 @@ var (
4365
"vlan_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_core_vlan.test_vlan.id}`},
4466
"vnic_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_core_vnic_attachment.test_vnic_attachment.vnic_id}`},
4567
}
68+
pathAnalysiLoadBalancerDestinationEndpointRepresentation = map[string]interface{}{
69+
"type": acctest.Representation{RepType: acctest.Required, Create: `LOAD_BALANCER`},
70+
"load_balancer_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_load_balancer_load_balancer.test_load_balancer.id}`},
71+
}
72+
pathAnalysiNetworkLoadBalancerDestinationEndpointRepresentation = map[string]interface{}{
73+
"type": acctest.Representation{RepType: acctest.Required, Create: `NETWORK_LOAD_BALANCER`},
74+
"network_load_balancer_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_network_load_balancer_network_load_balancer.test_network_load_balancer.id}`},
75+
}
4676
pathAnalysiProtocolParametersRepresentation = map[string]interface{}{
4777
"type": acctest.Representation{RepType: acctest.Required, Create: `ICMP`},
4878
"destination_port": acctest.Representation{RepType: acctest.Required, Create: `10`},
@@ -55,7 +85,7 @@ var (
5585
}
5686
pathAnalysiSourceEndpointRepresentation = map[string]interface{}{
5787
"type": acctest.Representation{RepType: acctest.Required, Create: `IP_ADDRESS`},
58-
"address": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_instance.test_instance2.private_ip}`},
88+
"address": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_instance.test_instance2.public_ip}`},
5989
"instance_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_core_instance.test_instance2.id}`},
6090
"listener_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_load_balancer_listener.test_listener.id}`},
6191
"load_balancer_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_load_balancer_load_balancer.test_load_balancer.id}`},
@@ -77,6 +107,14 @@ var (
77107
"rule_set_names": acctest.Representation{RepType: acctest.Optional, Create: []string{`${oci_load_balancer_rule_set.test_rule_set.name}`}},
78108
"ssl_configuration": acctest.RepresentationGroup{RepType: acctest.Optional, Group: listenerSslConfigurationRepresentationOciCerts},
79109
}
110+
nblistenerRepresentation = map[string]interface{}{
111+
"default_backend_set_name": acctest.Representation{RepType: acctest.Required, Create: `${oci_network_load_balancer_backend_set.test_backend_set.name}`},
112+
"network_load_balancer_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_network_load_balancer_network_load_balancer.test_network_load_balancer.id}`},
113+
"name": acctest.Representation{RepType: acctest.Required, Create: `myListener1`},
114+
"port": acctest.Representation{RepType: acctest.Required, Create: `10`, Update: `11`},
115+
"protocol": acctest.Representation{RepType: acctest.Required, Create: `HTTP`},
116+
}
117+
80118
vlanRepresentationVnMonitoring = map[string]interface{}{
81119
"cidr_block": acctest.Representation{RepType: acctest.Required, Create: `10.0.1.0/24`, Update: "10.0.0.0/16"},
82120
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
@@ -142,6 +180,46 @@ func TestVnMonitoringPathAnalysiResource_basic(t *testing.T) {
142180
),
143181
},
144182

183+
// delete before next Create
184+
{
185+
Config: config + compartmentIdVariableStr + PathAnalysiResourceDependencies,
186+
},
187+
{
188+
Config: config + compartmentIdVariableStr + PathAnalysiResourceDependencies +
189+
acctest.GenerateResourceFromRepresentationMap("oci_vn_monitoring_path_analysi", "test_path_analysi", acctest.Required, acctest.Create, pathAnalysiRepresentationLoadBalancer),
190+
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
191+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
192+
resource.TestCheckResourceAttr(resourceName, "destination_endpoint.#", "1"),
193+
resource.TestCheckResourceAttrSet(resourceName, "destination_endpoint.0.load_balancer_id"),
194+
resource.TestCheckResourceAttr(resourceName, "destination_endpoint.0.type", "LOAD_BALANCER"),
195+
resource.TestCheckResourceAttr(resourceName, "protocol", "1"),
196+
resource.TestCheckResourceAttr(resourceName, "source_endpoint.#", "1"),
197+
resource.TestCheckResourceAttrSet(resourceName, "source_endpoint.0.address"),
198+
resource.TestCheckResourceAttr(resourceName, "source_endpoint.0.type", "IP_ADDRESS"),
199+
resource.TestCheckResourceAttr(resourceName, "type", "ADHOC_QUERY"),
200+
),
201+
},
202+
203+
// delete before next Create
204+
{
205+
Config: config + compartmentIdVariableStr + PathAnalysiResourceDependencies,
206+
},
207+
{
208+
Config: config + compartmentIdVariableStr + PathAnalysiResourceDependencies +
209+
acctest.GenerateResourceFromRepresentationMap("oci_vn_monitoring_path_analysi", "test_path_analysi", acctest.Required, acctest.Create, pathAnalysiRepresentationNetworkLoadBalancer),
210+
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
211+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
212+
resource.TestCheckResourceAttr(resourceName, "destination_endpoint.#", "1"),
213+
resource.TestCheckResourceAttrSet(resourceName, "destination_endpoint.0.network_load_balancer_id"),
214+
resource.TestCheckResourceAttr(resourceName, "destination_endpoint.0.type", "NETWORK_LOAD_BALANCER"),
215+
resource.TestCheckResourceAttr(resourceName, "protocol", "1"),
216+
resource.TestCheckResourceAttr(resourceName, "source_endpoint.#", "1"),
217+
resource.TestCheckResourceAttrSet(resourceName, "source_endpoint.0.address"),
218+
resource.TestCheckResourceAttr(resourceName, "source_endpoint.0.type", "IP_ADDRESS"),
219+
resource.TestCheckResourceAttr(resourceName, "type", "ADHOC_QUERY"),
220+
),
221+
},
222+
145223
// delete before next Create
146224
{
147225
Config: config + compartmentIdVariableStr + PathAnalysiResourceDependencies,

0 commit comments

Comments
 (0)