forked from keysightgems/Huawei_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIxiaNet.tcl
More file actions
2283 lines (2163 loc) · 70.4 KB
/
IxiaNet.tcl
File metadata and controls
2283 lines (2163 loc) · 70.4 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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) Ixia technologies 2011-2012, Inc.
set releaseVersion 4.79
#===============================================================================
# Change made
# ==2011==
# Version 1.0
# 1. Create
# Version 1.1
# 2. Release on June 12th
# Version 1.2
# 3. Release on June 14th
# Version 1.3
# 4. Release on June 15th
# Version 1.4
# 5. Release on June 28th
# Version 1.5
# 6. Release on June 30th
# 6.1 Add-in IxOperate package for compatibility
# Version 1.6
# 7. Release on July 21st
# Version 1.7
# 8. Release on July 28th
# Version 1.8
# 9. Release on Aug 4th
# Version 1.9
# 10. Release on Aug 7th
# Version 1.10
# 11. Release on Aug 9th
# Version 1.11
# 12. Release on Aug 9th
# Version 1.12
# 13. Release on Aug 10th
# Version 1.13
# 14. Release on Aug 18th
# Version 1.14
# 15. Release on Aug 25th
# Version 1.15
# 16. Release on Aug 26th
# version 1.16
# 17. Release on Aug 30th
# version 1.17
# 18. Release on Sep 1st
# Version 2.0
# 19. Add Ospf/bgp interface
# 19.1. Release on Sep 5th
# Version 2.1
# 20. Release on Sep 20th
# Version 2.2
# 21. Release on Oct 20th
# Version 2.3
# 22. Release on Oct 24th
# Version 2.4
# 23. Release on Nov 3rd
# Version 2.5
# 24. Multiuser login
# 24.1. Release on Nov 21st
# Version 2.6
# 25. Release on Nov 28th
# Version 2.7
# 26. Release on Nov 30th
# Version 2.8
# 27. Release on Dec 28th
# Version 2.9
# 28. Release on Dec 30th
# ==2012==
# Version 2.10
# 29. Release on Jan 5th
# Version 2.11
# 30. Release on Jan 12th
# Version 2.12
# 31. Release on Jan 13th
# Version 2.13
# 32. Release on Jan 14th
# Version 2.14
# 33. Release on Jan 18th
# Version 2.15
# 34. Release on Jan 20th
# Version 2.16
# 35. Release on Feb 15th
# Version 2.17
# 36. Release on Feb 28th
# Version 2.18
# 37. Release on Mar 20th
# Version 2.19
# 38. Release on Mar 30th
# Version 2.20
# 39. Release on Apr 17th
# Version 2.21
# 40. Release on Apr 18th
# Version 2.23
# 41. Release on May 5th
# Version 2.24
# 42. Release on May 22nd
# Version 2.25
# 43. Release on June 5th
# Version 3.1
# 44. Add Rfc2544/Trill/DCBX/FC/FCoE interface
# 44.1 Release on June 17th
# Version 3.2
# 45. Add DCBX Qaz TLV
# 45.1 Release on June 26th
# Version 3.3
# 46. Release on June 28th
# Version 3.5
# 47. Release on July 5th
# Version 3.6
# 48. Release on July 10th
# Version 3.7
# 49. Release on July 11th
# Version 3.8
# 50. Release on July 17th
# Version 3.9
# 51. Release on July 18th
# Version 3.10
# 52. Release on July 24th
# Version 4.0
# 53. Release on July 30th
# Version 4.1
# 54. Release on Aug 2nd
# Version 4.2
# 55. Release on Aug 17th
# Version 4.3
# 56. Release on Aug 17th
# Version 4.4
# 57. Release on Aug 22th
# Version 4.5
# 58. Release on Aug 24th
# Version 4.6
# 59. Release on Sep 10th
# Version 4.7
# 60. Release on Sep 12th
# 60.1 include rfc2544
# Version 4.8
# 62. Release on Sep 24th
# Version 4.9
# 63. Release on Oct 8th
# 63.1 Include Ospfv3/PIM/RIP
# Version 4.10
# 64. Release on Oct 15th
# Version 4.11
# 65. Release on Oct 22nd
# Version 4.12
# 66. Release on Nov 1st
# Version 4.13
# 67. Release on Nov 7th
# Version 4.14
# 68. Release on Nov 9th
# Version 4.15
# 69. Release on Nov 17th
# Version 4.16
# 70. Release on Nov 19th
# Version 4.17
# 71. Release on Nov 26th
# Version 4.18
# 72. Release on Nov 29th
# Version 4.19
# 73. Fix Tcl Proxy reconnection defect
# 73.1 Release on Dec 12nd
# Version 4.20
# 74. Release on Dec 27th
# ==2013==
# Version 4.21
# 75. Release on Jan 10th
# Version 4.22
# 76. Release on Jan 18th
# Version 4.23
# 77. Release on Feb 7th
# Version 4.24
# 78. Release on Feb 22th
# Version 4.25
# 79. Add log file ixlogfile
# 79.1 Release on Mar 15th
# Version 4.26
# 80. Add force option in proc Login
# 80.1 Release on Mar 29th
# Version 4.27
# 81. Change log file direction to c:/windows/temp/ixlogfile
# 81.1 Release on Apr 12th
# Version 4.28
# 82. Release on Apr 19th
# Version 4.29
# 83. Release on May 8th
# Version 4.30
# 84. Release on Jun 21th
# Version 4.31
# 85. Release on Nov 7th
# Version 4.31patch
# 86. Release on Nov 24th
# ==2014==
# Version 4.32
# 87. Add proc loadconfig, modify Login
# 87.1 source Ixia_NetDot1xRate.tcl
# 87.2 Release on Mar 19th
# Version 4.34
# 88. Release on June 6th
# Version 4.35
# 89. Release on June 7th
# Version 4.36
# 90. Release on June 10th
# Version 4.37
# 91. Release on June 10th
# Version 4.38
# 92. Release on June 11th
# Version 4.39
# 93. Release on June 11th
# Version 4.40
# 94. Release on June 11th
# Version 4.41
# 95. Release on June 12th
# Version 4.42
# 96. Release on June 12th
# Version 4.43
# 97. Release on June 13th
# Version 4.44
# 98. Release on June 16th
# Version 4.45
# 99. Release on June 24th
# Version 4.46
# 100. Release on June 30th
# Version 4.47
# 101. Release on July 1st
# Version 4.48
# 102. Release on July 3rd
# Version 4.49
# 103. Release on July 7th
# Version 4.50
# 104. Release on July 9th
# Version 4.51
# 105. Release on July 15th
# Version 4.52
# 106. Release on July 16th
# Version 4.53
# 107. Release on July 19th
# Version 4.54
# 108. Release on July 26th
# Version 4.55
# 109. Release on July 29th
# Version 4.56
# 110. Release on Aug 22nd
# Version 4.57
# 111. Release on Aug 31st
# Version 4.58
# 112. Release on Sep 1st
# Version 4.59
# 113. Release on Sep 7th
# Version 4.60
# 114. Release on Sep 16th
# Version 4.61
# 115. Release on Oct 11th
# Version 4.62
# 116. Add compatibility to tbc file source
# 117. Release on Oct 16th
# Version 4.63
# 118. Release on Dec 9th
# 119. change server serverPort to remote_server remote_serverPort
# 2015
# Version 4.64
# 120. Release on Jan 8th
# Version 4.65
# 121. Add support for NGPF
# Version 4.66
# 122. Release on May 14th
# Version 4.66
# 123. Add SearchMinFrameSizeByLoad on July 11th
# Version 4.67
# 124. Release on Aug. 28th
# Version 4.68
# 125. Add Rfc3918 JoinLeaveDelay
# Version 4.70
# 125. load config for HW ruby. no objects automatic generated.
proc GetEnvTcl { product } {
set productKey "HKEY_LOCAL_MACHINE\\SOFTWARE\\Ixia Communications\\$product"
set versionKey [ registry keys $productKey ]
set latestKey [ lindex $versionKey end ]
if { $latestKey == "Multiversion" } {
set latestKey [ lindex $versionKey [ expr [ llength $versionKey ] - 2 ] ]
if { $latestKey == "InstallInfo" } {
set latestKey [ lindex $versionKey [ expr [ llength $versionKey ] - 3 ] ]
}
} elseif { $latestKey == "InstallInfo" } {
set latestKey [ lindex $versionKey [ expr [ llength $versionKey ] - 2 ] ]
}
set installInfo [ append productKey \\ $latestKey \\ InstallInfo ]
return [ registry get $installInfo HOMEDIR ]
}
set testerConfigFile ""
set portlist [list]
set trafficlist [list]
set portnamelist [list]
set trafficnamelist [list]
set tportlist [list]
set remote_server "localhost"
set remote_serverPort "8009"
set LoadConfigMode 0
#set ngpfMode 0
set ChangePortMap 0
set default_connection_mode "false"
set loadconfig_src_ip ""
set loadconfig_src_pid ""
set loadconfig_dst_ip ""
set loadconfig_dst_pid ""
set assign_portNameList ""
set assign_portLocationList ""
set assign_vportList ""
set assign_enable_flow_control "false"
set assign_realportList ""
# add for loadconfig mode port mapping
set enx_portNameList ""
set enx_portLocationList ""
#Anish(Have to get this from Env variable)
set ngpfMode 1
global ngpfMode
proc GetEnxInfo { args } {
Deputs "GetEnxInfo:$args "
global enx_portNameList
global enx_portLocationList
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-portnamelist {
set enx_portNameList $value
}
-portlocationlist {
set enx_portLocationList $value
}
}
}
}
proc GetOspfRouterHandle {handle {option 0}} {
set result [regexp {(.*)(topology:[0-9]+)/(deviceGroup:[0-9]+).*([0-9]):(.*)$} $handle match match1 match2 match3 match4]
set devHandle [join $match1/$match2/$match3]
Deputs "devHandle:$devHandle"
if {$match4 == 2} {
set returnHandle [ixNet getL $devHandle ospfv2Router]
set version 2
} elseif {$match4 == 3} {
set returnHandle [ixNet getL $devHandle ospfv3Router]
set version 3
}
if {$option != 0} {
return $version
}
return $returnHandle
}
proc loadconfig { filename } {
global portlist
global trafficlist
global portnamelist
global trafficnamelist
global tportlist
global LoadConfigMode
global ngpfMode
global loadconfig_src_ip
global loadconfig_src_pid
global loadconfig_dst_ip
global loadconfig_dst_pid
global ChangePortMap
global default_connection_mode
global enx_portNameList
global enx_portLocationList
puts "Loadconfig $filename"
ixNet exec loadConfig [ixNet readFrom $filename]
set root [ixNet getRoot]
if {[ixNet getL $root topology] != "" } {
set ngpfMode 1
}
set portlist [ixNet getL $root vport]
foreach portobj $portlist {
lappend portnamelist [ixNet getA $portobj -name]
}
set trafficlist [ixNet getL [ixNet getL $root traffic] trafficItem]
# foreach trafficItemobj $trafficlist {
# lappend trafficnamelist [ixNet getA $trafficItemobj -name]
# set itemlist [lindex [ixNet getL $trafficItemobj highLevelStream] 0]
# lappend tportlist [ixNet getA $itemlist -txPortName]
# # set itemlist [ixNet getL $trafficItemobj highLevelStream]
# # foreach trafficobj $itemlist {
# # lappend trafficnamelist [ixNet getA $trafficobj -name]
# # lappend tportlist [ixNet getA $trafficobj -txPortName]
# # }
# }
if { $default_connection_mode } {
#after 5000
# set chas [ixNet add $root/availableHardware chassis]
# ixNet setA $chas -hostname $loadconfig_dst_ip
# ixNet commit
# set chas [ixNet remapIds $chas]
# set chasH [ixNet getF ::ixNet::OBJ-/availableHardware chassis -hostname $loadconfig_dst_ip]
# foreach hport $portlist {
# set assignInfo [ixNet getA $hport -assignedTo]
# set locationInfo [ split $assignInfo ":" ]
# set chassis [ lindex $locationInfo 0 ]
# set ModuleNo [ lindex $locationInfo 1 ]
# set PortNo [ lindex $locationInfo 2 ]
# set index [lsearch $loadconfig_src_pid ${ModuleNo}/${PortNo} ]
# if { $index != -1 } {
# set dst [lindex $loadconfig_dst_pid $index]
# set dst [ split $dst "/" ]
# set ModuleNo [ lindex $dst 0 ]
# set PortNo [ lindex $dst 1 ]
# set realPort $chasH/card:$ModuleNo/port:$PortNo
# ixNet exec releasePort $hport
# after 1000
# ixNet setA $hport -connectedTo $realPort
# ixNet commit
# } else {
# error "no match port find for pid ${ModuleNo}/${PortNo} "
# }
# }
# set chasH [ixNet getF ::ixNet::OBJ-/availableHardware chassis -hostname $loadconfig_src_ip]
# ixNet remove $chasH
# ixNet commit
} else {
after 15000
foreach hport $portlist {
if { [ixNet getA $hport -connectionInfo] == "" } {
set assignInfo [ixNet getA $hport -assignedTo]
set locationInfo [ split $assignInfo ":" ]
set chassis [ lindex $locationInfo 0 ]
set ModuleNo [ lindex $locationInfo 1 ]
set PortNo [ lindex $locationInfo 2 ]
set chasH [ixNet getF ::ixNet::OBJ-/availableHardware chassis -hostname $chassis]
set realPort $chasH/card:$ModuleNo/port:$PortNo
ixNet exec clearOwnership $realPort
after 1000
ixNet setA $hport -connectedTo $realPort
ixNet commit
} else {
set timeout 120
while { 1 } {
if { !$timeout } {
break
}
set state [ ixNet getA $hport -state ]
if { $state != "up" } {
#Deputs "port state:$state"
after 1000
} else {
#Deputs "start state:$state"
break
}
incr timeout -1
#Deputs "start timeout:$timeout state:$state"
}
}
}
}
if { $enx_portNameList != "" && $enx_portLocationList != "" } {
array set env_map {}
foreach hport $portlist {
set assignInfo [ixNet getA $hport -assignedTo]
set locationInfo [ split $assignInfo ":" ]
set chassis [ lindex $locationInfo 0 ]
set ModuleNo [ lindex $locationInfo 1 ]
set PortNo [ lindex $locationInfo 2 ]
set loc ${chassis}/${ModuleNo}/${PortNo}
set env_map($loc) $hport
}
Deputs [parray env_map]
set objects [ find objects]
Deputs "objects: $objects"
foreach obj $objects {
Deputs "obj:$obj"
Deputs "enx_portLocationList:$enx_portLocationList"
if { [ catch {
if { [ $obj isa NetObject ] } {
if { [ $obj isa Port ] } {
set location [ $obj cget -location ]
Deputs "location:$location"
set res [lsearch $enx_portLocationList $location]
if { $res != -1 } {
Deputs "res:$res"
if { [info exists env_map($location)] } {
Deputs "vport handle: $env_map($location)"
$obj modify_handle $env_map($location)
}
}
}
}
} err ] } {
Deputs $err
continue
}
}
}
set LoadConfigMode 1
}
proc initLoadObjects {} {
global portnamelist
global portlist
global trafficlist
global tportlist
global trafficnamelist
foreach pname $portnamelist pobj $portlist {
Port $pname NULL NULL $pobj
# Generate protocols objects
GenerateProtocolsObjects $pname
}
foreach tname $trafficnamelist tobj $trafficlist tport $tportlist {
Traffic $tname $tport $tobj
}
}
proc GenerateProtocolsObjects { portObj } {
set tag "body Port::gen_pro_objs [info script]"
Deputs "----- TAG: $tag -----"
set portObj [GetObject $portObj]
set handle [$portObj cget -handle]
set handleName [$portObj cget -handleName]
set protocols [ixNet getL $handle protocols]
set protocolList [list bfd bgp igmp isis ldp mld ospf ospfV3 static]
foreach pro $protocolList {
set protocol [ixNet getL $protocols $pro]
# Special to handle static
set enabled [ ixNet getA $protocol -enabled ]
if { $pro == "static" && $enabled == "::ixNet::OK" } {
set enabled true
}
if { $enabled } {
switch -exact $pro {
bfd {
set bfdR [ixNet getL $protocol router]
BfdSession ${handleName}/bfd $handleName $bfdR
}
bgp {
set bgpNR [ixNet getL $protocol neighborRange]
BgpSession ${handleName}/bgp $handleName $bgpNR
}
igmp {
set igmpH [ixNet getL $protocol host]
IgmpHost ${handleName}/igmp $handleName $igmpH
}
mld {
set mldH [ixNet getL $protocol host]
MldHost ${handleName}/mld $handleName $mldH
}
isis {
set isisR [ixNet getL $protocol router]
IsisSession ${handleName}/isis $handleName $isisR
}
ldp {
set ldpR [ixNet getL $protocol router]
LdpSession ${handleName}/ldp $handleName $ldpR
}
ospf {
set ospfR [ixNet getL $protocol router]
Ospfv2Session ${handleName}/ospf $handleName $ospfR
}
ospfV3 {
set ospfV3R [ixNet getL $protocol router]
Ospfv3Session ${handleName}/ospfV3 $handleName $ospfV3R
}
static {
set staticLan [ixNet getL $protocol lan]
Host ${handleName}/static $handleName $staticLan
}
}
}
}
set protocolStack [ixNet getL $handle protocolStack]
set protocolStackList [list ipEndpoint dhcpEndpoint dhcpServerEndpoint pppoxEndpoint]
foreach proStack $protocolStackList {
set ethernet [ixNet getL $protocolStack ethernet]
if { [llength $ethernet] == 0 } {
continue
}
foreach ethernet $ethernet {
set stack [ixNet getL $ethernet $proStack]
if { $stack != "" } {
switch -exact $proStack {
dhcpEndpoint {
set ranges [ixNet getL $stack range]
foreach range $ranges {
set ipType [ixNet getA $range/dhcpRange -ipType]
set objName [ixNet getA $range/dhcpRange -name]
if { $ipType == "IPv4" } {
Dhcpv4Host $objName $handleName $stack $range
} elseif { $ipType == "IPv6" } {
Dhcpv6Host $objName $handleName $stack $range
}
}
}
dhcpServerEndpoint {
set ranges [ixNet getL $stack range]
foreach range $ranges {
set ipType [ixNet getA $range/dhcpServerRange -ipType]
set objName [ixNet getA $range/dhcpServerRange -name]
if { $ipType == "IPv4" } {
Dhcpv4Server $objName $handleName $stack $range
} elseif { $ipType == "IPv6" } {
Dhcpv6Server $objName $handleName $stack $range
}
}
}
pppoxEndpoint {
set ranges [ixNet getL $stack range]
foreach range $ranges {
set objName [ixNet getA $range/pppoxRange -name]
PppoeHost $objName $handleName $stack $range
}
}
ipEndpoint {
set ranges [ixNet getL $stack range]
foreach range $ranges {
set objName [ixNet getA $range/ipRange -name]
set ipRangeOptions [ixNet getL $protocolStack ipRangeOptions]
if { [llength $ipRangeOptions] != 0 } {
if { [ixNet getA $ipRangeOptions -ipv6AddressMode] == "autoconf" } {
Ipv6AutoConfigHost $objName $handleName $stack $range
} else {
IPoEHost $objName $handleName $stack $range
}
}
}
}
}
}
}
}
}
proc GetAllPortObj {} {
set portObj [list]
set objList [ find objects ]
foreach obj $objList {
if { [ $obj isa Port ] } {
lappend portObj [ $obj cget -handle ]
}
}
return $portObj
}
proc GetValidHandleObj { objType handle { parentHnd "" } } {
global ngpfMode
set tag "GetValidHandleObj [info script]"
Deputs "----- TAG: $tag -----"
set index 0
if { [ catch {
set index [expr $index + $handle]
} err ] } {
set index 0
}
switch -exact $objType {
port {
Deputs "check port: checkname $handle"
foreach port [ixNet getL [ixNet getRoot] vport] {
set portname [ixNet getA $port -name]
if { $port == $handle } {
return $handle
} elseif { $portname == $handle || $portname == [lindex [split $handle "::"] end] } {
Deputs "portname:$portname; checkname $handle"
return $port
} elseif { [llength [ split $handle "/" ]] == 3 } {
set realLocationInfo [ split $handle "/" ]
set assignedTo [ixNet getA $port -assignedTo]
set ModuleNo [lindex [split $assignedTo ":"] 1]
set PortNo [lindex [split $assignedTo ":"] 2]
if { $ModuleNo == [lindex $realLocationInfo 1] && $PortNo == [lindex $realLocationInfo 2]} {
return $port
}
}
}
return ""
}
traffic {
set trafficObjs [ixNet getL [ixNet getL [ixNet getRoot] traffic] trafficItem]
foreach trafficItemobj $trafficObjs {
set itemlist [ixNet getL $trafficItemobj highLevelStream]
set itemName [ixNet getA $trafficItemobj -name]
foreach trafficobj $itemlist {
set highName [ixNet getA $trafficobj -name]
if { $highName == $handle || [string range $handle 1 [expr [string length $handle] - 2]] == $highName } {
return $trafficItemobj
} elseif { $itemName == $handle || [string range $handle 1 [expr [string length $handle] - 2]] == $itemName || $itemName == [lindex [split $handle "::"] end] } {
return $trafficItemobj
}
# if { [ixNet getA $trafficobj -txPortName] == [ixNet getA $parentHnd -name] } {
# if { $highName == $handle || [string range $handle 1 [expr [string length $handle] - 2]] == $highName } {
# return $trafficItemobj
# } elseif { $itemName == $handle || [string range $handle 1 [expr [string length $handle] - 2]] == $itemName || $itemName == [lindex [split $handle "::"] end] } {
# return $trafficItemobj
# }
# }
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $trafficObjs] != 0 && [llength $trafficObjs] > $index } {
# return [lindex $trafficObjs $index]
# }
return ""
}
bfd {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols bfd]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] > $index} {
# return [lindex $routers $index]
# }
}
return ""
}
bgp {
if {$ngpfMode != 0} {
set topoObjList [ixNet getL [ixNet getRoot] topology]
if { [ llength $topoObjList ] != 0 } {
foreach topoObj $topoObjList {
set deviceGroupList [ixNet getL $topoObj deviceGroup]
foreach deviceObj $deviceGroupList {
set ethernetObjList [ixNet getL $deviceObj ethernet]
foreach ethernetObj $ethernetObjList {
set ipv4ObjList [ixNet getL $ethernetObj ipv4]
set ipv6ObjList [ixNet getL $ethernetObj ipv6]
if { [ llength $ipv4ObjList ] != 0 } {
foreach ipv4Obj $ipv4ObjList {
set bgpObj [ixNet getL $ipv4Obj bgpIpv4Peer]
if { $bgpObj == $handle } {
return $handle
}
#if {[ixNet getA [ixNet getA $router -interfaces] -description] == $handle} {
# return $router
#}
}
}
if { [ llength $ipv6ObjList ] != 0 } {
foreach ipv6Obj $ipv6ObjList {
set bgpObj [ixNet getL $ipv6Obj bgpIpv6Peer]
if { $bgpObj == $handle } {
return $handle
}
#if {[ixNet getA [ixNet getA $router -interfaces] -description] == $handle} {
# return $router
#}
}
}
}
}
}
}
return ""
} else {
Deputs "check bgp: checkname $handle"
Deputs "check parentHnd: checkname $parentHnd"
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols bgp]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol neighborRange]
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA $router -interfaces] -description] == $handle} {
return $router
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] != 0 && [llength $routers] > $index } {
# return [lindex $routers $index]
# }
}
return ""
}
}
simroute {
if {$ngpfMode == 1} {
set routers [ixNet getL $parentHnd networkGroup]
} elseif {$ngpfMode == 0} {
set routers [ixNet getL $parentHnd routeRange]
}
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {$ngpfMode == 0} {
if {[ixNet getA $router -networkAddress] == $handle} {
return $router
}
}
}
return ""
}
igmp_host {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols igmp]
if { [ ixNet getA $protocol -enabled ] } {
set hosts [ixNet getL $protocol host]
foreach host $hosts {
if { $host == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA $host -interfaceId] -description] == $handle} {
return $host
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $hosts] != 0 && [llength $hosts] > $index } {
# return [lindex $hosts $index]
# }
}
return ""
}
pim_router {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols pimsm]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA [lindex [ixNet getL $router interface] 0] -interfaces] -description] == $handle} {
return $router
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $hosts] != 0 && [llength $hosts] > $index } {
# return [lindex $hosts $index]
# }
}
return ""
}
mld_host {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols mld]
if { [ ixNet getA $protocol -enabled ] } {
set hosts [ixNet getL $protocol host]
foreach host $hosts {
if { $host == $handle } {
return $handle
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $hosts] != 0 && [llength $hosts] > $index } {
# return [lindex $hosts $index]
# }
}
return ""
}
isis {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols isis]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA [lindex [ixNet getL $router interface] 0] -interfaceId] -description] == $handle} {
return $router
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] > $index} {
# return [lindex $routers $index]
# }
}
return ""
}
ldp {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols ldp]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] > $index} {
# return [lindex $routers $index]
# }
}
return ""
}
ospfv2 {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols ospf]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA [lindex [ixNet getL $router interface] 0] -interfaces] -description] == $handle} {
return $router
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] != 0 && [llength $routers] > $index } {
# return [lindex $routers $index]
# }
}
return ""
}
ospfv3 {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols ospfV3]
if { [ ixNet getA $protocol -enabled ] } {
set routers [ixNet getL $protocol router]
foreach router $routers {
if { $router == $handle } {
return $handle
}
if {[ixNet getA [ixNet getA [lindex [ixNet getL $router interface] 0] -interfaces] -description] == $handle} {
return $router
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $routers] != 0 && [llength $routers] > $index } {
# return [lindex $routers $index]
# }
}
return ""
}
host {
set protocols [ixNet getL $parentHnd protocols]
set protocol [ixNet getL $protocols static]
if { [ ixNet getA $protocol -enabled ] == "::ixNet::OK" } {
set lans [ixNet getL $protocol lan]
foreach lan $lans {
if { $lan == $handle } {
return $handle
}
}
# set index [expr $index - 1]
# if { $index >= 0 && [llength $lans] > $index} {
# return [lindex $lans $index]