Delete Dead ALB from VCD

Alb records are normally stored in the below tables, Since in my case, my ALB env was unrecoverable, delete the below record from VCD be fore adding a new integration

delete from gateway_lb_virtual_service;
delete from lb_seg_assignment;
delete from load_balancer_seg;
delete from gateway_load_balancer;
delete from load_balancer_cloud;
delete from load_balancer_controllers;

here’s the DB schema (from VCD10.6.1)

vcloud=# \d load_balancer_controllers
Table “public.load_balancer_controllers”
Column | Type | Collation | Nullable | Default
——————–+————————-+———–+———-+———
id | uuid | | not null |
name | character varying(128) | | not null |
description | character varying(256) | | |
username | character varying(128) | | not null |
password | character varying(128) | | not null |
url | character varying(2000) | | not null |
controller_version | character varying(32) | | |
enabled | boolean | | not null | false
version_number | bigint | | not null | 1
Indexes:
“pk_load_bala_con_id” PRIMARY KEY, btree (id)
“uq_load_bala_con_name” UNIQUE CONSTRAINT, btree (name)
“uq_load_bala_con_url” UNIQUE CONSTRAINT, btree (url)
Referenced by:
TABLE “load_balancer_cloud” CONSTRAINT “fk_load_bala_clo2load_bala_con” FOREIGN KEY (lb_controller_id) REFERENCES load_balancer_controllers(id)

vcloud=# \d load_balancer_cloud
Table “public.load_balancer_cloud”
Column | Type | Collation | Nullable | Default
——————+————————+———–+———-+———
id | uuid | | not null |
name | character varying(128) | | not null |
description | character varying(256) | | |
lb_controller_id | uuid | | not null |
network_pool_id | uuid | | |
type | character varying(128) | | not null |
backing_id | character varying(128) | | not null |
Indexes:
“pk_load_bala_clo_id” PRIMARY KEY, btree (id)
“uq_load_bala_clo_lb_co_id_ba_i” UNIQUE CONSTRAINT, btree (lb_controller_id, backing_id)
“uq_load_bala_clo_name” UNIQUE CONSTRAINT, btree (name)
Foreign-key constraints:
“fk_load_bala_clo2load_bala_con” FOREIGN KEY (lb_controller_id) REFERENCES load_balancer_controllers(id)
“fk_load_bala_clo2network_pool” FOREIGN KEY (network_pool_id) REFERENCES network_pool(id)
Referenced by:
TABLE “gateway_load_balancer” CONSTRAINT “fk_gate_load_bal2load_bala_clo” FOREIGN KEY (lb_cloud_id) REFERENCES load_balancer_cloud(id) ON DELETE CASCADE
TABLE “load_balancer_seg” CONSTRAINT “fk_load_bala_seg2load_bala_clo” FOREIGN KEY (lb_cloud_id) REFERENCES load_balancer_cloud(id)

vcloud=# \d gateway_load_balancer
Table “public.gateway_load_balancer”
Column | Type | Collation | Nullable | Default
—————————–+————————+———–+———-+———
id | uuid | | not null |
gateway_id | uuid | | not null |
is_enabled | boolean | | not null | false
ipv4_service_network_cidr | character varying(18) | | |
segment_id | character varying(128) | | not null |
vrf_context_id | character varying(128) | | not null |
lb_cloud_id | uuid | | not null |
supported_feature_set | character varying(128) | | not null |
ipv6_service_network_cidr | character varying(45) | | |
is_transparent_mode_enabled | boolean | | not null | false
Indexes:
“pk_gate_load_bal_id” PRIMARY KEY, btree (id)
“uq_gate_load_bal_gateway_id” UNIQUE CONSTRAINT, btree (gateway_id)
Check constraints:
“at_least_one_cidr” CHECK (ipv6_service_network_cidr IS NOT NULL OR ipv4_service_network_cidr IS NOT NULL)
Foreign-key constraints:
“fk_gate_load_bal2gateway” FOREIGN KEY (gateway_id) REFERENCES gateway(id)
“fk_gate_load_bal2load_bala_clo” FOREIGN KEY (lb_cloud_id) REFERENCES load_balancer_cloud(id) ON DELETE CASCADE

vcloud=# \d load_balancer_seg
Table “public.load_balancer_seg”
Column | Type | Collation | Nullable | Default
—————————+————————+———–+———-+———
id | uuid | | not null |
name | character varying(128) | | not null |
description | character varying(256) | | |
backing_id | character varying(128) | | not null |
lb_cloud_id | uuid | | not null |
ha_mode | character varying(128) | | not null |
reservation_type | character varying(128) | | not null |
max_virtual_services | integer | | |
reserved_virtual_services | integer | | not null |
version_number | bigint | | not null | 1
supported_feature_set | character varying(128) | | not null |
backing_name | character varying(128) | | |
Indexes:
“pk_load_bala_seg_id” PRIMARY KEY, btree (id)
“uq_load_bala_seg_lb_cl_id_ba_i” UNIQUE CONSTRAINT, btree (lb_cloud_id, backing_id)
“uq_load_bala_seg_lb_clo_id_nam” UNIQUE CONSTRAINT, btree (lb_cloud_id, name)
Foreign-key constraints:
“fk_load_bala_seg2load_bala_clo” FOREIGN KEY (lb_cloud_id) REFERENCES load_balancer_cloud(id)
Referenced by:
TABLE “gateway_lb_virtual_service” CONSTRAINT “fk_gat_lb_vir_se2load_bala_seg” FOREIGN KEY (seg_id) REFERENCES load_balancer_seg(id)
TABLE “lb_seg_assignment” CONSTRAINT “fk_lb_seg_assi2load_bala_seg” FOREIGN KEY (seg_id) REFERENCES load_balancer_seg(id)

vcloud=# \d gateway_lb_virtual_service
Table “public.gateway_lb_virtual_service”
Column | Type | Collation | Nullable | Default
————————–+————————+———–+———-+———
id | uuid | | not null |
name | character varying(128) | | not null |
description | character varying(256) | | |
enabled | boolean | | not null | false
vs_backing_id | character varying(128) | | |
vip_backing_id | character varying(128) | | |
ipv4_virtual_ip_address | character varying(15) | | |
seg_id | uuid | | not null |
gateway_lr_id | uuid | | not null |
version_number | bigint | | not null | 1
server_certificate_id | uuid | | |
lb_pool_id | uuid | | not null |
ipv6_virtual_ip_address | character varying(45) | | |
transparent_mode_enabled | boolean | | not null | false
http_policy_backing_id | character varying(128) | | |
Indexes:
“pk_gat_lb_vir_se_id” PRIMARY KEY, btree (id)
“uq_gat_lb_vir_se_gat_lr_id_nam” UNIQUE e, btree (gateway_lr_id, name)
Check constraints:
“at_least_one_ip” CHECK (ipv6_virtual_ip_address IS NOT NULL OR ipv4_virtual_ip_address IS NOT NULL)
Foreign-key constraints:
“fk_gat_lb_vir_se2gate_lb_pool” FOREIGN KEY (lb_pool_id) REFERENCES gateway_lb_pool(id) ON DELETE CASCADE
“fk_gat_lb_vir_se2gate_logi_res” FOREIGN KEY (gateway_lr_id) REFERENCES gateway_logical_resource(id)
“fk_gat_lb_vir_se2load_bala_seg” FOREIGN KEY (seg_id) REFERENCES load_balancer_seg(id)
“fk_gat_lb_vir_se2server_certif” FOREIGN KEY (server_certificate_id) REFERENCES certificate_library_item(id) ON DELETE SET NULL

vcloud=# \d lb_seg_assignment
Table “public.lb_seg_assignment”
Column | Type | Collation | Nullable | Default
——————————–+———————–+———–+———-+———
id | uuid | | not null |
seg_id | uuid | | not null |
gateway_lr_id | uuid | | not null |
max_virtual_services | integer | | |
min_virtual_services | integer | | |
version_number | bigint | | not null | 1
network_service_floating_ip | character varying(45) | | |
network_service_floating_ip_v6 | character varying(45) | | |
Indexes:
“pk_lb_seg_assi_id” PRIMARY KEY, btree (id)
“ix_gateway_lr_id” btree (gateway_lr_id)
“ix_seg_id” btree (seg_id)
“uq_lb_seg_assi_seg_id_gat_id” UNIQUE CONSTRAINT, btree (seg_id, gateway_lr_id)
Foreign-key constraints:
“fk_lb_seg_assi2gate_logi_res” FOREIGN KEY (gateway_lr_id) REFERENCES gateway_logical_resource(id)
“fk_lb_seg_assi2load_bala_seg” FOREIGN KEY (seg_id) REFERENCES load_balancer_seg(id)