Repository navigation
Expand file tree
/
Copy pathftrcfg_A_change.php
More file actions
388 lines (324 loc) · 8.19 KB
/
Copy pathftrcfg_A_change.php
File metadata and controls
388 lines (324 loc) · 8.19 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<?php
echo "<html>";
echo "<head>";
echo "<title>AutoNet\\ A series FTR Changer Configuration</title>";
echo "</head>";
echo "<body bgcolor=#009999 lang=EN-US style='tab-interval:.5in'>";
echo "<P fontsize=15 align=center>";
echo " AutoNet\\ A series FTR Changer Configuration </p>";
echo "<br>";
echo "<p align=center><font size=48 color=NAVY> A series FTR Changer Configuration";
echo "</p></font>";
$host="127.0.0.1";
$user="root";
$password="rezasql";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("", $conn)
or die(mysql_error());
# Send SQL query
$sql="select ftr_id, new_name, bld_newname";
$sql=$sql." from ftr where ";
$sql=$sql."(bld_newname like 'A%' or bld_newname like 'B%') and bld_newname!='A11' order by 2";
// echo "<BR> $sql<BR>";
$result = mysql_query($sql)
or die(mysql_error());
while ($row=mysql_fetch_assoc($result)) {
$bld=$row['bld_newname'];
$ftr_id=$row['ftr_id'];
$new_name=$row['new_name'];
echo "<BR><font color=green size=10> Working on Building $bld FTR $new_name , FTR-ID: $ftr_id</font><BR>";
echo "<BR>";
echo "<BR>";
echo "config t";
//ETC
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip access-list extended VOIP-MARKING";
echo "<BR>";
echo "permit ip any any";
echo "<BR>";
echo "exit";
echo "<BR>";
echo "enable super-user-password Gr8Vision";
echo "<BR>";
echo "cdp run";
echo "<BR>";
echo "fdp run";
echo "<BR>";
echo "snmp-server community T1F1MH02 ro";
echo "<BR>";
echo "sntp server 10.20.66.123";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
if (strstr($bld,'A' and $new_name=='0046')) {
echo "int eth 1/1/9 to 1/1/23";
echo "<BR>";
echo "voice-vlan 50";
echo "<BR>";
}
else {
if (strstr($bld,'B') and ($new_name=='0016A'or $new_name=='0003B'or $new_name=='1008A'or $new_name=='0024'or $new_name=='1008'or $new_name=='0002'or $new_name=='0017B'or $new_name=='0028B'or $new_name=='1001b')) {
echo "int eth 1/1/9 to 1/1/23";
echo "<BR>";
echo "voice-vlan 50";
echo "<BR>";
}
else {
echo "int eth 1/1/13 to 1/1/46";
echo "<BR>";
echo "voice-vlan 50";
echo "<BR>";
}
}
p24($ftr_id,$new_name,$bld);
}// While
function p24($ftr_id,$new_name,$bld_newname){
$host="127.0.0.1";
$user="root";
$password="rezasql";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("", $conn)
or die(mysql_error());
# Send SQL query
$sql= "select ip from bld_ip where bld='".$bld_newname."'";
$result = mysql_query($sql)
or die(mysql_error());
$row=mysql_fetch_assoc($result);
$ip=$row['ip'];
$ip2nd=substr($ip,3,3);
$sql= "select src_switch, src_ip from portmapping where src_type='FTR' and src_bld='".$bld_newname."' and src_roomid='".$ftr_id."'";
$result3 = mysql_query($sql)
or die(mysql_error());
$row=mysql_fetch_assoc($result3);
$src_ip=$row['src_ip'];
$b=substr($src_ip,strrpos($src_ip,".")+1,2);
if (substr($b,1,1)=='/') $c=substr($b,0,1);
else $c=substr($b,0,2);
if ($c==2) $p=1;
if ($c==6) $p=2;
if ($c==10) $p=3;
if ($c==14) $p=4;
if ($c==18) $p=5;
if ($c==22) $p=6;
if ($c==26) $p=7;
if ($c==30) $p=8;
if ($c==34) $p=9;
if ($c==38) $p=10;
if ($c==42) $p=11;
if ($c==46) $p=12;
echo "hostname SW1-$bld_newname-FTR-$new_name";
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip dhcp-server enable";
echo "<BR>";
echo "!";
echo "<BR>";
echo "no ip dhcp-server pool data-pool";
echo "<BR>";
echo "no ip dhcp-server pool voip-pool";
echo "<BR>";
echo "no ip dhcp-server pool wireless_ap-pool";
echo "<BR>";
echo "no ip dhcp-server pool services-pool";
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip router-id 10.".$ip2nd.".99.".$p;
echo "<BR>";
echo "no interface loopback 1";
echo "<BR>";
echo "interface loopback 1";
echo "<BR>";
echo "ip address 10.".$ip2nd.".99.".$p." 255.255.255.255";
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "interface ethernet 1/1/1";
echo "<BR>";
echo "port-name [2 TRUNK UPLINKS TO SW1-".$bld_newname."-MTR-0016]";
echo "<BR>";
echo "route-only";
echo "<BR>";
echo "no ip address *";
echo "<BR>";
echo "ip address ".$src_ip;
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "ip ospf dead-interval 3";
echo "<BR>";
echo "ip ospf hello-interval 1";
echo "<BR>";
echo "ip ospf md5-authentication key-id 1 key 1 $6lUGlU";
echo "<BR>";
echo "ip ospf auth-change-wait-time 0";
echo "<BR>";
echo "ip ospf network point-to-point";
echo "<BR>";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "interface ve 10";
echo "<BR>";
echo "no ip address *";
echo "<BR>";
echo "port-name [IP interface WIRELESS-AP Vlan 10]";
echo "<BR>";
echo "ip address 10.".$ip2nd.".".$p."1.1 255.255.255.0";
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "!";
echo "<BR>";
echo "interface ve 20";
echo "<BR>";
echo "no ip address *";
echo "<BR>";
echo "port-name [IP interface DATA Vlan 20]";
echo "<BR>";
echo "ip address 10.".$ip2nd.".".$p."2.1 255.255.254.0";
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "!";
echo "<BR>";
echo "interface ve 40";
echo "<BR>";
echo "no ip address *";
echo "<BR>";
echo "port-name [IP interface SERVICES Vlan 40]";
echo "<BR>";
echo "ip address 10.".$ip2nd.".".$p."4.1 255.255.255.0";
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "!";
echo "<BR>";
echo "interface ve 50";
echo "<BR>";
echo "no ip address *";
echo "<BR>";
echo "port-name [IP interface VOIP Vlan 50]";
echo "<BR>";
echo "ip access-group VOIP-MARKING in ";
echo "<BR>";
echo "ip address 10.".$ip2nd.".".$p."5.1 255.255.255.0";
echo "<BR>";
echo "ip ospf area 10.".$ip2nd.".0.0";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "end";
echo "<BR>";
echo "wr me";
echo "<BR>";
echo "reload";
echo "<BR>";
echo "<BR>";
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!PART 2 A F T E R R E L O A D !!!!!!!!!!!!!!!!!!!!";
echo "<BR>";
echo "<BR>";
echo "conf t";
echo "<BR>";
echo "ip dhcp-server pool data-pool";
echo "<BR>";
echo "dhcp-default-router 10.".$ip2nd.".".$p."2.1 ";
echo "<BR>";
echo "dns-server 192.168.101.50 192.168.101.51";
echo "<BR>";
echo "domain-name .ac.ae";
echo "<BR>";
echo "excluded-address 10.".$ip2nd.".".$p."2.1 10.".$ip2nd.".".$p."2.9";
echo "<BR>";
echo "lease 1 0 0";
echo "<BR>";
echo "network 10.".$ip2nd.".".$p."2.0 255.255.254.0";
echo "<BR>";
echo "deploy";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip dhcp-server pool voip-pool";
echo "<BR>";
echo "dhcp-default-router 10.".$ip2nd.".".$p."5.1 ";
echo "<BR>";
echo "dns-server 192.168.101.50 192.168.101.51";
echo "<BR>";
echo "tftp-server 10.90.5.10";
echo "<BR>";
echo "domain-name .ac.ae";
echo "<BR>";
echo "excluded-address 10.".$ip2nd.".".$p."5.1 10.".$ip2nd.".".$p."5.9";
echo "<BR>";
echo "lease 1 0 0";
echo "<BR>";
echo "network 10.".$ip2nd.".".$p."5.0 255.255.255.0";
echo "<BR>";
echo "deploy";
echo "<BR>";
echo "!";
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip dhcp-server pool wireless_ap-pool";
echo "<BR>";
echo "dhcp-default-router 10.".$ip2nd.".".$p."1.1 ";
echo "<BR>";
echo "dns-server 192.168.101.50 192.168.101.51";
echo "<BR>";
echo "domain-name .ac.ae";
echo "<BR>";
echo "excluded-address 10.".$ip2nd.".".$p."1.1 10.".$ip2nd.".".$p."1.9";
echo "<BR>";
echo "lease 1 0 0";
echo "<BR>";
echo "network 10.".$ip2nd.".".$p."1.0 255.255.255.0";
echo "<BR>";
echo "deploy";
echo "<BR>";
echo "!";
echo "<BR>";
echo "ip dhcp-server pool services-pool";
echo "<BR>";
echo "dhcp-default-router 10.".$ip2nd.".".$p."4.1 ";
echo "<BR>";
echo "dns-server 192.168.101.50 192.168.101.51";
echo "<BR>";
echo "domain-name .ac.ae";
echo "<BR>";
echo "excluded-address 10.".$ip2nd.".".$p."4.1 10.".$ip2nd.".".$p."4.9";
echo "<BR>";
echo "lease 1 0 0";
echo "<BR>";
echo "network 10.".$ip2nd.".".$p."4.0 255.255.255.0";
echo "<BR>";
echo "deploy";
echo "<BR>";
echo "!";
}
?>