forked from keysightgems/Huawei_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIxia_NetNgpfFcoe.tcl
More file actions
2070 lines (1761 loc) · 62.8 KB
/
Ixia_NetNgpfFcoe.tcl
File metadata and controls
2070 lines (1761 loc) · 62.8 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 2010-2011, Inc.
# Release Version 1.1
#===============================================================================
# Change made
# Version 1.0
# 1. Create
class FcoeVNPortHost {
inherit ProtocolStackObject
public variable host_type
public variable fcStack
public variable target_mac
public variable virtual_link
public variable fc_map
constructor { port } { chain $port } {}
method reborn {} {}
method config { args } {}
method login {} {
set tag "body FcFPortHost::get_fc_vn_port_stats [info script]"
Deputs "----- TAG: $tag -----"
waitPortReset $hPort 120
ixNet exec fcoeClientFlogi $handle/fcoeClientFlogiRange
return [GetStandardReturnHeader]
}
method logout {} {
set tag "body FcFPortHost::get_fc_vn_port_stats [info script]"
Deputs "----- TAG: $tag -----"
waitPortReset $hPort 120
ixNet exec fcoeClientFlogo $handle/fcoeClientFlogiRange
return [GetStandardReturnHeader]
}
method discovery {} {
set tag "body FcoeVNPortHost::discovery [info script]"
Deputs "----- TAG: $tag -----"
waitPortReset $hPort 120
set ret [ start ]
after 3000
return $ret
}
method start {} {
set tag "body FcoeVNPortHost::start [info script]"
Deputs "----- TAG: $tag -----"
waitPortReset $hPort 120
set ret [ chain ]
after 3000
return $ret
}
method clear_virtual_links {} {}
method get_fcoe_vn_port_stats {} {}
method CreateFcoeVNPerSessionView {} {}
}
body FcoeVNPortHost::reborn {} {
set tag "body FcoeVNPortHost::reborn [info script]"
Deputs "----- TAG: $tag -----"
chain
#-- add fcoe endpoint stack
set fcStack [ ixNet add $stack fcoeClientEndpoint ]
ixNet setA $fcStack -name $this
ixNet commit
set fcStack [ ixNet remapIds $fcStack ]
#-- add default range
set fcRange [ ixNet add $fcStack range ]
ixNet commit
set fcRange [ ixNet remapIds $fcRange ]
ixNet setA $fcRange/vlanRange -enabled False
ixNet setM $fcRange/fcoeClientFdiscRange \
-enabled False \
-nameServerQuery False \
-nameServerRegistration False
ixNet commit
ixNet setM $fcRange/fcoeClientFlogiRange \
-enabled True \
-plogiEnabled True \
-nameServerQuery False \
-nameServerRegistration False
ixNet commit
set handle [ ixNet remapIds $fcRange ]
Deputs "handle:$handle"
}
body FcoeVNPortHost::config { args } {
global errorInfo
global errNumber
set tag "body FcoeVNPortHost::config [info script]"
Deputs "----- TAG: $tag -----"
eval { chain } $args
Deputs "Args:$args "
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-host_cnt -
-count {
if { [ string is integer $value ] && ( $value <= 65535 ) } {
set count $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-enode_cnt {
set enode_cnt $value
}
-enable_vlan_discovery {
set trans [ BoolTrans $value ]
if { $trans == "1" || $trans == "0" } {
set enable_vlan_discovery $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-wwpn {
set wwpn $value
}
-wwpn_step {
set wwpn_step $value
}
-wwpn_list {
set wwpn_list $value
}
-wwnn {
set wwnn $value
}
-wwnn_step {
set wwnn_step $value
}
-addressing_mode {
set addressing_mode $value
}
-fc_map {
set fc_map $value
}
-fip_priority {
set fip_priority $value
}
-host_type {
set host_type $value
}
-bb_credit {
set bb_credit $value
}
-max_rcv_size {
set max_rcv_size $value
}
-fcf_mac_addr {
set fcf_mac_addr $value
}
-clear_links_list {
set clear_links_list $value
}
}
}
if { [ info exists count ] } {
if { $count } {
ixNet setM $handle/fcoeClientFdiscRange \
-enabled True \
-count $count
} else {
ixNet setM $handle/fcoeClientFdiscRange \
-enabled False \
}
}
if { [ info exists enode_cnt ] } {
Deputs "enode_cnt:$enode_cnt"
ixNet setA $handle/fcoeClientFlogiRange -count $count
}
if { [ info exists enable_vlan_discovery ] } {
ixNet setA $handle/fcoeClientFlogiRange -fipVlanDiscovery $enable_vlan_discovery
}
if { [ info exists wwpn ] } {
ixNet setA $handle/fcoeClientFlogiRange -portWwnStart $wwpn
}
if { [ info exists wwpn_step ] } {
ixNet setA $handle/fcoeClientFlogiRange -portWwnIncrement $wwpn_step
}
if { [ info exists wwpn_list ] } {
}
if { [ info exists wwnn ] } {
if { [ info exists wwnn_step ] == 0 } {
set wwnn_step 00:00:00:00:00:00:00:01
}
ixNet setA $handle/fcoeClientFlogiRange -nodeWwnStart $wwnn
# set wwnn [ incr $wwnn_step ]
}
if { [ info exists addressing_mode ] } {
ixNet setA $handle/fcoeClientFlogiRange -fipAddressingMode $addressing_mode
}
if { [ info exists fc_map ] == 0 } {
set fc_map NA
}
if { [ info exists fip_priority ] } {
# not supported
}
if { [ info exists host_type ] } {
set host_type [ string tolower $host_type ]
switch host_type {
target {
# ixNet setA $handle/fcoeClientFlogiRange -plogiEnabled False
}
initiator -
both {
# ixNet setA $handle/fcoeClientFlogiRange -plogiEnabled True
}
}
}
if { [ info exists bb_credit ] } {
# not supported
}
if { [ info exists max_rcv_size ] } {
# not supported
}
if { [ info exists fcf_mac_addr ] } {
set target_mac $fcf_mac_addr
}
if { [ info exists clear_links_list ] } {
set virtual_link $clear_links_list
}
ixNet commit
foreach obj [ find objects ] {
if { [ $obj isa FcoeVFPortHost ] == 0 } {
continue
}
Deputs "FCF obj found: $obj"
set vnRange [ $obj cget -vn_range ]
set vhRange [ $obj cget -vh_range ]
Deputs "vnRange:$vnRange"
Deputs "vhRange:$vhRange"
ixNet setA $handle/fcoeClientFlogiRange \
-plogiTargetName [ ixNet getA $vnRange/fcoeFwdVnPortRange -name ]
if { [ string tolower [ ixNet getA $handle/fcoeClientFdiscRange -enabled ] ] == "true" } {
ixNet setA $handle/fcoeClientFdiscRange \
-plogiTargetName [ ixNet getA $vhRange/fcoeFwdVnPortRange -name ]
}
}
return [GetStandardReturnHeader]
}
body FcoeVNPortHost::get_fcoe_vn_port_stats {} {
global errorInfo
global errNumber
set tag "body FcoeVNPortHost::get_fcoe_vn_port_stats [info script]"
Deputs "----- TAG: $tag -----"
# == Supported Stats
# {Stat Name}
# {Session Name}
# {Interface Status}
# {Failure Reason}
# {Discovered VLAN IDs}
# {Assigned MAC}
# {Port Name}
# {Source ID}
# {PLOGI Destination ID}
# {Switch Name}
# {Fabric Name}
# {Fabric FC Map}
# {Fabric Priority}
# {Fabric MAC}
# {FCF-MAC List}
# {FKA D Bit}
# {Advertised FKA}
# {FLOGI Tx}
# {FDISC Tx}
# {FLOGI LS_ACC Rx}
# {FLOGI LS_RJT Rx}
# {FDISC LS_ACC Rx}
# {FDISC LS_RJT Rx}
# {F_BSY Rx}
# {F_RJT Rx}
# {FLOGO Tx}
# {PLOGI Tx}
# {PLOGI Requests Rx}
# {PLOGI LS_ACC Rx}
# {PLOGI LS_RJT Rx}
# {PLOGO Tx}
# {PLOGO Rx}
# {NS Registration Tx}
# {NS Registration OK}
# {NS Queries Tx}
# {NS Queries OK}
# {SCR Tx}
# {SCR ACC Rx}
# {RSCN Rx}
# {RSCN ACC Tx}
# {FIP Discovery Solicitations Tx}
# {FIP Discovery Advertisements Rx}
# {FIP Unsolicited Discovery Advertisements Rx}
# {FIP Keep-Alives Tx}
# {FIP Clear Virtual Links Rx}
set root [ixNet getRoot]
set view [ lindex [ ixNet getF $root/statistics view -caption "fcoeVNPerSessionView" ] 0 ]
Deputs "view:$view"
if { $view == "" } {
if { [ catch {
set view [ CreateFcoeVNPerSessionView ]
} err ] } {
Deputs "err:$err"
return [ GetErrorReturnHeader "Can't fetch stats view, please make sure the session starting correctly." ]
}
}
set captionList [ ixNet getA $view/page -columnCaptions ]
#== Request stats ==
# role
# dst_mac_addr
# fc_id
# granted_mac_addr
# granted_vlan_id
# keep_alive_period
# max_rx_size
# rx_accept_count
# rx_clear_virtual_links_count
# rx_multicast_advertisement_count
# rx_reject_count
# rx_unicast_advertisement_count
# rx_vlan_notification_count
# state
# sub_state
# tx_fdisc_count
# tx_flogi_count
# tx_keep_alive_count
# tx_logo_count
# tx_plogi_count
# tx_state_change_register_count
# tx_unicast_solicatation_count
# tx_vlan_request_count
# world_wide_node_name
# world_wide_port_name
set rangeIndex [ lsearch -exact $captionList {Session Name} ]
set fc_id [ lsearch -exact $captionList {Source ID} ]
set granted_mac_addr [ lsearch -exact $captionList {Assigned MAC} ]
set granted_vlan_id [ lsearch -exact $captionList {Discovered VLAN IDs} ]
# set keep_alive_period [ lsearch -exact $captionList {FDISC Requests Rx} ]
# set max_rx_size [ lsearch -exact $captionList {FLOGI Requests Rx} ]
set rx_accept_count [ lsearch -exact $captionList {FLOGI LS_ACC Rx} ]
set rx_clear_virtual_links_count [ lsearch -exact $captionList {FIP Clear Virtual Links Rx} ]
set rx_multicast_advertisement_count [ lsearch -exact $captionList {FIP Unsolicited Discovery Advertisements Rx} ]
set rx_reject_count [ lsearch -exact $captionList {FLOGI LS_RJT Rx} ]
set rx_unicast_advertisement_count [ lsearch -exact $captionList {FIP Discovery Advertisements Rx} ]
# set rx_vlan_notification_count [ lsearch -exact $captionList {Clear Virtual Links Tx} ]
set state [ lsearch -exact $captionList {Interface Status} ]
set sub_state [ lsearch -exact $captionList {Failure Reason} ]
set tx_fdisc_count [ lsearch -exact $captionList {FDISC Tx} ]
set tx_flogi_count [ lsearch -exact $captionList {FLOGI Tx} ]
set tx_keep_alive_count [ lsearch -exact $captionList {FIP Keep-Alives Tx} ]
set tx_logo_count [ lsearch -exact $captionList {FLOGO Tx} ]
set tx_plogi_count [ lsearch -exact $captionList {PLOGI Tx} ]
set tx_state_change_register_count [ lsearch -exact $captionList {SCR Tx} ]
set tx_unicast_solicatation_count [ lsearch -exact $captionList {FIP Discovery Solicitations Tx} ]
# set tx_vlan_request_count [ lsearch -exact $captionList {FIP Discovery Solicitations Tx} ]
# set world_wide_node_name [ lsearch -exact $captionList {Node Name} ]
set world_wide_port_name [ lsearch -exact $captionList {Port Name} ]
Deputs "handle:$handle"
set rangeName [ ixNet getA $handle/fcClientFlogiRange -name ]
Deputs "range name:$rangeName"
set ret "Status : true\nLog : \n"
set pageCount [ ixNet getA $view/page -totalPages ]
for { set index 1 } { $index <= $pageCount } { incr index } {
ixNet setA $view/page -currentPage $index
ixNet commit
set stats [ ixNet getA $view/page -rowValues ]
Deputs "stats:$stats"
foreach row $stats {
set ret "$ret\{\n"
eval {set row} $row
Deputs "row:$row"
set statsItem "fc_id"
set statsVal [ lindex $row $fc_id ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "granted_mac_addr"
set statsVal [ lindex $row $granted_mac_addr ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "granted_vlan_id"
set statsVal [ lindex $row $granted_vlan_id ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_accept_count"
set statsVal [ lindex $row $rx_accept_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_clear_virtual_links_count"
set statsVal [ lindex $row $rx_clear_virtual_links_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_multicast_advertisement_count"
set statsVal [ lindex $row $rx_multicast_advertisement_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_reject_count"
set statsVal [ lindex $row $rx_reject_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_unicast_advertisement_count"
set statsVal [ lindex $row $rx_unicast_advertisement_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "state"
set statsVal [ lindex $row $state ]
Deputs "stats val:$statsVal"
switch $statsVal {
"FLOGI Complete" {
set statsVal "UP"
}
default {
set statsVal "DOWN"
}
}
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "sub_state"
set statsVal [ lindex $row $sub_state ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_fdisc_count"
set statsVal [ lindex $row $tx_fdisc_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_flogi_count"
set statsVal [ lindex $row $tx_flogi_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_keep_alive_count"
set statsVal [ lindex $row $tx_keep_alive_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_logo_count"
set statsVal [ lindex $row $tx_logo_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_plogi_count"
set statsVal [ lindex $row $tx_plogi_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_state_change_register_count"
set statsVal [ lindex $row $tx_state_change_register_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_unicast_solicatation_count"
set statsVal [ lindex $row $tx_unicast_solicatation_count ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "world_wide_port_name"
set statsVal [ lindex $row $world_wide_port_name ]
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "keep_alive_period"
set statsVal "NA"
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "max_rx_size"
set statsVal "NA"
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "rx_vlan_notification_count"
set statsVal "NA"
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "tx_vlan_request_count"
set statsVal "NA"
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set statsItem "world_wide_node_name"
set statsVal "NA"
Deputs "stats val:$statsVal"
set ret $ret[ GetStandardReturnBody $statsItem $statsVal ]
set ret "$ret\}\n"
}
Deputs "ret:$ret"
}
ixNet remove $view
ixNet commit
return $ret
}
body FcoeVNPortHost::CreateFcoeVNPerSessionView {} {
set tag "body FcoeVNPortHost::CreateFcoeVNPerSessionView [info script]"
Deputs "----- TAG: $tag -----"
set root [ixNet getRoot]
set customView [ ixNet add $root/statistics view ]
ixNet setM $customView -caption "fcoeVNPerSessionView" -type layer23ProtocolStack -visible true
ixNet commit
set customView [ ixNet remapIds $customView ]
Deputs "view:$customView"
set availableFilter [ ixNet getList $customView availableProtocolStackFilter ]
Deputs "available filter:$availableFilter"
set filter [ ixNet getList $customView layer23ProtocolStackFilter ]
Deputs "filter:$filter"
Deputs "handle:$handle"
set fcRange $handle/fcoeClientFlogiRange
Deputs "fcRange:$fcRange"
set rangeName [ ixNet getA $fcRange -name ]
Deputs "range name:$rangeName"
foreach afil $availableFilter {
Deputs "$afil"
if { [ regexp $rangeName $afil ] } {
set stackFilter $afil
}
}
Deputs "stack filter:$stackFilter"
ixNet setM $filter -drilldownType perSession -protocolStackFilterId [ list $stackFilter ]
ixNet commit
set srtStat [lindex [ixNet getF $customView statistic -caption {Session Name}] 0]
ixNet setA $filter -sortAscending true -sortingStatistic $srtStat
ixNet commit
foreach s [ixNet getL $customView statistic] {
ixNet setA $s -enabled true
}
ixNet setA $customView -enabled true
ixNet commit
return $customView
}
body FcoeVNPortHost::clear_virtual_links {} {
set tag "body FcoeVNPortHost::clear_virtual_links [info script]"
Deputs "----- TAG: $tag -----"
set fcfList [ ixNet getL $hPort/protocolStack fcoeFwdEndpoint ]
if { [ llength $fcfList ] == 0 } {
return [GetErrorReturnHeader "No FCF found in session"]
}
set fcfFound 0
foreach fcf $fcfList {
set fcfRange [ ixNet getL $fcf range ]
set fcMap [ ixNet getA $fcfRange/fcoeFwdVxPort -fcMap ]
if { $fcMap == $fc_map } {
set fcfFound 1
break
}
}
if { $fcfFound } {
$fcf clear_virtual_links
} else {
foreach fcf $fcfList {
$fcf clear_virtual_links
}
}
return [GetStandardReturnHeader]
}
class FcoeVFPortHost {
inherit ProtocolStackObject
public variable fcStack
public variable vn_range
public variable vh_range
constructor { port } { chain $port } {}
method reborn {} {}
method get_fcoe_vf_port_stats {} {}
method get_fcoe_vf_neighbor_stats {} {}
method config { args } {}
method CreateFcoeVFPerSessionView {} {}
method clear_virtual_links {} {}
method start {} {
waitPortReset $hPort 120
set ret [ chain ]
after 3000
return
}
}
body FcoeVFPortHost::reborn {} {
set tag "body FcoeVFPortHost::reborn [info script]"
Deputs "----- TAG: $tag -----"
chain
#-- add fcoe endpoint stack
set fcStack [ ixNet add $stack fcoeFwdEndpoint ]
ixNet setA $fcStack -name $this
ixNet commit
set fcStack [ ixNet remapIds $fcStack ]
#-- add default range
set fcRange [ ixNet add $fcStack range ]
ixNet setA $fcRange/vlanRange -enabled False
ixNet setM $fcRange/fcoeFwdVxPort \
-enabled True \
-nameServer False
ixNet commit
set handle [ ixNet remapIds $fcRange ]
Deputs "handle:$handle"
#-- add node range
set vn_range [ ixNet add $fcStack secondaryRange ]
ixNet commit
set vn_range [ ixNet remapIds $vn_range ]
Deputs "vnRange:$vn_range"
ixNet setM $vn_range/fcoeFwdVnPortRange \
-enabled True \
-count 1 \
-simulated False
ixNet commit
#-- add host range
set vh_range [ ixNet add $fcStack secondaryRange ]
ixNet commit
set vh_range [ ixNet remapIds $vh_range ]
Deputs "vhRange:$vh_range"
ixNet setM $vh_range/fcoeFwdVnPortRange \
-enabled True \
-count 1 \
-simulated True
ixNet commit
}
body FcoeVFPortHost::config { args } {
global errorInfo
global errNumber
set tag "body FcoeVFPortHost::config [info script]"
Deputs "----- TAG: $tag -----"
set index 0
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-negotiated_vlan {
set negotiated_vlan $value
set args [ lreplace $args $index [ expr $index + 1 ] ]
incr index -2
}
}
incr index 2
}
Deputs "Args:$args "
eval { chain } $args
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-host_cnt -
-count {
if { [ string is integer $value ] && ( $value <= 65535 ) } {
set count $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-enable_vlan_discovery {
set trans [ BoolTrans $value ]
if { $trans == "1" || $trans == "0" } {
set enable_vlan_discovery $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-wwpn {
set wwpn $value
}
-wwpn_step {
set wwpn_step $value
}
-wwpn_list {
set wwpn_list $value
}
-wwnn {
set wwpn $value
}
-wwnn_step {
set wwnn_step $value
}
-addressing_mode {
set addressing_mode $value
}
-domain_id {
set domain_id $value
}
-fc_map {
set fc_map $value
}
-fip_priority {
set fip_priority $value
}
-edtov {
set edtov $value
}
-adv_interval -
-adv_interver {
set adv_interval $value
}
-datov {
set datov $value
}
-bb_credit {
set bb_credit $value
}
-max_rcv_size {
set max_rcv_size $value
}
-vlan_id1 -
-vlan_id -
-outer_vlan_id {
if { [ string is integer $value ] && ( $value >= 0 ) && ( $value < 4096 ) } {
set outer_vlan_id $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
}
}
if { [ info exists count ] } {
if { $count } {
ixNet setM $vh_range/fcoeFwdVnPortRange \
-count $count \
-enabled True
} else {
ixNet setM $vh_range/fcoeFwdVnPortRange \
-enabled False
}
}
if { [ info exists enable_vlan_discovery ] } {
ixNet setA $handle/fcoeFwdVxPort -fipVlanDiscovery $enable_vlan_discovery
}
if { [ info exists wwpn ] } {
ixNet setA $vh_range/fcoeFwdVnPortRange -portWwnStart $wwpn
}
if { [ info exists wwpn_step ] } {
ixNet setA $vh_range/fcoeFwdVnPortRange -portWwnIncrement $wwpn_step
}
if { [ info exists wwnn ] } {
ixNet setA $vh_range/fcoeFwdVnPortRange -nodeWwnStart $wwnn
}
if { [ info exists addressing_mode ] } {
ixNet setA $handle/fcoeFwdVxPort -fipAddressingMode $addressing_mode
}
if { [ info exists fc_map ] } {
ixNet setA $handle/fcoeFwdVxPort -fcMap $fc_map
}
if { [ info exists fip_priority ] } {
ixNet setA $handle/fcoeFwdVxPort -fipPriority $fip_priority
}
if { [ info exists bb_credit ] } {
# not supported
}
if { [ info exists max_rcv_size ] } {
ixNet setA $handle/fcoeFwdVxPort -b2bRxSize $max_rcv_size
}
if { [ info exists adv_interval ] } {
ixNet setA $handle/fcoeFwdVxPort -fipAdvertisementPeriod $adv_interval
}
if { [ info exists outer_vlan_id ] } {
ixNet setA $handle/fcoeFwdVxPort -vlanIds $outer_vlan_id
}
ixNet commit
eval { chain } $args
return [GetStandardReturnHeader]
}
body FcoeVFPortHost::CreateFcoeVFPerSessionView {} {
set tag "body FcoeVFPortHost::CreateFcoeVFPerSessionView [info script]"
Deputs "----- TAG: $tag -----"
set root [ixNet getRoot]
set customView [ ixNet add $root/statistics view ]
ixNet setM $customView -caption "fcoeVFPerSessionView" -type layer23ProtocolStack -visible true
ixNet commit
set customView [ ixNet remapIds $customView ]
Deputs "view:$customView"
set availableFilter [ ixNet getList $customView availableProtocolStackFilter ]
Deputs "available filter:$availableFilter"
set filter [ ixNet getList $customView layer23ProtocolStackFilter ]
Deputs "filter:$filter"
Deputs "handle:$handle"
set fcRange $handle/fcoeFwdVxPort
Deputs "fcRange:$fcRange"
set rangeName [ ixNet getA $fcRange -name ]
Deputs "range name:$rangeName"
foreach afil $availableFilter {
Deputs "$afil"
if { [ regexp $rangeName $afil ] } {
set stackFilter $afil
}
}
Deputs "stack filter:$stackFilter"
ixNet setM $filter -drilldownType perSession -protocolStackFilterId [ list $stackFilter ]
ixNet commit
set srtStat [lindex [ixNet getF $customView statistic -caption {Session Name}] 0]
ixNet setA $filter -sortAscending true -sortingStatistic $srtStat
ixNet commit
foreach s [ixNet getL $customView statistic] {
ixNet setA $s -enabled true
}
ixNet setA $customView -enabled true
ixNet commit
return $customView
}
body FcoeVFPortHost::get_fcoe_vf_port_stats {} {
# == Supported Stats ==
# {Stat Name}
# {VN_Ports Registered}
# {NS Requests Rx}
# {NS Accepts Tx}
# {NS Rejects Tx}
# {SCR Requests Rx}
# {SCR Accepts Tx}
# {SCR Rejects Tx}
# {FLOGI Requests Rx}
# {FLOGI LS_ACC Tx}
# {FLOGI LS_RJT Tx}
# {FDISC Requests Rx}
# {FDISC LS_ACC Tx}
# {FDISC LS_RJT Tx}
# {FLOGO Requests Rx}
# {FLOGO LS_ACC Tx}
# {FLOGO LS_RJT Tx}
# {PLOGI Requests Rx}
# {PLOGI LS_ACC Tx}
# {PLOGI LS_RJT Tx}
# {PLOGO Requests Rx}
# {PLOGO LS_ACC Tx}
# {PLOGO LS_RJT Tx}
# {PLOGI Requests Tx}
# {PLOGI LS_ACC Rx}
# {PLOGI LS_RJT Rx}
# {PLOGO Requests Tx}
# {PLOGO LS_ACC Rx}
# {PLOGO LS_RJT Rx}
# {Discovery Solicitations Rx}
# {Discovery Advertisements Tx}
# {VLAN Requests Rx}
# {VLAN Notifications Tx}
# {Unsolicited Discovery Advertisements Tx}
# {ENode Keep-Alives Rx}
# {ENode Keep-Alives Miss}
# {Unexpected ENode Keep-Alives Rx}
# {VN_Port Keep-Alives Rx}
# {VN_Port Keep-Alives Miss}
# {Unexpected VN_Port Keep-Alives Rx}
# {Clear Virtual Links VN_Ports}
# {Clear Virtual Links Tx}
# {Clear Virtual Links Rx}
set tag "body Port::get_stats [info script]"
Deputs "----- TAG: $tag -----"
#{::ixNet::OBJ-/statistics/view:"Port Statistics"}
set root [ixNet getRoot]
set view {::ixNet::OBJ-/statistics/view:"FCoE VF_Port"}
# set view [ ixNet getF $root/statistics view -caption "Port Statistics" ]
Deputs "view:$view"
set captionList [ ixNet getA $view/page -columnCaptions ]
Deputs "caption list:$captionList"
# == Request Stats ==
# state
# neighbor_count
# rx_fdisc_count
# rx_flogi_count
# rx_keep_alive_count
# rx_logo_count
# rx_plogi_count
# rx_solicitation_count
# rx_vlan_request_count
# tx_advertisement_count
# tx_clear_virtual_links_count
# tx_fdisc_accept_count
# tx_flogi_acept_count
# tx_logo_count
# tx_multicast_advertisement_count
# tx_plogi_accept_count
# tx_vlan_notification_count
set port_name [ lsearch -exact $captionList {Stat Name} ]
set state_req [ lsearch -exact $captionList {NS Requests Rx} ]
set state_acc [ lsearch -exact $captionList {NS Accepts Tx} ]
set state_rej [ lsearch -exact $captionList {NS Rejects Tx} ]
set neighbor_count [ lsearch -exact $captionList {VN_Ports Registered} ]
set rx_fdisc_count [ lsearch -exact $captionList {FDISC Requests Rx} ]
set rx_flogi_count [ lsearch -exact $captionList {FLOGI Requests Rx} ]
set rx_keep_alive_count [ lsearch -exact $captionList {ENode Keep-Alives Rx} ]
set rx_logo_count [ lsearch -exact $captionList {FLOGO Requests Rx} ]
set rx_plogi_count [ lsearch -exact $captionList {PLOGI Requests Rx} ]
set rx_solicitation_count [ lsearch -exact $captionList {Discovery Solicitations Rx} ]
set rx_vlan_request_count [ lsearch -exact $captionList {VLAN Requests Rx} ]
set tx_advertisement_count [ lsearch -exact $captionList {Discovery Advertisements Tx} ]
set tx_clear_virtual_links_count [ lsearch -exact $captionList {Clear Virtual Links VN_Ports} ]
set tx_fdisc_accept_count [ lsearch -exact $captionList {FDISC LS_ACC Tx} ]
set tx_flogi_acept_count [ lsearch -exact $captionList {FLOGI LS_ACC Tx} ]
set tx_logo_count [ lsearch -exact $captionList {FLOGO LS_ACC Tx} ]
set tx_multicast_advertisement_count [ lsearch -exact $captionList {Unsolicited Discovery Advertisements Tx} ]
set tx_plogi_accept_count [ lsearch -exact $captionList {PLOGI LS_ACC Tx} ]
set tx_vlan_notification_count [ lsearch -exact $captionList {VLAN Notifications Tx} ]
set ret "[ GetStandardReturnHeader ]{\n"
set stats [ ixNet getA $view/page -rowValues ]
Deputs "stats:$stats"
set connectionInfo [ ixNet getA $hPort -connectionInfo ]
Deputs "connectionInfo :$connectionInfo"
regexp -nocase {chassis=\"([0-9\.]+)\" card=\"([0-9\.]+)\" port=\"([0-9\.]+)\"} $connectionInfo match chassis card port
Deputs "chas:$chassis card:$card port$port"
foreach row $stats {
eval {set row} $row
Deputs "row:$row"
Deputs "portname:[ lindex $row $port_name ]"
if { [ string length $card ] == 1 } {
set card "0$card"
}
if { [ string length $port ] == 1 } {
set port "0$port"
}
if { "${chassis}/Card${card}/Port${port}" != [ lindex $row $port_name ] } {
continue
}
set statsItem "state"
set state_req [ lindex $row $state_req ]
set state_acc [ lindex $row $state_acc ]
set state_rej [ lindex $row $state_rej ]
if { $state_req == $state_acc && $state_rej == 0 } {
set statsVal UP
} else {
set statsVal DOWN
}