summaryrefslogtreecommitdiff
path: root/sql/caas/adhoc/wclab-dracut.sql
blob: 579fb273c17634c53dd38034b04f697833883daa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
-- oam amd mgmt subnets are swapped to create the dracut condition.
do $$ 
declare
  csr_name_central character varying := 'ye-olde-csr-hostname-1';
  cluster_name_central character varying := 'walnutcr-d0000000-001';
  oam_vip_hostname_central character varying := 'walnutcr-0000000-nh-pe1e910-001';
  ilo_gateway_address_central character varying := 'fd00:4888:2000:7f3:528:23::';
  ilo_subnet_central character varying := 'fd00:4888:2000:7f3:528:';
  oam_subnet_central character varying := 'fd00:4888:2000:07fd::';
  oam_floating_address_central character varying := 'fd00:4888:2000:07fd::290';
  mgmt_start_address_central character varying := 'fd00:4888:2000:1100::a';
  mgmt_end_address_central character varying := 'fd00:4888:2000:1100::2a';
  mgmt_subnet_central character varying := 'fd00:4888:2000:1100::';
  mgmt_gateway_address_central character varying := 'fd00:4888:2000:1100:524:23::';
  csr_name_remote character varying := 'ye-olde-csr-hostname-2';
  cluster_name_remote character varying := 'walnutcr-d9999999-001';
  ilo_subnet_remote character varying := 'fd00:4888:2000:1205::';
  ilo_gateway_address_remote character varying := 'fd00:4888:2000:1205::1';
  oam_floating_address_remote character varying := 'fd00:4888:2000:1209::a';
  oam_gateway_address_remote character varying := 'fd00:4888:2000:1209::1';
  oam_subnet_remote character varying := 'fd00:4888:2000:1209::';
  mgmt_start_address_remote character varying := 'fd00:4888:2000:120a::10';
  mgmt_end_address_remote character varying := 'fd00:4888:2000:120a::1f';
  mgmt_gateway_address_remote character varying := 'fd00:4888:2000:120a::1';
  mgmt_subnet_remote character varying := 'fd00:4888:2000:120a::';

  oam_hostname_central_0 character varying := 'walnutcr-0000000-nh-pe2e910-001';
  ilo_host_address_central_0 character varying := 'fd00:4888:2000:7f3:528:ff2:0:8';
  oam_host_address_central_0 character varying := 'fd00:4888:2000:07fd::292';

  oam_hostname_central_1 character varying := 'walnutcr-0000000-nh-pe2e910-002';
  ilo_host_address_central_1 character varying := 'fd00:4888:2000:7f3:528:ff2:0:7';
  oam_host_address_central_1 character varying := 'fd00:4888:2000:07fd::291';

  oam_hostname_central_2 character varying := 'walnutcr-0000000-nh-pe2e910-003';
  ilo_host_address_central_2 character varying := 'fd00:4888:2000:7f3:528:ff2:0:9';
  oam_host_address_central_2 character varying := 'fd00:4888:2000:07fd::293';

  ilo_host_address_remote_0 character varying := 'fd00:4888:2000:1205::26';
  oam_host_address_remote_0 character varying := 'fd00:4888:2000:120a::b';
begin
  update caas_cellsiterouter
  set ilo_subnet = ilo_subnet_central
  where csr_hostname = csr_name_central;

  update caas_cellsiterouter
  set ilo_default_gateway = ilo_gateway_address_central
  where csr_hostname = csr_name_central;

  update caas_cellsiterouter
  set oam_subnet = oam_subnet_central
  where csr_hostname = csr_name_central;

  update caas_cellsiterouter
  set oam_subnet = oam_subnet_remote
  where csr_hostname = csr_name_remote;

  update caas_cellsiterouter
  set oam_default_gateway = oam_gateway_address_remote
  where csr_hostname = csr_name_remote;

  update caas_cellsiterouter
  set mgmt_subnet = mgmt_subnet_central
  where csr_hostname = csr_name_central;

  update caas_cellsiterouter
  set mgmt_default_gateway = mgmt_gateway_address_central
  where csr_hostname = csr_name_central;

  update caas_cellsiterouter
  set mgmt_subnet = mgmt_subnet_remote
  where csr_hostname = csr_name_remote;

  update caas_cellsiterouter
  set mgmt_default_gateway = mgmt_gateway_address_remote
  where csr_hostname = csr_name_remote;

  update caas_cellsiterouter
  set ilo_subnet = ilo_subnet_remote
  where csr_hostname = csr_name_remote;

  update caas_cellsiterouter
  set ilo_default_gateway = ilo_gateway_address_remote
  where csr_hostname = csr_name_remote;

  update caas_cluster
  set oam_vip_hostname = oam_vip_hostname_central
  where cluster_name = cluster_name_central;

  update caas_cluster
  set oam_vip_address = oam_floating_address_central
  where cluster_name = cluster_name_central;

  update caas_cluster
  set mgmt_address_range_start = mgmt_start_address_central
  where cluster_name = cluster_name_central;

  update caas_cluster
  set mgmt_address_range_end = mgmt_end_address_central
  where cluster_name = cluster_name_central;

  update caas_cluster
  set oam_vip_address = oam_floating_address_remote
  where cluster_name = cluster_name_remote;

  update caas_cluster
  set mgmt_address_range_start = mgmt_start_address_remote
  where cluster_name = cluster_name_remote;

  update caas_cluster
  set mgmt_address_range_end = mgmt_end_address_remote
  where cluster_name = cluster_name_remote;

  update caas_server
  set oam_hostname = oam_hostname_central_0
  where ilo_host_address = ilo_host_address_central_0;

  update caas_server
  set oam_host_address = oam_host_address_remote_0
  where ilo_host_address = ilo_host_address_remote_0;

  update caas_server
  set oam_hostname = oam_hostname_central_1
  where ilo_host_address = ilo_host_address_central_1;

  update caas_server
  set oam_host_address = oam_host_address_central_1
  where ilo_host_address = ilo_host_address_central_1;

  update caas_server
  set oam_hostname = oam_hostname_central_2
  where ilo_host_address = ilo_host_address_central_2;

  update caas_server
  set oam_host_address = oam_host_address_central_2
  where ilo_host_address = ilo_host_address_central_2;

  update caas_server
  set oam_host_address = oam_host_address_remote_0
  where ilo_host_address = ilo_host_address_remote_0;
end $$;

/*

truncate table caas_blade cascade;
truncate table caas_cellsiterouter cascade;
truncate table caas_chassis cascade;
truncate table caas_cluster cascade;
truncate table caas_credential cascade;
truncate table caas_firmwareupgradeschedule cascade;
truncate table caas_location cascade;
truncate table caas_namespace cascade;
truncate table caas_sapclli cascade;
truncate table caas_server cascade;
truncate table caas_vendor cascade;
truncate table caas_vlan cascade;
truncate table caas_wrinstallschedule cascade;

*/