From e463160477602310c89a581a2bea3efe67055442 Mon Sep 17 00:00:00 2001 From: Mahesh N Date: Tue, 9 Jul 2024 13:21:04 +0530 Subject: [PATCH] US65034: Test external cloud --- .github/workflows/cicd-dev-acc.yml | 37 ++-- .github/workflows/reusable-dev-acc.yml | 2 +- .../data-sources/cloud.yaml | 6 + .../data-sources/cloud_folder.yaml | 6 + .../data-sources/datastore.yaml | 4 + .../data-sources/edge_cluster.yaml | 3 + .../data-sources/environment.yaml | 3 + .../data-sources/group.yaml | 3 + .../data-sources/layout.yaml | 4 + .../data-sources/lb_pool_member_group.yaml | 5 + .../data-sources/load_balancer.yaml | 5 + .../data-sources/load_balancer_monitor.yaml | 6 + .../data-sources/load_balancer_pool.yaml | 6 + .../data-sources/load_balancer_profile.yaml | 21 +++ .../load_balancer_ssl_ca_certs.yaml | 5 + .../data-sources/network.yaml | 3 + .../data-sources/network_domain.yaml | 3 + .../data-sources/network_interface.yaml | 6 + .../data-sources/network_pool.yaml | 3 + .../data-sources/network_proxy.yaml | 3 + .../data-sources/network_type.yaml | 3 + .../data-sources/nsx-tier1.yaml | 5 + acc-external-testcases/data-sources/plan.yaml | 3 + .../data-sources/power_schedule.yaml | 3 + .../data-sources/resource_pool.yaml | 4 + .../data-sources/template.yaml | 3 + .../resources/instance-template_err.yaml | 28 +++ .../resources/instance.yaml | 27 +++ .../resources/instance_clone.yaml | 9 + .../resources/load_balancer.yaml | 18 ++ .../load_balancer_monitor-monitor_err.yaml | 24 +++ .../resources/load_balancer_monitor.yaml | 106 +++++++++++ .../load_balancer_pool-pool_err.yaml | 26 +++ .../resources/load_balancer_pool.yaml | 24 +++ .../load_balancer_profile-profile_err.yaml | 28 +++ .../resources/load_balancer_profile.yaml | 172 ++++++++++++++++++ .../load_balancer_virtual_server.yaml | 33 ++++ acc-external-testcases/resources/network.yaml | 22 +++ .../resources/router-tier0.yaml | 42 +++++ .../resources/router-tier1.yaml | 20 ++ .../resources/router_bgp_neighbor.yaml | 17 ++ .../resources/router_nat_rule.yaml | 37 ++++ .../resources/router_route.yaml | 13 ++ go.mod | 2 +- go.sum | 2 + 45 files changed, 786 insertions(+), 19 deletions(-) create mode 100644 acc-external-testcases/data-sources/cloud.yaml create mode 100644 acc-external-testcases/data-sources/cloud_folder.yaml create mode 100644 acc-external-testcases/data-sources/datastore.yaml create mode 100644 acc-external-testcases/data-sources/edge_cluster.yaml create mode 100644 acc-external-testcases/data-sources/environment.yaml create mode 100644 acc-external-testcases/data-sources/group.yaml create mode 100644 acc-external-testcases/data-sources/layout.yaml create mode 100644 acc-external-testcases/data-sources/lb_pool_member_group.yaml create mode 100644 acc-external-testcases/data-sources/load_balancer.yaml create mode 100644 acc-external-testcases/data-sources/load_balancer_monitor.yaml create mode 100644 acc-external-testcases/data-sources/load_balancer_pool.yaml create mode 100644 acc-external-testcases/data-sources/load_balancer_profile.yaml create mode 100644 acc-external-testcases/data-sources/load_balancer_ssl_ca_certs.yaml create mode 100644 acc-external-testcases/data-sources/network.yaml create mode 100644 acc-external-testcases/data-sources/network_domain.yaml create mode 100644 acc-external-testcases/data-sources/network_interface.yaml create mode 100644 acc-external-testcases/data-sources/network_pool.yaml create mode 100644 acc-external-testcases/data-sources/network_proxy.yaml create mode 100644 acc-external-testcases/data-sources/network_type.yaml create mode 100644 acc-external-testcases/data-sources/nsx-tier1.yaml create mode 100644 acc-external-testcases/data-sources/plan.yaml create mode 100644 acc-external-testcases/data-sources/power_schedule.yaml create mode 100644 acc-external-testcases/data-sources/resource_pool.yaml create mode 100644 acc-external-testcases/data-sources/template.yaml create mode 100644 acc-external-testcases/resources/instance-template_err.yaml create mode 100644 acc-external-testcases/resources/instance.yaml create mode 100644 acc-external-testcases/resources/instance_clone.yaml create mode 100644 acc-external-testcases/resources/load_balancer.yaml create mode 100644 acc-external-testcases/resources/load_balancer_monitor-monitor_err.yaml create mode 100644 acc-external-testcases/resources/load_balancer_monitor.yaml create mode 100644 acc-external-testcases/resources/load_balancer_pool-pool_err.yaml create mode 100644 acc-external-testcases/resources/load_balancer_pool.yaml create mode 100644 acc-external-testcases/resources/load_balancer_profile-profile_err.yaml create mode 100644 acc-external-testcases/resources/load_balancer_profile.yaml create mode 100644 acc-external-testcases/resources/load_balancer_virtual_server.yaml create mode 100644 acc-external-testcases/resources/network.yaml create mode 100644 acc-external-testcases/resources/router-tier0.yaml create mode 100644 acc-external-testcases/resources/router-tier1.yaml create mode 100644 acc-external-testcases/resources/router_bgp_neighbor.yaml create mode 100644 acc-external-testcases/resources/router_nat_rule.yaml create mode 100644 acc-external-testcases/resources/router_route.yaml diff --git a/.github/workflows/cicd-dev-acc.yml b/.github/workflows/cicd-dev-acc.yml index dc7a9cb7..64cfe46e 100644 --- a/.github/workflows/cicd-dev-acc.yml +++ b/.github/workflows/cicd-dev-acc.yml @@ -10,6 +10,7 @@ jobs: with: test_case: TestProvider test_description: Check for valid terraform provider + test_case_folder: acc-external-testcases secrets: inherit test-datasouces: @@ -19,6 +20,7 @@ jobs: with: test_case: TestAccDataSource test_description: GET call usecase validations + test_case_folder: acc-external-testcases secrets: inherit test-vmaas-instance: @@ -28,29 +30,30 @@ jobs: with: test_case: TestVmaasInstance TestAccResourceInstance test_description: Instance usecase validations + test_case_folder: acc-external-testcases secrets: inherit - test-vmaas-lb: - uses: ./.github/workflows/reusable-dev-acc.yml - needs: [test-vmaas-instance] - if: "always()" - with: - test_case: TestVmaasLB TestAccResourceLB TestVmaasLoadBalancerPlan TestAccResourceLoadBalancerCreate - test_description: Loadbalancer usecase validations - secrets: inherit + # test-vmaas-lb: + # uses: ./.github/workflows/reusable-dev-acc.yml + # needs: [test-vmaas-instance] + # if: "always()" + # with: + # test_case: TestVmaasLB TestAccResourceLB TestVmaasLoadBalancerPlan TestAccResourceLoadBalancerCreate + # test_description: Loadbalancer usecase validations + # secrets: inherit - test-vmaas-network: - uses: ./.github/workflows/reusable-dev-acc.yml - needs: [test-vmaas-lb] - if: "always()" - with: - test_case: TestVmaasNetworkPlan TestAccResourceNetworkCreate TestAccResourceRouter TestVmaasRouter TestAccResourceTier TestVmaasRouteBGPNeighborPlan - test_description: NSX Network usecase validations - secrets: inherit + # test-vmaas-network: + # uses: ./.github/workflows/reusable-dev-acc.yml + # needs: [test-vmaas-lb] + # if: "always()" + # with: + # test_case: TestVmaasNetworkPlan TestAccResourceNetworkCreate TestAccResourceRouter TestVmaasRouter TestAccResourceTier TestVmaasRouteBGPNeighborPlan + # test_description: NSX Network usecase validations + # secrets: inherit process-logs: runs-on: ubuntu-20.04 - needs: [test-vmaas-network] + needs: [test-vmaas-instance] if: "always()" steps: - name: Checkout workspace diff --git a/.github/workflows/reusable-dev-acc.yml b/.github/workflows/reusable-dev-acc.yml index 03435d14..5865e52c 100644 --- a/.github/workflows/reusable-dev-acc.yml +++ b/.github/workflows/reusable-dev-acc.yml @@ -42,7 +42,7 @@ env: HPEGL_USER_SECRET: ${{ secrets.DEV_HPEGL_USER_SECRET }} HPEGL_USER_ID: ${{ secrets.DEV_HPEGL_USER_ID }} HPEGL_VMAAS_API_URL: ${{ secrets.DEV_HPEGL_VMAAS_API_URL }} - HPEGL_VMAAS_LOCATION: ${{ secrets.DEV_HPEGL_VMAAS_LOCATION }} + HPEGL_VMAAS_LOCATION: FTC-External-Cloud HPEGL_VMAAS_SPACE_NAME: ${{ secrets.DEV_HPEGL_VMAAS_SPACE_NAME}} TF_ACC: ${{ secrets.TF_ACC }} LOG_FILE: "Terraform Log - ${{ inputs.test_description }}.txt" diff --git a/acc-external-testcases/data-sources/cloud.yaml b/acc-external-testcases/data-sources/cloud.yaml new file mode 100644 index 00000000..4e8dffaa --- /dev/null +++ b/acc-external-testcases/data-sources/cloud.yaml @@ -0,0 +1,6 @@ +acc: +- config: | + name = "External-Cloud" + validations: + json.zone.id: 2 + tf.id: 2 diff --git a/acc-external-testcases/data-sources/cloud_folder.yaml b/acc-external-testcases/data-sources/cloud_folder.yaml new file mode 100644 index 00000000..4fd23d50 --- /dev/null +++ b/acc-external-testcases/data-sources/cloud_folder.yaml @@ -0,0 +1,6 @@ +acc: +- config: | + name = "ExternalVMFolder" + cloud_id = 2 + validations: + json.folder.id: 11 diff --git a/acc-external-testcases/data-sources/datastore.yaml b/acc-external-testcases/data-sources/datastore.yaml new file mode 100644 index 00000000..33e5eacf --- /dev/null +++ b/acc-external-testcases/data-sources/datastore.yaml @@ -0,0 +1,4 @@ +acc: +- config: | + name = "glcicd-G2i-1-Bs-1" + cloud_id = 2 diff --git a/acc-external-testcases/data-sources/edge_cluster.yaml b/acc-external-testcases/data-sources/edge_cluster.yaml new file mode 100644 index 00000000..1219e169 --- /dev/null +++ b/acc-external-testcases/data-sources/edge_cluster.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "edge_cluster" \ No newline at end of file diff --git a/acc-external-testcases/data-sources/environment.yaml b/acc-external-testcases/data-sources/environment.yaml new file mode 100644 index 00000000..bdbbe7dc --- /dev/null +++ b/acc-external-testcases/data-sources/environment.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "dev" diff --git a/acc-external-testcases/data-sources/group.yaml b/acc-external-testcases/data-sources/group.yaml new file mode 100644 index 00000000..9066f9fd --- /dev/null +++ b/acc-external-testcases/data-sources/group.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "External-group2" diff --git a/acc-external-testcases/data-sources/layout.yaml b/acc-external-testcases/data-sources/layout.yaml new file mode 100644 index 00000000..ab1dce36 --- /dev/null +++ b/acc-external-testcases/data-sources/layout.yaml @@ -0,0 +1,4 @@ +acc: +- config: | + name = "Vmware VM" + instance_type_code = "vmware" diff --git a/acc-external-testcases/data-sources/lb_pool_member_group.yaml b/acc-external-testcases/data-sources/lb_pool_member_group.yaml new file mode 100644 index 00000000..a45da0ec --- /dev/null +++ b/acc-external-testcases/data-sources/lb_pool_member_group.yaml @@ -0,0 +1,5 @@ +acc: +- config: | + name = "Application-Group" + validations: + json.groups.externalId: "/infra/domains/default/groups/Application-Group" \ No newline at end of file diff --git a/acc-external-testcases/data-sources/load_balancer.yaml b/acc-external-testcases/data-sources/load_balancer.yaml new file mode 100644 index 00000000..23c8f390 --- /dev/null +++ b/acc-external-testcases/data-sources/load_balancer.yaml @@ -0,0 +1,5 @@ +acc: +- config: | + name = "tf_lb_DO_NOT_DELETE" + validations: + json.loadBalancer.id: 19 \ No newline at end of file diff --git a/acc-external-testcases/data-sources/load_balancer_monitor.yaml b/acc-external-testcases/data-sources/load_balancer_monitor.yaml new file mode 100644 index 00000000..b437d0f2 --- /dev/null +++ b/acc-external-testcases/data-sources/load_balancer_monitor.yaml @@ -0,0 +1,6 @@ +acc: +- config: | + name = "default-http-lb-monitor" + lb_id = 19 + validations: + json.loadBalancerMonitor.id: 152 \ No newline at end of file diff --git a/acc-external-testcases/data-sources/load_balancer_pool.yaml b/acc-external-testcases/data-sources/load_balancer_pool.yaml new file mode 100644 index 00000000..1613689a --- /dev/null +++ b/acc-external-testcases/data-sources/load_balancer_pool.yaml @@ -0,0 +1,6 @@ +acc: +- config: | + name = "tf_pool_DO_NOT_DELETE" + lb_id = 19 + validations: + json.loadBalancerPool.id: 108 diff --git a/acc-external-testcases/data-sources/load_balancer_profile.yaml b/acc-external-testcases/data-sources/load_balancer_profile.yaml new file mode 100644 index 00000000..7e1a0d63 --- /dev/null +++ b/acc-external-testcases/data-sources/load_balancer_profile.yaml @@ -0,0 +1,21 @@ +acc: +- config: | + name = "default-http-lb-app-profile" + lb_id = 19 + validations: + json.loadBalancerProfile.id: 504 +- config: | + name = "default-cookie-lb-persistence-profile" + lb_id = 19 + validations: + json.loadBalancerProfile.id: 527 +- config: | + name = "default-balanced-server-ssl-profile" + lb_id = 19 + validations: + json.loadBalancerProfile.id: 571 +- config: | + name = "default-balanced-client-ssl-profile" + lb_id = 19 + validations: + json.loadBalancerProfile.id: 552 diff --git a/acc-external-testcases/data-sources/load_balancer_ssl_ca_certs.yaml b/acc-external-testcases/data-sources/load_balancer_ssl_ca_certs.yaml new file mode 100644 index 00000000..95d24fe9 --- /dev/null +++ b/acc-external-testcases/data-sources/load_balancer_ssl_ca_certs.yaml @@ -0,0 +1,5 @@ +acc: +- config: | + name = "Test SSL Cert" + validations: + json.certificates.id: 8 \ No newline at end of file diff --git a/acc-external-testcases/data-sources/network.yaml b/acc-external-testcases/data-sources/network.yaml new file mode 100644 index 00000000..2ebad20c --- /dev/null +++ b/acc-external-testcases/data-sources/network.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "Dhcp-net1" diff --git a/acc-external-testcases/data-sources/network_domain.yaml b/acc-external-testcases/data-sources/network_domain.yaml new file mode 100644 index 00000000..12d7b181 --- /dev/null +++ b/acc-external-testcases/data-sources/network_domain.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "localdomain" diff --git a/acc-external-testcases/data-sources/network_interface.yaml b/acc-external-testcases/data-sources/network_interface.yaml new file mode 100644 index 00000000..f648ffb4 --- /dev/null +++ b/acc-external-testcases/data-sources/network_interface.yaml @@ -0,0 +1,6 @@ +acc: +- config: | + name = "VMXNET 3" + cloud_id = 2 + validations: + tf.id: 10 diff --git a/acc-external-testcases/data-sources/network_pool.yaml b/acc-external-testcases/data-sources/network_pool.yaml new file mode 100644 index 00000000..6a260909 --- /dev/null +++ b/acc-external-testcases/data-sources/network_pool.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "Post-pool" diff --git a/acc-external-testcases/data-sources/network_proxy.yaml b/acc-external-testcases/data-sources/network_proxy.yaml new file mode 100644 index 00000000..f697817c --- /dev/null +++ b/acc-external-testcases/data-sources/network_proxy.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "test-proxy" diff --git a/acc-external-testcases/data-sources/network_type.yaml b/acc-external-testcases/data-sources/network_type.yaml new file mode 100644 index 00000000..2352509b --- /dev/null +++ b/acc-external-testcases/data-sources/network_type.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "NSX Segment" diff --git a/acc-external-testcases/data-sources/nsx-tier1.yaml b/acc-external-testcases/data-sources/nsx-tier1.yaml new file mode 100644 index 00000000..654e305a --- /dev/null +++ b/acc-external-testcases/data-sources/nsx-tier1.yaml @@ -0,0 +1,5 @@ +acc: +- config: | + name = "tf-dont-delete" + validations: + json.networkRouter.providerId: "/infra/tier-1s/9c995f68-f873-42f0-bb1b-8c5021c8f64a" \ No newline at end of file diff --git a/acc-external-testcases/data-sources/plan.yaml b/acc-external-testcases/data-sources/plan.yaml new file mode 100644 index 00000000..4a846606 --- /dev/null +++ b/acc-external-testcases/data-sources/plan.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "G2i-small" diff --git a/acc-external-testcases/data-sources/power_schedule.yaml b/acc-external-testcases/data-sources/power_schedule.yaml new file mode 100644 index 00000000..fe9cbd36 --- /dev/null +++ b/acc-external-testcases/data-sources/power_schedule.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "power-schedule" diff --git a/acc-external-testcases/data-sources/resource_pool.yaml b/acc-external-testcases/data-sources/resource_pool.yaml new file mode 100644 index 00000000..fedace0d --- /dev/null +++ b/acc-external-testcases/data-sources/resource_pool.yaml @@ -0,0 +1,4 @@ +acc: +- config: | + name = "ExternalResourcePool" + cloud_id = 2 diff --git a/acc-external-testcases/data-sources/template.yaml b/acc-external-testcases/data-sources/template.yaml new file mode 100644 index 00000000..3ac90497 --- /dev/null +++ b/acc-external-testcases/data-sources/template.yaml @@ -0,0 +1,3 @@ +acc: +- config: | + name = "External-Centos" diff --git a/acc-external-testcases/resources/instance-template_err.yaml b/acc-external-testcases/resources/instance-template_err.yaml new file mode 100644 index 00000000..2a227cae --- /dev/null +++ b/acc-external-testcases/resources/instance-template_err.yaml @@ -0,0 +1,28 @@ +vars: + rand_name_1: tf_acc_%rand_int + rand_storage_1: "%rand_int{5,8}" +acc: +- config: | + name = "$(rand_name_1)" + cloud_id = 1 + group_id = 2 + layout_id = 113 + plan_id = 407 + instance_type_code = "vmware" + network { + id = 3 + } + volume { + name = "root_vol" + datastore_id = "auto" + size = $(rand_storage_1) + } + config { + resource_pool_id = 2 + no_agent = true + folder_code = "group-v284" + } + scale = 1 + validations: + tf.status: "running" + expect_error: ".*template.*" diff --git a/acc-external-testcases/resources/instance.yaml b/acc-external-testcases/resources/instance.yaml new file mode 100644 index 00000000..f7ffee1f --- /dev/null +++ b/acc-external-testcases/resources/instance.yaml @@ -0,0 +1,27 @@ +vars: + instance_name: tf_external_acc_%rand_int + rand_storage_1: "%rand_int{5,8}" +acc: +- config: | + name = "$(instance_name)" + cloud_id = 2 + group_id = 29 + layout_id = 415 + plan_id = 877 + instance_type_code = "vmware" + network { + id = 119 + } + volume { + name = "root_vol" + datastore_id = "auto" + size = $(rand_storage_1) + } + config { + resource_pool_id = 14 + template_id = 5069 + folder_code = "group-v7199" + } + scale = 1 + validations: + tf.status: "running" diff --git a/acc-external-testcases/resources/instance_clone.yaml b/acc-external-testcases/resources/instance_clone.yaml new file mode 100644 index 00000000..8ed3d868 --- /dev/null +++ b/acc-external-testcases/resources/instance_clone.yaml @@ -0,0 +1,9 @@ +vars: + instance_name: tf_external_acc_clone_%rand_int +acc: +- config: | + source_instance_id = 476 + name = "$(instance_name)" + network { + id = 119 + } diff --git a/acc-external-testcases/resources/load_balancer.yaml b/acc-external-testcases/resources/load_balancer.yaml new file mode 100644 index 00000000..90da8f71 --- /dev/null +++ b/acc-external-testcases/resources/load_balancer.yaml @@ -0,0 +1,18 @@ +vars: + name: "tf_loadbalancer_%rand_int" +acc: +- config: | + name = "$(name)" + description = "Loadbalancer created using tf" + enabled = true + group_access { + all = true + } + config { + admin_state = true + size = "SMALL" + log_level = "INFO" + tier1_gateways = "/infra/tier-1s/b918abfd-d84b-46be-a0ac-4a64c04a5703" + } + validations: + json.loadBalancer.config.tier1: "/infra/tier-1s/b918abfd-d84b-46be-a0ac-4a64c04a5703" diff --git a/acc-external-testcases/resources/load_balancer_monitor-monitor_err.yaml b/acc-external-testcases/resources/load_balancer_monitor-monitor_err.yaml new file mode 100644 index 00000000..717cd197 --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_monitor-monitor_err.yaml @@ -0,0 +1,24 @@ +vars: + http_name: tf_HTTP_MONITOR_%rand_int +acc: +- config: | + lb_id = 26 + name = "$(http_name)" + description = "HTTP_MONITOR creating using tf" + type = "LBIcmpMonitorProfile" + http_monitor { + fall_count = 8 + interval = 10 + monitor_port = 50 + rise_count = 5 + timeout = 30 + request_body = "request input body data" + request_method = "GET" + request_url = "https://request.com" + request_version = "HTTP_VERSION_1_0" + response_data = "Failed" + response_status_codes = "500" + } + validations: + json.loadBalancerMonitor.monitorType: "LBHttpMonitorProfile" + expect_error: ".*monitor.*" \ No newline at end of file diff --git a/acc-external-testcases/resources/load_balancer_monitor.yaml b/acc-external-testcases/resources/load_balancer_monitor.yaml new file mode 100644 index 00000000..2622264f --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_monitor.yaml @@ -0,0 +1,106 @@ +vars: + http_name: tf_HTTP_MONITOR_%rand_int + https_name: tf_HTTPS_MONITOR_%rand_int + icmp_name: tf_ICMP_MONITOR_%rand_int + passive_name: tf_PASSIVE_MONITOR_%rand_int + tcp_name: tf_TCP_MONITOR_%rand_int + udp_name: tf_UDP-MONITOR_%rand_int +acc: +- config: | + lb_id = 19 + name = "$(http_name)" + description = "HTTP_MONITOR creating using tf" + type = "LBHttpMonitorProfile" + http_monitor { + fall_count = 8 + interval = 10 + monitor_port = 50 + rise_count = 5 + timeout = 30 + request_body = "request input body data" + request_method = "GET" + request_url = "https://request.com" + request_version = "HTTP_VERSION_1_0" + response_data = "Failed" + response_status_codes = "500" + } + validations: + json.loadBalancerMonitor.monitorType: "LBHttpMonitorProfile" +- config: | + lb_id = 19 + name = "$(https_name)" + description = "HTTPS_MONITOR creating using tf" + type = "LBHttpsMonitorProfile" + https_monitor { + fall_count = 3 + interval = 5 + monitor_port = 80 + rise_count = 3 + timeout = 15 + request_body = "request input body data" + request_method = "GET" + request_url = "https://test.com" + request_version = "HTTP_VERSION_1_1" + response_data = "success" + response_status_codes = "201,200" + } + validations: + json.loadBalancerMonitor.monitorType: "LBHttpsMonitorProfile" +- config: | + lb_id = 19 + name = "$(icmp_name)" + description = "ICMP_MONITOR update using tf" + type = "LBIcmpMonitorProfile" + icmp_monitor { + fall_count = 30 + interval = 50 + monitor_port = 80 + rise_count = 3 + timeout = 15 + data_length = 32 + } + validations: + json.loadBalancerMonitor.monitorType: "LBIcmpMonitorProfile" +- config: | + lb_id = 19 + name = "$(passive_name)" + description = "PASSIVE_MONITOR create using tf" + type = "LBPassiveMonitorProfile" + passive_monitor { + timeout = 15 + max_fail = 5 + } + validations: + json.loadBalancerMonitor.monitorType: "LBPassiveMonitorProfile" +- config: | + lb_id = 19 + name = "$(tcp_name)" + description = "TCP_MONITOR create using tf" + type = "LBTcpMonitorProfile" + tcp_monitor { + fall_count = 3 + interval = 5 + monitor_port = 80 + rise_count = 3 + timeout = 15 + request_body = "request body data" + response_data = "success" + } + validations: + json.loadBalancerMonitor.monitorType: "LBTcpMonitorProfile" +- config: | + lb_id = 19 + name = "$(udp_name)" + description = "UDP_MONITOR create using tf" + type = "LBUdpMonitorProfile" + udp_monitor { + fall_count = 3 + interval = 5 + monitor_port = 80 + rise_count = 3 + timeout = 15 + request_body = "request body data" + response_data = "success" + } + validations: + json.loadBalancerMonitor.monitorType: "LBUdpMonitorProfile" diff --git a/acc-external-testcases/resources/load_balancer_pool-pool_err.yaml b/acc-external-testcases/resources/load_balancer_pool-pool_err.yaml new file mode 100644 index 00000000..f1a25192 --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_pool-pool_err.yaml @@ -0,0 +1,26 @@ +# here line no 18 pool member group is wrong and expecting the error +vars: + pool_name: tf_POOL_%rand_int +acc: +- config: | + lb_id = 18 + name = "$(pool_name)" + description = "POOL creating using tf" + min_active_members = 1 + algorithm = "WEIGHTED_ROUND_ROBIN" + config { + snat_translation_type = "LBSnatAutoMap" + active_monitor_paths = 6954 + passive_monitor_path = 6957 + tcp_multiplexing = false + tcp_multiplexing_number = 6 + member_group { + group = "/infra/domains/default/groups/Application-Group1" + max_ip_list_size = 1 + ip_revision_filter = "IPV4" + port = 80 + } + } + validations: + json.loadBalancerPool.config.memberGroup.path: "/infra/domains/default/groups/Application-Group" + expect_error: ".*pool.*" \ No newline at end of file diff --git a/acc-external-testcases/resources/load_balancer_pool.yaml b/acc-external-testcases/resources/load_balancer_pool.yaml new file mode 100644 index 00000000..4448158c --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_pool.yaml @@ -0,0 +1,24 @@ +vars: + pool_name: tf_POOL_%rand_int +acc: +- config: | + lb_id = 19 + name = "$(pool_name)" + description = "POOL creating using tf" + min_active_members = 1 + algorithm = "WEIGHTED_ROUND_ROBIN" + config { + snat_translation_type = "LBSnatAutoMap" + active_monitor_paths = 6954 + passive_monitor_path = 6957 + tcp_multiplexing = false + tcp_multiplexing_number = 6 + member_group { + group = "/infra/domains/default/groups/test-nework-group" + max_ip_list_size = 1 + ip_revision_filter = "IPV4" + port = 80 + } + } + validations: + json.loadBalancerPool.config.memberGroup.path: "/infra/domains/default/groups/test-nework-group" \ No newline at end of file diff --git a/acc-external-testcases/resources/load_balancer_profile-profile_err.yaml b/acc-external-testcases/resources/load_balancer_profile-profile_err.yaml new file mode 100644 index 00000000..bcdc7a52 --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_profile-profile_err.yaml @@ -0,0 +1,28 @@ +vars: + http_name: tf_HTTP_PROFILE_%rand_int +acc: +- config: | + lb_id = 18 + name = "$(http_name)" + description = "HTTP_PROFILE creating using tf" + profile_type = "application-profile" + http_profile { + service_type = "LBFastTcpProfile" + http_idle_timeout = 30 + request_header_size = 1024 + response_header_size = 4096 + redirection = "https" + x_forwarded_for = "INSERT" + request_body_size = 20 + response_timeout = 60 + ntlm_authentication = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBHttpProfile" + expect_error: ".*profile.*" \ No newline at end of file diff --git a/acc-external-testcases/resources/load_balancer_profile.yaml b/acc-external-testcases/resources/load_balancer_profile.yaml new file mode 100644 index 00000000..dd0ed562 --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_profile.yaml @@ -0,0 +1,172 @@ +vars: + http_name: tf_HTTP_PROFILE_%rand_int + tcp_name: tf_TCP_PROFILE_%rand_int + udp_name: tf_UDP_PROFILE_%rand_int + cookie_name: tf_COOKIE_PROFILE_%rand_int + generic_name: tf_GENERIC_PROFILE_%rand_int + source_name: tf_SOURCE-PROFILE_%rand_int + client_name: tf_CLIENT-PROFILE_%rand_int + server_name: tf_SERVER-PROFILE_%rand_int +acc: +- config: | + lb_id = 19 + name = "$(http_name)" + description = "HTTP_PROFILE creating using tf" + profile_type = "application-profile" + http_profile { + service_type = "LBHttpProfile" + http_idle_timeout = 30 + request_header_size = 1024 + response_header_size = 4096 + redirection = "https" + x_forwarded_for = "INSERT" + request_body_size = 20 + response_timeout = 60 + ntlm_authentication = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBHttpProfile" +- config: | + lb_id = 19 + name = "$(tcp_name)" + description = "TCP_PROFILE creating using tf" + profile_type = "application-profile" + tcp_profile { + service_type = "LBFastTcpProfile" + fast_tcp_idle_timeout = 1800 + connection_close_timeout = 8 + ha_flow_mirroring = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBFastTcpProfile" +- config: | + lb_id = 19 + name = "$(udp_name)" + description = "UDP_PROFILE creating using tf" + profile_type = "application-profile" + udp_profile { + service_type = "LBFastUdpProfile" + fast_udp_idle_timeout = 30 + ha_flow_mirroring = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBFastUdpProfile" +- config: | + lb_id = 19 + name = "$(cookie_name)" + description = "COOKIE_PROFILE creating using tf" + profile_type = "persistence-profile" + cookie_profile { + service_type = "LBCookiePersistenceProfile" + cookie_name = "cookie1" + cookie_fallback = true + cookie_garbling = true + cookie_mode = "INSERT" + cookie_type = "LBPersistenceCookieTime" + cookie_path = "http://cookie.com" + max_idle_time = 60 + share_persistence = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBCookiePersistenceProfile" +- config: | + lb_id = 19 + name = "$(generic_name)" + description = "GENERIC_PROFILE creating using tf" + profile_type = "persistence-profile" + generic_profile{ + service_type = "LBGenericPersistenceProfile" + share_persistence = false + ha_persistence_mirroring = false + persistence_entry_timeout = 30 + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBGenericPersistenceProfile" +- config: | + lb_id = 19 + name = "$(source_name)" + description = "SOURCE_PROFILE creating using tf" + profile_type = "persistence-profile" + sourceip_profile { + service_type = "LBSourceIpPersistenceProfile" + share_persistence = false + ha_persistence_mirroring = false + persistence_entry_timeout = 300 + purge_entries_when_full = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBSourceIpPersistenceProfile" +- config: | + lb_id = 19 + name = "$(client_name)" + description = "CLIENT_PROFILE creating using tf" + profile_type = "ssl-profile" + client_profile{ + service_type = "LBClientSslProfile" + ssl_suite = "BALANCED" + session_cache = true + session_cache_entry_timeout = 300 + prefer_server_cipher = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBClientSslProfile" +- config: | + lb_id = 19 + name = "$(server_name)" + description = "SERVER_PROFILE creating using tf" + profile_type = "ssl-profile" + server_profile{ + service_type = "LBServerSslProfile" + ssl_suite = "BALANCED" + session_cache = true + } + config { + tags { + tag = "tag1" + scope = "scope1" + } + } + validations: + json.loadBalancerProfile.serviceType: "LBServerSslProfile" \ No newline at end of file diff --git a/acc-external-testcases/resources/load_balancer_virtual_server.yaml b/acc-external-testcases/resources/load_balancer_virtual_server.yaml new file mode 100644 index 00000000..6faef96c --- /dev/null +++ b/acc-external-testcases/resources/load_balancer_virtual_server.yaml @@ -0,0 +1,33 @@ +vars: + vs_name: tf_VS_%rand_int +acc: +- config: | + lb_id = 19 + name = "$(vs_name)" + description = "tf_virtual-server created by tf" + vip_address = "11.10.52.14" + vip_port = "8080" + pool = 120 + + type = "http" + http_application_profile { + application_profile = 504 + } + + persistence = "COOKIE" + cookie_persistence_profile { + persistence_profile = 527 + } + + ssl_server_cert = 8 + ssl_server_config { + ssl_server_profile = 571 + } + + ssl_client_cert = 8 + ssl_client_config { + ssl_client_profile = 552 + } + validations: + json.loadBalancerInstance.vipProtocol: "http" + json.loadBalancerInstance.config.persistence: "COOKIE" \ No newline at end of file diff --git a/acc-external-testcases/resources/network.yaml b/acc-external-testcases/resources/network.yaml new file mode 100644 index 00000000..6b6edd6c --- /dev/null +++ b/acc-external-testcases/resources/network.yaml @@ -0,0 +1,22 @@ +vars: + network_name: tf_acc_net_%rand_int +acc: +- config: | + name = "$(network_name)" + description = "Network created using tf" + group_id = "shared" + scope_id = "/infra/sites/default/enforcement-points/default/transport-zones/a2935a7b-940d-44ef-b2d2-415fc7ab8e4c" + cidr = "11.10.31.1/24" + gateway = "11.10.31.1" + scan_network = false + active = true + connected_gateway = "/infra/tier-1s/9c995f68-f873-42f0-bb1b-8c5021c8f64a" + resource_permissions { + all = true + } + static_network { + pool_id = 17 + } + validations: + tf.cidr = "11.10.31.1/24" + tf.gateway = "11.10.31.1" diff --git a/acc-external-testcases/resources/router-tier0.yaml b/acc-external-testcases/resources/router-tier0.yaml new file mode 100644 index 00000000..5989ebe1 --- /dev/null +++ b/acc-external-testcases/resources/router-tier0.yaml @@ -0,0 +1,42 @@ +vars: + tier0_name: tf_tier0_gateway_%rand_int +acc: +- config: | + name = "$(tier0_name)" + enable = true + group_id = "shared" + tier0_config { + bgp { + ecmp = true + enable_bgp = true + local_as_num = 65000 + inter_sr_ibgp = false + multipath_relax = true + restart_mode = "HELPER_ONLY" + restart_time = 180 + stale_route_time = 600 + } + route_redistribution_tier0 { + tier0_dns_forwarder_ip = false + tier0_external_interface = true + tier0_ipsec_local_ip = false + tier0_loopback_interface = true + tier0_nat = true + tier0_segment = true + tier0_service_interface = true + tier0_static = true + } + route_redistribution_tier1 { + tier1_dns_forwarder_ip = false + tier1_service_interface = true + tier1_ipsec_local_endpoint = false + tier1_lb_snat = false + tier1_lb_vip = false + tier1_nat = false + tier1_segment = true + tier1_static = false + } + fail_over = "NON_PREEMPTIVE" + ha_mode = "ACTIVE_STANDBY" + edge_cluster= "21b5e641-e6dd-4eee-9260-472ba31c104b" + } diff --git a/acc-external-testcases/resources/router-tier1.yaml b/acc-external-testcases/resources/router-tier1.yaml new file mode 100644 index 00000000..3b14c33c --- /dev/null +++ b/acc-external-testcases/resources/router-tier1.yaml @@ -0,0 +1,20 @@ +vars: + name: "tf_tier1_gateway_%rand_int" +acc: +- config: | + name = "$(name)" + enable = true + group_id = "shared" + tier1_config { + edge_cluster= "21b5e641-e6dd-4eee-9260-472ba31c104b" + fail_over = "NON_PREEMPTIVE" + route_advertisement { + tier1_connected = true + tier1_static_routes = false + tier1_dns_forwarder_ip = true + tier1_lb_vip = false + tier1_nat = false + tier1_lb_snat = false + tier1_ipsec_local_endpoint = true + } + } diff --git a/acc-external-testcases/resources/router_bgp_neighbor.yaml b/acc-external-testcases/resources/router_bgp_neighbor.yaml new file mode 100644 index 00000000..6566f0be --- /dev/null +++ b/acc-external-testcases/resources/router_bgp_neighbor.yaml @@ -0,0 +1,17 @@ +acc: +- config: | + router_id = 3 + ip_address = "10.201.227.88" + remote_as = 65000 + keepalive = 60 + holddown = 180 + router_filtering_type = "IPV4" + bfd_enabled = false + bfd_interval = 1000 + bfd_multiple = 3 + allow_as_in = false + hop_limit = 1 + restart_mode = "HELPER_ONLY" + validations: + json.networkRouterBgpNeighbor.ipAddress="10.201.227.88" + json.networkRouterBgpNeighbor.remoteAs=65000 \ No newline at end of file diff --git a/acc-external-testcases/resources/router_nat_rule.yaml b/acc-external-testcases/resources/router_nat_rule.yaml new file mode 100644 index 00000000..62af24d5 --- /dev/null +++ b/acc-external-testcases/resources/router_nat_rule.yaml @@ -0,0 +1,37 @@ +vars: + nat_name: tf_router_nat_%rand_int +acc: +- config: | + router_id = 3 + name = "$(nat_name)" + enabled = true + description = "NAT rule created via terraform" + config { + action = "DNAT" + logging = true + firewall = "MATCH_EXTERNAL_ADDRESS" + } + source_network = "1.1.3.0/24" + translated_network = "1.1.1.0/24" + destination_network = "1.1.2.0/24" + translated_ports = 22 + priority = 120 + validations: + json.networkRouterNAT.sourceNetwork : "1.1.3.0/24" +- config: | + router_id = 3 + name = "$(nat_name)" + enabled = true + description = "NAT rule created via terraform" + config { + action = "DNAT" + logging = true + firewall = "MATCH_EXTERNAL_ADDRESS" + } + source_network = "1.1.4.0/24" + translated_network = "1.1.1.0/24" + destination_network = "1.1.2.0/24" + translated_ports = 22 + priority = 120 + validations: + json.networkRouterNAT.sourceNetwork : "1.1.4.0/24" diff --git a/acc-external-testcases/resources/router_route.yaml b/acc-external-testcases/resources/router_route.yaml new file mode 100644 index 00000000..55a8337a --- /dev/null +++ b/acc-external-testcases/resources/router_route.yaml @@ -0,0 +1,13 @@ +vars: + route_name: tf_route_%rand_int +acc: +- config: | + name = "$(route_name)" + router_id = 3 + description = "router route created using terraform" + enabled = true + default_route = false + network = "30.0.0.0/24" + next_hop = "88.88.88.91" + mtu = "65535" + priority = 100 diff --git a/go.mod b/go.mod index 3c796a21..5cbed37f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/HewlettPackard/hpegl-vmaas-terraform-resources go 1.21 require ( - github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.9 + github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.10-0.20240709064659-e6d2be1f7685 github.com/golang/mock v1.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-docs v0.9.0 diff --git a/go.sum b/go.sum index 7703457c..63be0e3b 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.9 h1:SjJgSnyD1XXAHy6kExOYTFiwAaAmBwvj/0BA+e+AyeA= github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.9/go.mod h1:UzXizYR6sUVsvDRMcLC2E4eabJsPH/3nM8rlKL2BLSc= +github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.10-0.20240709064659-e6d2be1f7685 h1:hHzOZSjxmfPh5h0716aVtgHWnkhljm+aGVeN49+KQbA= +github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk v0.1.10-0.20240709064659-e6d2be1f7685/go.mod h1:UzXizYR6sUVsvDRMcLC2E4eabJsPH/3nM8rlKL2BLSc= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=