Summary
The summary of XOA HL-API (object-oriented) is provided in the attached file.
You can find set
and get
method of APIs of tester
, module
, port
, stream
, and impairment flow
.
See also
Read more about Get and Set Method
1import asyncio
2
3from xoa_driver import testers
4from xoa_driver import modules
5from xoa_driver import ports
6from xoa_driver import enums
7from xoa_driver import utils
8from xoa_driver import misc
9from xoa_driver.hlfuncs import mgmt
10from xoa_driver.misc import Hex
11from xoa_driver.lli import commands
12import ipaddress
13
14
15async def my_awesome_func(stop_event: asyncio.Event):
16
17# region Tester
18 #################################################
19 # Tester #
20 #################################################
21 tester = await testers.L23Tester(
22 host="10.10.10.10",
23 username="my_name",
24 password="xena",
25 enable_logging=False)
26
27 # Shutdown/Restart
28 await tester.down.set(operation=enums.ChassisShutdownAction.POWER_OFF)
29 await tester.down.set_poweroff()
30 await tester.down.set(operation=enums.ChassisShutdownAction.RESTART)
31 await tester.down.set_restart()
32
33 # Flash
34 await tester.flash.set(on_off=enums.OnOff.OFF)
35 await tester.flash.set_off()
36 await tester.flash.set(on_off=enums.OnOff.ON)
37 await tester.flash.set_on()
38
39 resp = await tester.flash.get()
40 resp.on_off
41
42 # Debug Log
43 resp = await tester.debug_log.get()
44 resp.data
45 resp.message_length
46
47 # IP Address
48 await tester.management_interface.ip_address.set(
49 ipv4_address=ipaddress.IPv4Address("10.10.10.10"),
50 subnet_mask=ipaddress.IPv4Address("255.255.255.0"),
51 gateway=ipaddress.IPv4Address("10.10.10.1"))
52
53 resp = await tester.management_interface.ip_address.get()
54 resp.ipv4_address
55 resp.subnet_mask
56 resp.gateway
57
58 # MAC Address
59 resp = await tester.management_interface.macaddress.get()
60 resp.mac_address
61
62 # Hostname
63 await tester.management_interface.hostname.set(hostname="name")
64
65 resp = await tester.management_interface.hostname.get()
66 resp.hostname
67
68 # DHCP
69 await tester.management_interface.dhcp.set(on_off=enums.OnOff.ON)
70 await tester.management_interface.dhcp.set_on()
71 await tester.management_interface.dhcp.set(on_off=enums.OnOff.OFF)
72 await tester.management_interface.dhcp.set_off()
73
74 resp = await tester.management_interface.dhcp.get()
75 resp.on_off
76
77 # Capabilities
78 resp = await tester.capabilities.get()
79 resp.version
80 resp.max_name_len
81 resp.max_comment_len
82 resp.max_password_len
83 resp.max_ext_rate
84 resp.max_session_count
85 resp.max_chain_depth
86 resp.max_module_count
87 resp.max_protocol_count
88 resp.can_stream_based_arp
89 resp.can_sync_traffic_start
90 resp.can_read_log_files
91 resp.can_par_module_upgrade
92 resp.can_upgrade_timekeeper
93 resp.can_custom_defaults
94 resp.max_owner_name_length
95 resp.can_read_temperatures
96 resp.can_latency_f2f
97
98 # Name
99 await tester.name.set(chassis_name="name")
100
101 resp = await tester.name.get()
102 resp.chassis_name
103
104 # Password
105 await tester.password.set(password="xena")
106
107 resp = await tester.password.get()
108 resp.password
109
110 # Description
111 await tester.comment.set(comment="description")
112
113 resp = await tester.comment.get()
114 resp.comment
115
116 # Model
117 resp = await tester.model.get()
118 resp.model
119
120 # Serial Number
121 resp = await tester.serial_no.get()
122 resp.serial_number
123
124 # Firmware Version
125 resp = await tester.version_no.get()
126 resp.chassis_major_version
127 resp.pci_driver_version
128
129 resp = await tester.version_no_minor.get()
130 resp.chassis_minor_version
131 resp.reserved_1
132 resp.reserved_2
133
134 # Build String
135 resp = await tester.build_string.get()
136 resp.build_string
137
138 # Reservation
139 await tester.reservation.set(operation=enums.ReservedAction.RELEASE)
140 await tester.reservation.set_release()
141 await tester.reservation.set(operation=enums.ReservedAction.RELINQUISH)
142 await tester.reservation.set_relinquish()
143 await tester.reservation.set(operation=enums.ReservedAction.RESERVE)
144 await tester.reservation.set_reserve()
145
146 resp = await tester.reservation.get()
147 resp.operation
148
149 # Reserved By
150 resp = await tester.reserved_by.get()
151 resp.username
152
153 # Information
154 # The following are pre-fetched in cache when connection is established, thus no need to use await
155
156 tester.session.owner_name
157 tester.session.keepalive
158 tester.session.pwd
159 tester.session.is_online
160 tester.session.sessions_info
161 tester.session.timeout
162 tester.is_released()
163 tester.is_reserved_by_me()
164
165 # Logoff
166 await tester.session.logoff()
167
168 # Time
169 resp = await tester.time.get()
170 resp.local_time
171
172 # TimeKeeper Configuration
173 await tester.time_keeper.config_file.set(config_file="filename")
174
175 resp = await tester.time_keeper.config_file.get()
176 resp.config_file
177
178 # TimeKeeper GPS State
179 resp = await tester.time_keeper.gps_state.get()
180 resp.status
181
182 # TimeKeeper License File
183 await tester.time_keeper.license_file.set(license_content="")
184
185 resp = await tester.time_keeper.license_file.get()
186 resp.license_content
187
188 # TimeKeeper License State
189 resp = await tester.time_keeper.license_state.get()
190 resp.license_errors
191 resp.license_file_state
192 resp.license_type
193
194 # TimeKeeper Status
195 resp = await tester.time_keeper.status.get()
196 resp.status_string
197
198 resp = await tester.time_keeper.status_extended.get()
199 resp.status_string
200
201 # Chassis Traffic
202 await tester.traffic.set(on_off=enums.OnOff.ON, module_ports=[0,0,0,1])
203 await tester.traffic.set(on_off=enums.OnOff.OFF, module_ports=[0,0,0,1])
204 await tester.traffic.set_on(module_ports=[0,0,0,1])
205 await tester.traffic.set_off(module_ports=[0,0,0,1])
206
207 # Synchronized Chassis Traffic
208 await tester.traffic_sync.set(on_off=enums.OnOff.ON, timestamp=1234567, module_ports=[0,0,0,1])
209 await tester.traffic_sync.set(on_off=enums.OnOff.OFF, timestamp=1234567, module_ports=[0,0,0,1])
210 await tester.traffic_sync.set_on(timestamp=1234567, module_ports=[0,0,0,1])
211 await tester.traffic_sync.set_off(timestamp=1234567, module_ports=[0,0,0,1])
212
213# endregion
214
215# region Module
216 #################################################
217 # Module #
218 #################################################
219
220 # Access module index 0 on the tester
221 module = tester.modules.obtain(0)
222
223 # Capabilities
224 resp = await module.capabilities.get()
225 resp.can_advanced_timing
226 resp.can_local_time_adjust
227 resp.can_media_config
228 resp.can_ppm_sweep
229 resp.can_tsn
230 resp.is_chimera
231 resp.max_clock_ppm
232
233 # Name
234 resp = await module.name.get()
235 resp.name
236
237 # Description
238 await module.comment.set(comment="description")
239
240 resp = await module.comment.get()
241 resp.comment
242
243 # Legacy Model
244 resp = await module.model.get()
245 resp.model
246
247 # Model
248 resp = await module.revision.get()
249 resp.revision
250
251 # Serial Number
252 resp = await module.serial_number.get()
253 resp.serial_number
254
255 # Firmware Version
256 resp = await module.version_number.get()
257 resp.version
258
259 # Port Count
260 resp = await module.port_count.get()
261 resp.port_count
262
263 # Status
264 resp = await module.status.get()
265 resp.temperature
266
267 # Media Configuration
268 await module.media.set(media_config=enums.MediaConfigurationType.BASE_T1)
269 await module.media.set(media_config=enums.MediaConfigurationType.BASE_T1S)
270 await module.media.set(media_config=enums.MediaConfigurationType.CFP)
271 await module.media.set(media_config=enums.MediaConfigurationType.CFP4)
272 await module.media.set(media_config=enums.MediaConfigurationType.CXP)
273 await module.media.set(media_config=enums.MediaConfigurationType.OSFP800)
274 await module.media.set(media_config=enums.MediaConfigurationType.OSFP800_ANLT)
275 await module.media.set(media_config=enums.MediaConfigurationType.QSFP112)
276 await module.media.set(media_config=enums.MediaConfigurationType.QSFP112_ANLT)
277 await module.media.set(media_config=enums.MediaConfigurationType.QSFP28_NRZ)
278 await module.media.set(media_config=enums.MediaConfigurationType.QSFP28_PAM4)
279 await module.media.set(media_config=enums.MediaConfigurationType.QSFP56_PAM4)
280 await module.media.set(media_config=enums.MediaConfigurationType.QSFPDD_NRZ)
281 await module.media.set(media_config=enums.MediaConfigurationType.QSFPDD_PAM4)
282 await module.media.set(media_config=enums.MediaConfigurationType.QSFPDD800)
283 await module.media.set(media_config=enums.MediaConfigurationType.QSFPDD800_ANLT)
284 await module.media.set(media_config=enums.MediaConfigurationType.SFP112)
285 await module.media.set(media_config=enums.MediaConfigurationType.SFP28)
286 await module.media.set(media_config=enums.MediaConfigurationType.SFP56)
287 await module.media.set(media_config=enums.MediaConfigurationType.SFPDD)
288
289 resp = await module.media.get()
290 resp.media_config
291
292 # Supported Media
293 resp = await module.available_speeds.get()
294 resp.media_info_list
295
296 # Port Configuration
297 await module.cfp.config.set(portspeed_list=[1, 800000])
298 await module.cfp.config.set(portspeed_list=[2, 400000, 400000])
299 await module.cfp.config.set(portspeed_list=[4, 200000, 200000, 200000, 200000])
300 await module.cfp.config.set(portspeed_list=[8, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000])
301
302 resp = await module.cfp.config.get()
303 resp.portspeed_list
304
305 # Reservation
306 await module.reservation.set(operation=enums.ReservedAction.RELEASE)
307 await module.reservation.set_release()
308 await module.reservation.set(operation=enums.ReservedAction.RELINQUISH)
309 await module.reservation.set_relinquish()
310 await module.reservation.set(operation=enums.ReservedAction.RESERVE)
311 await module.reservation.set_reserve()
312
313 resp = await module.reservation.get()
314 resp.operation
315
316 # Reserved By
317 resp = await module.reserved_by.get()
318 resp.username
319
320 # TX Clock Filter Loop Bandwidth
321 if not isinstance(module, modules.ModuleChimera):
322 await module.advanced_timing.clock_tx.filter.set(filter_bandwidth=enums.LoopBandwidth.BW103HZ)
323 await module.advanced_timing.clock_tx.filter.set_bw103hz()
324 await module.advanced_timing.clock_tx.filter.set(filter_bandwidth=enums.LoopBandwidth.BW1683HZ)
325 await module.advanced_timing.clock_tx.filter.set_bw1683hz()
326 await module.advanced_timing.clock_tx.filter.set(filter_bandwidth=enums.LoopBandwidth.BW207HZ)
327 await module.advanced_timing.clock_tx.filter.set_bw207hz()
328 await module.advanced_timing.clock_tx.filter.set(filter_bandwidth=enums.LoopBandwidth.BW416HZ)
329 await module.advanced_timing.clock_tx.filter.set_bw416hz()
330 await module.advanced_timing.clock_tx.filter.set(filter_bandwidth=enums.LoopBandwidth.BW7019HZ)
331 await module.advanced_timing.clock_tx.filter.set_bw7019hz()
332
333 resp = await module.advanced_timing.clock_tx.filter.get()
334 resp.filter_bandwidth
335
336 # TX Clock Source
337 if not isinstance(module, modules.ModuleChimera):
338 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.MODULELOCALCLOCK)
339 await module.advanced_timing.clock_tx.source.set_modulelocalclock()
340 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P0RXCLK)
341 await module.advanced_timing.clock_tx.source.set_p0rxclk()
342 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P1RXCLK)
343 await module.advanced_timing.clock_tx.source.set_p1rxclk()
344 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P2RXCLK)
345 await module.advanced_timing.clock_tx.source.set_p2rxclk()
346 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P3RXCLK)
347 await module.advanced_timing.clock_tx.source.set_p3rxclk()
348 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P4RXCLK)
349 await module.advanced_timing.clock_tx.source.set_p4rxclk()
350 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P5RXCLK)
351 await module.advanced_timing.clock_tx.source.set_p5rxclk()
352 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P6RXCLK)
353 await module.advanced_timing.clock_tx.source.set_p6rxclk()
354 await module.advanced_timing.clock_tx.source.set(tx_clock=enums.TXClockSource.P7RXCLK)
355 await module.advanced_timing.clock_tx.source.set_p7rxclk()
356
357 resp = await module.advanced_timing.clock_tx.source.get()
358 resp.tx_clock
359
360 # TX Clock Status
361 if not isinstance(module, modules.ModuleChimera):
362 resp = await module.advanced_timing.clock_tx.status.get()
363 resp.status
364
365 # SMA Status
366 if not isinstance(module, modules.ModuleChimera):
367 resp = await module.advanced_timing.sma.status.get()
368 resp.status
369
370 # SMA Input
371 if not isinstance(module, modules.ModuleChimera):
372 await module.advanced_timing.sma.input.set(sma_in=enums.SMAInputFunction.NOT_USED)
373 await module.advanced_timing.sma.input.set_notused()
374 await module.advanced_timing.sma.input.set(sma_in=enums.SMAInputFunction.TX10MHZ)
375 await module.advanced_timing.sma.input.set_tx10mhz()
376 await module.advanced_timing.sma.input.set(sma_in=enums.SMAInputFunction.TX2MHZ)
377 await module.advanced_timing.sma.input.set_tx2mhz()
378
379 resp = await module.advanced_timing.sma.input.get()
380 resp.sma_in
381
382 # SMA Output
383 if not isinstance(module, modules.ModuleChimera):
384 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.DISABLED)
385 await module.advanced_timing.sma.output.set_disabled()
386 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P0RXCLK)
387 await module.advanced_timing.sma.output.set_p0rxclk()
388 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P0RXCLK2MHZ)
389 await module.advanced_timing.sma.output.set_p0rxclk2mhz()
390 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P0SOF)
391 await module.advanced_timing.sma.output.set_p0sof()
392 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P1RXCLK)
393 await module.advanced_timing.sma.output.set_p1rxclk()
394 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P1RXCLK2MHZ)
395 await module.advanced_timing.sma.output.set_p1rxclk2mhz()
396 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.P1SOF)
397 await module.advanced_timing.sma.output.set_p1sof()
398 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.PASSTHROUGH)
399 await module.advanced_timing.sma.output.set_passthrough()
400 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.REF10MHZ)
401 await module.advanced_timing.sma.output.set_ref10mhz()
402 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.REF125MHZ)
403 await module.advanced_timing.sma.output.set_ref125mhz()
404 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.REF156MHZ)
405 await module.advanced_timing.sma.output.set_ref156mhz()
406 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.REF2MHZ)
407 await module.advanced_timing.sma.output.set_ref2mhz()
408 await module.advanced_timing.sma.output.set(sma_out=enums.SMAOutputFunction.TS_PPS)
409 await module.advanced_timing.sma.output.set_ts_pps()
410
411 resp = await module.advanced_timing.sma.output.get()
412 resp.sma_out
413
414 # Local Clock Adjust
415 await module.timing.clock_local_adjust.set(ppb=10)
416
417 resp = await module.timing.clock_local_adjust.get()
418 resp.ppb
419
420 # Clock Sync Status
421 resp = await module.timing.clock_sync_status.get()
422 resp.m_clock_diff
423 resp.m_correction
424 resp.m_is_steady_state
425 resp.m_tune_is_increase
426 resp.m_tune_value
427
428 # Clock Source
429 await module.timing.source.set(source=enums.TimingSource.CHASSIS)
430 await module.timing.source.set_chassis()
431 await module.timing.source.set(source=enums.TimingSource.EXTERNAL)
432 await module.timing.source.set_external()
433 await module.timing.source.set(source=enums.TimingSource.MODULE)
434 await module.timing.source.set_module()
435
436 resp = await module.timing.source.get()
437 resp.source
438
439 # Clock PPM Sweep Configuration
440 FREYA_MODULES = (modules.MFreya800G4S1P_a, modules.MFreya800G4S1P_b, modules.MFreya800G4S1POSFP_a, modules.MFreya800G4S1POSFP_b)
441 if isinstance(module, FREYA_MODULES):
442 await module.clock_sweep.config.set(mode=enums.PPMSweepMode.OFF, ppb_step=10, step_delay=10, max_ppb=10, loops=1)
443 await module.clock_sweep.config.set(mode=enums.PPMSweepMode.TRIANGLE, ppb_step=10, step_delay=10, max_ppb=10, loops=1)
444
445 resp = await module.clock_sweep.config.get()
446 resp.mode
447 resp.ppb_step
448 resp.step_delay
449 resp.max_ppb
450 resp.loops
451
452 # Clock PPM Sweep Status
453 if isinstance(module, FREYA_MODULES):
454 resp = await module.clock_sweep.status.get()
455 resp.curr_step
456 resp.curr_sweep
457 resp.max_steps
458
459
460 # Chimera - Bypass Mode
461 if isinstance(module, modules.ModuleChimera):
462 await module.emulator_bypass_mode.set(on_off=enums.OnOff.ON)
463 await module.emulator_bypass_mode.set_on()
464 await module.emulator_bypass_mode.set(on_off=enums.OnOff.OFF)
465 await module.emulator_bypass_mode.set_off()
466
467 resp = await module.emulator_bypass_mode.get()
468 resp.on_off
469
470 # Chimera - Latency Mode
471 if isinstance(module, modules.ModuleChimera):
472 await module.latency_mode.set(mode=enums.ImpairmentLatencyMode.NORMAL)
473 await module.latency_mode.set_normal()
474 await module.latency_mode.set(mode=enums.ImpairmentLatencyMode.EXTENDED)
475 await module.latency_mode.set_extended()
476
477 resp = await module.latency_mode.get()
478 resp.mode
479
480 # Chimera - TX Clock Source
481 if isinstance(module, modules.ModuleChimera):
482 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.MODULELOCALCLOCK)
483 await module.tx_clock.source.set_modulelocalclock()
484 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P0RXCLK)
485 await module.tx_clock.source.set_p0rxclk()
486 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P1RXCLK)
487 await module.tx_clock.source.set_p1rxclk()
488 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P2RXCLK)
489 await module.tx_clock.source.set_p2rxclk()
490 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P3RXCLK)
491 await module.tx_clock.source.set_p3rxclk()
492 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P4RXCLK)
493 await module.tx_clock.source.set_p4rxclk()
494 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P5RXCLK)
495 await module.tx_clock.source.set_p5rxclk()
496 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P6RXCLK)
497 await module.tx_clock.source.set_p6rxclk()
498 await module.tx_clock.source.set(tx_clock=enums.TXClockSource.P7RXCLK)
499 await module.tx_clock.source.set_p7rxclk()
500
501 resp = await module.tx_clock.source.get()
502 resp.tx_clock
503
504 # Chimera - TX Clock Status
505 if isinstance(module, modules.ModuleChimera):
506 resp = await module.tx_clock.status.get()
507 resp.status
508
509# endregion
510
511# region Port
512 #################################################
513 # Port #
514 #################################################
515
516 port = module.ports.obtain(0)
517
518 # Reset
519 await port.reset.set()
520
521 if isinstance(port, ports.PortChimera):
522 return
523
524 # Flash
525 await port.flash.set(on_off=enums.OnOff.ON)
526 await port.flash.set_on()
527 await port.flash.set(on_off=enums.OnOff.OFF)
528 await port.flash.set_off()
529
530 resp = await port.flash.get()
531 resp.on_off
532
533
534 # MAC Address
535 await port.net_config.mac_address.set(mac_address=Hex("000000000000"))
536
537 resp = await port.net_config.mac_address.get()
538 resp.mac_address
539
540 # IPv4 Address
541 await port.net_config.ipv4.address.set(
542 ipv4_address=ipaddress.IPv4Address("10.10.10.10"),
543 subnet_mask=ipaddress.IPv4Address("255.255.255.0"),
544 gateway=ipaddress.IPv4Address("10.10.1.1"),
545 wild=ipaddress.IPv4Address("0.0.0.0"))
546
547 resp = await port.net_config.ipv4.address.get()
548 resp.ipv4_address
549 resp.gateway
550 resp.subnet_mask
551 resp.wild
552
553 # ARP Reply
554 await port.net_config.ipv4.arp_reply.set(on_off=enums.OnOff.ON)
555 await port.net_config.ipv4.arp_reply.set(on_off=enums.OnOff.OFF)
556
557 resp = await port.net_config.ipv4.arp_reply.get()
558 resp.on_off
559
560 # Ping Reply
561 await port.net_config.ipv4.ping_reply.set(on_off=enums.OnOff.ON)
562 await port.net_config.ipv4.ping_reply.set(on_off=enums.OnOff.OFF)
563
564 resp = await port.net_config.ipv4.ping_reply.get()
565 resp.on_off
566
567 # IPv6 Address
568 await port.net_config.ipv6.address.set(
569 ipv6_address=ipaddress.IPv6Address("fc00::0002"),
570 gateway=ipaddress.IPv6Address("fc00::0001"),
571 subnet_prefix=7,
572 wildcard_prefix=0
573 )
574
575 resp = await port.net_config.ipv6.address.get()
576 resp.ipv6_address
577 resp.gateway
578 resp.subnet_prefix
579 resp.wildcard_prefix
580
581 # NDP Reply
582 await port.net_config.ipv6.arp_reply.set(on_off=enums.OnOff.ON)
583 await port.net_config.ipv6.arp_reply.set(on_off=enums.OnOff.OFF)
584
585 resp = await port.net_config.ipv6.arp_reply.get()
586 resp.on_off
587
588 # IPv6 Ping Reply
589 await port.net_config.ipv6.ping_reply.set(on_off=enums.OnOff.ON)
590 await port.net_config.ipv6.ping_reply.set(on_off=enums.OnOff.OFF)
591
592 resp = await port.net_config.ipv6.ping_reply.get()
593 resp.on_off
594
595 # ARP Table, https://github.com/xenanetworks/open-automation-script-library/tree/main/ip_streams_arp_table
596 await port.arp_rx_table.set(chunks=[])
597
598 resp = await port.arp_rx_table.get()
599 resp.chunks
600
601 # NDP Table, https://github.com/xenanetworks/open-automation-script-library/tree/main/ip_streams_arp_table
602 await port.ndp_rx_table.set(chunks=[])
603
604 resp = await port.ndp_rx_table.get()
605 resp.chunks
606
607 # Capture Trigger Criteria, https://github.com/xenanetworks/open-automation-script-library/blob/main/packet_capture/packet_capture.py
608 await port.capturer.trigger.set(start_criteria=enums.StartTrigger.ON, start_criteria_filter=0, stop_criteria=enums.StopTrigger.FULL, stop_criteria_filter=0)
609 await port.capturer.trigger.set(start_criteria=enums.StartTrigger.ON, start_criteria_filter=0, stop_criteria=enums.StopTrigger.USERSTOP, stop_criteria_filter=0)
610 await port.capturer.trigger.set(start_criteria=enums.StartTrigger.FCSERR, start_criteria_filter=0, stop_criteria=enums.StopTrigger.FCSERR, stop_criteria_filter=0)
611 await port.capturer.trigger.set(start_criteria=enums.StartTrigger.PLDERR, start_criteria_filter=0, stop_criteria=enums.StopTrigger.PLDERR, stop_criteria_filter=0)
612 await port.capturer.trigger.set(start_criteria=enums.StartTrigger.FILTER, start_criteria_filter=0, stop_criteria=enums.StopTrigger.FILTER, stop_criteria_filter=0)
613
614 resp = await port.capturer.trigger.get()
615 resp.start_criteria
616 resp.start_criteria_filter
617 resp.stop_criteria
618 resp.stop_criteria_filter
619
620 # Capture - Frame to Keep, https://github.com/xenanetworks/open-automation-script-library/blob/main/packet_capture/packet_capture.py
621 await port.capturer.keep.set(kind=enums.PacketType.ALL, index=0, byte_count=0)
622 await port.capturer.keep.set_all()
623 await port.capturer.keep.set(kind=enums.PacketType.FCSERR, index=0, byte_count=0)
624 await port.capturer.keep.set_fcserr()
625 await port.capturer.keep.set(kind=enums.PacketType.FILTER, index=0, byte_count=0)
626 await port.capturer.keep.set_filter()
627 await port.capturer.keep.set(kind=enums.PacketType.NOTPLD, index=0, byte_count=0)
628 await port.capturer.keep.set_notpld()
629 await port.capturer.keep.set(kind=enums.PacketType.PLDERR, index=0, byte_count=0)
630 await port.capturer.keep.set_plderr()
631 await port.capturer.keep.set(kind=enums.PacketType.TPLD, index=0, byte_count=0)
632 await port.capturer.keep.set_tpld()
633
634 resp = await port.capturer.keep.get()
635 resp.kind
636 resp.index
637 resp.byte_count
638
639 # Capture - State
640 await port.capturer.state.set(on_off=enums.StartOrStop.START)
641 await port.capturer.state.set_start()
642 await port.capturer.state.set(on_off=enums.StartOrStop.STOP)
643 await port.capturer.state.set_stop()
644
645 resp = await port.capturer.state.get()
646 resp.on_off
647
648 # Capture - Statistics
649 resp = await port.capturer.stats.get()
650 resp.start_time
651 resp.status
652
653 # Read Captured Packets
654 pkts = await port.capturer.obtain_captured()
655 for i in range(len(pkts)):
656 resp = await pkts[i].packet.get()
657 print(f"Packet content # {i}: {resp.hex_data}")
658
659 # Inter-frame Gap
660 await port.interframe_gap.set(min_byte_count=20)
661
662 resp = await port.interframe_gap.get()
663 resp.min_byte_count
664
665 # PAUSE Frames
666 await port.pause.set(on_off=enums.OnOff.ON)
667 await port.pause.set_on()
668 await port.pause.set(on_off=enums.OnOff.OFF)
669 await port.pause.set_off()
670
671 resp = await port.pause.get()
672 resp.on_off
673
674 # Auto-Train
675 await port.autotrain.set(interval=1)
676
677 resp = await port.autotrain.get()
678 resp.interval
679
680 # Gap Monitor
681 await port.gap_monitor.set(start=100, stop=10)
682
683 resp = await port.gap_monitor.get()
684 resp.start
685 resp.stop
686
687 # Priority Flow Control
688 await port.pfc_enable.set(
689 cos_0=enums.OnOff.ON,
690 cos_1=enums.OnOff.OFF,
691 cos_2=enums.OnOff.ON,
692 cos_3=enums.OnOff.OFF,
693 cos_4=enums.OnOff.ON,
694 cos_5=enums.OnOff.OFF,
695 cos_6=enums.OnOff.ON,
696 cos_7=enums.OnOff.OFF,
697 )
698
699 resp = await port.pfc_enable.get()
700 resp.cos_0
701 resp.cos_1
702 resp.cos_2
703 resp.cos_3
704 resp.cos_4
705 resp.cos_5
706 resp.cos_6
707 resp.cos_7
708
709 # Loopback
710 await port.loop_back.set(mode=enums.LoopbackMode.L1RX2TX)
711 await port.loop_back.set_l1rx2tx()
712 await port.loop_back.set(mode=enums.LoopbackMode.L2RX2TX)
713 await port.loop_back.set_l2rx2tx()
714 await port.loop_back.set(mode=enums.LoopbackMode.L3RX2TX)
715 await port.loop_back.set_l3rx2tx()
716 await port.loop_back.set(mode=enums.LoopbackMode.NONE)
717 await port.loop_back.set_none()
718 await port.loop_back.set(mode=enums.LoopbackMode.PORT2PORT)
719 await port.loop_back.set_port2port()
720 await port.loop_back.set(mode=enums.LoopbackMode.TXOFF2RX)
721 await port.loop_back.set_txoff2rx()
722 await port.loop_back.set(mode=enums.LoopbackMode.TXON2RX)
723 await port.loop_back.set_txon2rx()
724
725 resp = await port.loop_back.get()
726 resp.mode
727
728 # BRR Mode
729 await port.brr_mode.set(mode=enums.BRRMode.MASTER)
730 await port.brr_mode.set_master()
731 await port.brr_mode.set(mode=enums.BRRMode.SLAVE)
732 await port.brr_mode.set_slave()
733
734 resp = await port.brr_mode.get()
735 resp.mode
736
737 # MDI/MDIX Mode
738 await port.mdix_mode.set(mode=enums.MDIXMode.AUTO)
739 await port.mdix_mode.set_auto()
740 await port.mdix_mode.set(mode=enums.MDIXMode.MDI)
741 await port.mdix_mode.set_mdi()
742 await port.mdix_mode.set(mode=enums.MDIXMode.MDIX)
743 await port.mdix_mode.set_mdix()
744
745 resp = await port.mdix_mode.get()
746 resp.mode
747
748 # EEE- Capabilities
749 resp = await port.eee.capabilities.get()
750 resp.eee_capabilities
751
752 # EEE - Partner Capabilities
753 resp = await port.eee.partner_capabilities.get()
754 resp.cap_1000base_t
755 resp.cap_100base_kx
756 resp.cap_10gbase_kr
757 resp.cap_10gbase_kx4
758 resp.cap_10gbase_t
759
760 # EEE - Control
761 await port.eee.enable.set(on_off=enums.OnOff.OFF)
762 await port.eee.enable.set_off()
763 await port.eee.enable.set(on_off=enums.OnOff.ON)
764 await port.eee.enable.set_on()
765
766 resp = await port.eee.enable.get()
767 resp.on_off
768
769 # EEE - Low Power TX Mode
770 await port.eee.mode.set(on_off=enums.OnOff.ON)
771 await port.eee.mode.set_off()
772 await port.eee.mode.set(on_off=enums.OnOff.OFF)
773 await port.eee.mode.set_on()
774
775 resp = await port.eee.mode.get()
776 resp.on_off
777
778 # EEE - RX Power
779 resp = await port.eee.rx_power.get()
780 resp.channel_a
781 resp.channel_b
782 resp.channel_c
783 resp.channel_d
784
785 # EEE - SNR Margin
786 resp = await port.eee.snr_margin.get()
787 resp.channel_a
788 resp.channel_b
789 resp.channel_c
790 resp.channel_d
791
792 # EEE - Status
793 resp = await port.eee.status.get()
794 resp.link_up
795 resp.rxc
796 resp.rxh
797 resp.txc
798 resp.txh
799
800 # Fault - Signaling
801 await port.fault.signaling.set(fault_signaling=enums.FaultSignaling.DISABLED)
802 await port.fault.signaling.set_disabled()
803 await port.fault.signaling.set(fault_signaling=enums.FaultSignaling.FORCE_LOCAL)
804 await port.fault.signaling.set_force_local()
805 await port.fault.signaling.set(fault_signaling=enums.FaultSignaling.FORCE_REMOTE)
806 await port.fault.signaling.set_force_remote()
807 await port.fault.signaling.set(fault_signaling=enums.FaultSignaling.NORMAL)
808 await port.fault.signaling.set_normal()
809
810 resp = await port.fault.signaling.get()
811 resp.fault_signaling
812
813 # Fault - Status
814 resp = await port.fault.status.get()
815 resp.local_fault_status
816 resp.remote_fault_status
817
818 # Interface
819 resp = await port.interface.get()
820 resp.interface
821
822 # Description
823 await port.comment.set(comment="description")
824
825 resp = await port.comment.get()
826 resp.comment
827
828 # Status
829 resp = await port.status.get()
830 resp.optical_power
831
832 # Latency Mode
833 if not isinstance(port, ports.PortChimera):
834 await port.latency_config.mode.set(mode=enums.LatencyMode.FIRST2FIRST)
835 await port.latency_config.mode.set_first2first()
836 await port.latency_config.mode.set(mode=enums.LatencyMode.FIRST2LAST)
837 await port.latency_config.mode.set_first2last()
838 await port.latency_config.mode.set(mode=enums.LatencyMode.LAST2FIRST)
839 await port.latency_config.mode.set_last2first()
840 await port.latency_config.mode.set(mode=enums.LatencyMode.LAST2LAST)
841 await port.latency_config.mode.set_last2last()
842
843 resp = await port.latency_config.mode.get()
844 resp.mode
845
846 # Latency Offset
847 if not isinstance(port, ports.PortChimera):
848 await port.latency_config.offset.set(offset=5)
849
850 resp = await port.latency_config.offset.get()
851 resp.offset
852
853 # Link Flap - Control
854 await port.pcs_pma.link_flap.enable.set(on_off=enums.OnOff.ON)
855 await port.pcs_pma.link_flap.enable.set_on()
856 await port.pcs_pma.link_flap.enable.set(on_off=enums.OnOff.OFF)
857 await port.pcs_pma.link_flap.enable.set_off()
858
859 resp = await port.pcs_pma.link_flap.enable.get()
860 resp.on_off
861
862 # Link Flap - Configuration
863 await port.pcs_pma.link_flap.params.set(duration=10, period=20, repetition=0)
864
865 resp = await port.pcs_pma.link_flap.params.get()
866 resp.duration
867 resp.period
868 resp.repetition
869
870 # Multicast Mode
871 await port.multicast.mode.set(
872 ipv4_multicast_addresses=[],
873 operation=enums.MulticastOperation.JOIN,
874 second_count=10)
875 await port.multicast.mode.set(
876 ipv4_multicast_addresses=[],
877 operation=enums.MulticastOperation.JOIN,
878 second_count=10)
879 await port.multicast.mode.set(
880 ipv4_multicast_addresses=[],
881 operation=enums.MulticastOperation.LEAVE,
882 second_count=10)
883 await port.multicast.mode.set(
884 ipv4_multicast_addresses=[],
885 operation=enums.MulticastOperation.OFF,
886 second_count=10)
887 await port.multicast.mode.set(
888 ipv4_multicast_addresses=[],
889 operation=enums.MulticastOperation.ON,
890 second_count=10)
891
892 resp = await port.multicast.mode.get()
893 resp.ipv4_multicast_addresses
894 resp.operation
895 resp.second_count
896
897 # Multicast Extended Mode
898 await port.multicast.mode_extended.set(
899 ipv4_multicast_addresses=[],
900 operation=enums.MulticastExtOperation.EXCLUDE,
901 second_count=10,
902 igmp_version=enums.IGMPVersion.IGMPV3
903 )
904 await port.multicast.mode_extended.set(
905 ipv4_multicast_addresses=[],
906 operation=enums.MulticastExtOperation.INCLUDE,
907 second_count=10,
908 igmp_version=enums.IGMPVersion.IGMPV3
909 )
910 await port.multicast.mode_extended.set(
911 ipv4_multicast_addresses=[],
912 operation=enums.MulticastExtOperation.JOIN,
913 second_count=10,
914 igmp_version=enums.IGMPVersion.IGMPV2
915 )
916 await port.multicast.mode_extended.set(
917 ipv4_multicast_addresses=[],
918 operation=enums.MulticastExtOperation.LEAVE,
919 second_count=10,
920 igmp_version=enums.IGMPVersion.IGMPV2
921 )
922 await port.multicast.mode_extended.set(
923 ipv4_multicast_addresses=[],
924 operation=enums.MulticastExtOperation.LEAVE_TO_ALL,
925 second_count=10,
926 igmp_version=enums.IGMPVersion.IGMPV2
927 )
928 await port.multicast.mode_extended.set(
929 ipv4_multicast_addresses=[],
930 operation=enums.MulticastExtOperation.GENERAL_QUERY,
931 second_count=10,
932 igmp_version=enums.IGMPVersion.IGMPV2
933 )
934 await port.multicast.mode_extended.set(
935 ipv4_multicast_addresses=[],
936 operation=enums.MulticastExtOperation.GROUP_QUERY,
937 second_count=10,
938 igmp_version=enums.IGMPVersion.IGMPV2
939 )
940 await port.multicast.mode_extended.set(
941 ipv4_multicast_addresses=[],
942 operation=enums.MulticastExtOperation.ON,
943 second_count=10,
944 igmp_version=enums.IGMPVersion.IGMPV2
945 )
946 await port.multicast.mode_extended.set(
947 ipv4_multicast_addresses=[],
948 operation=enums.MulticastExtOperation.OFF,
949 second_count=10,
950 igmp_version=enums.IGMPVersion.IGMPV2
951 )
952
953 resp = await port.multicast.mode_extended.get()
954 resp.ipv4_multicast_addresses
955 resp.operation
956 resp.second_count
957 resp.igmp_version
958
959 # Multicast Source List
960 await port.multicast.source_list.set(ipv4_addresses=[])
961
962 resp = await port.multicast.source_list.get()
963 resp.ipv4_addresses
964
965
966 # Multicast Header
967 await port.multicast.header.set(header_count=1, header_format=enums.MulticastHeaderFormat.VLAN, tag=10, pcp=0, dei=0)
968 await port.multicast.header.set(header_count=0, header_format=enums.MulticastHeaderFormat.NOHDR, tag=10, pcp=0, dei=0)
969
970 resp = await port.multicast.header.get()
971 resp.header_count
972 resp.header_format
973 resp.tag
974 resp.pcp
975 resp.dei
976
977 # Random Seed
978 await port.random_seed.set(seed=1)
979
980 resp = await port.random_seed.get()
981 resp.seed
982
983 # Checksum Offset
984 await port.checksum.set(offset=14)
985
986 resp = await port.checksum.get()
987 resp.offset
988
989 # Maximum Header Length
990 await port.max_header_length.set(max_header_length=56)
991
992 resp = await port.max_header_length.get()
993 resp.max_header_length
994
995 # MIX Weights
996 await port.mix.weights.set(
997 weight_56_bytes:=0,
998 weight_60_bytes:=0,
999 weight_64_bytes:=70,
1000 weight_70_bytes:=15,
1001 weight_78_bytes:=15,
1002 weight_92_bytes:=0,
1003 weight_256_bytes:=0,
1004 weight_496_bytes:=0,
1005 weight_512_bytes:=0,
1006 weight_570_bytes:=0,
1007 weight_576_bytes:=0,
1008 weight_594_bytes:=0,
1009 weight_1438_bytes:=0,
1010 weight_1518_bytes:=0,
1011 weight_9216_bytes:=0,
1012 weight_16360_bytes:=0)
1013
1014 resp = await port.mix.weights.get()
1015 resp.weight_56_bytes
1016 resp.weight_60_bytes
1017 resp.weight_64_bytes
1018 resp.weight_70_bytes
1019 resp.weight_78_bytes
1020 resp.weight_92_bytes
1021 resp.weight_256_bytes
1022 resp.weight_496_bytes
1023 resp.weight_512_bytes
1024 resp.weight_570_bytes
1025 resp.weight_576_bytes
1026 resp.weight_594_bytes
1027 resp.weight_1438_bytes
1028 resp.weight_1518_bytes
1029 resp.weight_9216_bytes
1030 resp.weight_16360_bytes
1031
1032 # MIX Lengths
1033 await port.mix.lengths[0].set(frame_size=56)
1034 await port.mix.lengths[1].set(frame_size=60)
1035 await port.mix.lengths[14].set(frame_size=9216)
1036 await port.mix.lengths[15].set(frame_size=16360)
1037
1038 resp = await port.mix.lengths[0].get()
1039 resp.frame_size
1040 resp = await port.mix.lengths[1].get()
1041 resp.frame_size
1042 resp = await port.mix.lengths[14].get()
1043 resp.frame_size
1044 resp = await port.mix.lengths[15].get()
1045 resp.frame_size
1046
1047 # Payload Mode
1048 await port.payload_mode.set(mode=enums.PayloadMode.NORMAL)
1049 await port.payload_mode.set_normal()
1050 await port.payload_mode.set(mode=enums.PayloadMode.EXTPL)
1051 await port.payload_mode.set_extpl()
1052 await port.payload_mode.set(mode=enums.PayloadMode.CDF)
1053 await port.payload_mode.set_cdf()
1054
1055 resp = await port.payload_mode.get()
1056 resp.mode
1057
1058 # RX Preamble Insert
1059 await port.preamble.rx_insert.set(on_off=enums.OnOff.ON)
1060 await port.preamble.rx_insert.set(on_off=enums.OnOff.OFF)
1061
1062 resp = await port.preamble.rx_insert.get()
1063 resp.on_off
1064
1065 # TX Preamble Removal
1066 await port.preamble.tx_remove.set(on_off=enums.OnOff.ON)
1067 await port.preamble.tx_remove.set(on_off=enums.OnOff.OFF)
1068
1069 resp = await port.preamble.tx_remove.get()
1070 resp.on_off
1071
1072 # Reservation
1073 await port.reservation.set(operation=enums.ReservedAction.RELEASE)
1074 await port.reservation.set_release()
1075 await port.reservation.set(operation=enums.ReservedAction.RELINQUISH)
1076 await port.reservation.set_relinquish()
1077 await port.reservation.set(operation=enums.ReservedAction.RESERVE)
1078 await port.reservation.set_reserve()
1079
1080 resp = await port.reservation.get()
1081 resp.status
1082
1083 # Reserved By
1084 resp = await port.reserved_by.get()
1085 resp.username
1086
1087 # Runt - RX Length
1088 await port.runt.rx_length.set(runt_length=40)
1089
1090 resp = await port.runt.rx_length.get()
1091 resp.runt_length
1092
1093 # Runt - TX Length
1094 await port.runt.tx_length.set(runt_length=40)
1095
1096 resp = await port.runt.tx_length.get()
1097 resp.runt_length
1098
1099 # Runt - Length Error
1100 resp = await port.runt.has_length_errors.get()
1101 resp.status
1102
1103 # Speed Mode Selection
1104 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.AUTO)
1105 await port.speed.mode.selection.set_auto()
1106 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F10M)
1107 await port.speed.mode.selection.set_f10m()
1108 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F10M100M)
1109 await port.speed.mode.selection.set_f10m100m()
1110 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F10MHDX)
1111 await port.speed.mode.selection.set_f10mhdx()
1112 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100M)
1113 await port.speed.mode.selection.set_f100m()
1114 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100M1G)
1115 await port.speed.mode.selection.set_f100m1g()
1116 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100M1G10G)
1117 await port.speed.mode.selection.set_f100m1g10g()
1118 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100M1G2500M)
1119 await port.speed.mode.selection.set_f100m1g2500m()
1120 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100MHDX)
1121 await port.speed.mode.selection.set_f100mhdx()
1122 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F1G)
1123 await port.speed.mode.selection.set_f1g()
1124 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F2500M)
1125 await port.speed.mode.selection.set_f2500m()
1126 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F5G)
1127 await port.speed.mode.selection.set_f5g()
1128 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F10G)
1129 await port.speed.mode.selection.set_f10g()
1130 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F40G)
1131 await port.speed.mode.selection.set_f40g()
1132 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F100G)
1133 await port.speed.mode.selection.set_f100g()
1134 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.UNKNOWN)
1135 await port.speed.mode.selection.set_unknown()
1136 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F200G)
1137 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F400G)
1138 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F800G)
1139 await port.speed.mode.selection.set(mode=enums.PortSpeedMode.F1600G)
1140
1141 resp = await port.speed.mode.selection.get()
1142 resp.mode
1143
1144 # Supported Speed Modes
1145 resp = await port.speed.mode.supported.get()
1146 resp.auto
1147 resp.f10M
1148 resp.f100M
1149 resp.f1G
1150 resp.f10G
1151 resp.f40G
1152 resp.f100G
1153 resp.f10MHDX
1154 resp.f100MHDX
1155 resp.f10M100M
1156 resp.f100M1G
1157 resp.f100M1G10G
1158 resp.f2500M
1159 resp.f5G
1160 resp.f100M1G2500M
1161 resp.f25G
1162 resp.f50G
1163 resp.f200G
1164 resp.f400G
1165 resp.f800G
1166 resp.f1600G
1167
1168 # Current Speed
1169 resp = await port.speed.current.get()
1170 resp.port_speed
1171
1172 # Speed Reduction
1173 await port.speed.reduction.set(ppm=100)
1174
1175 resp = await port.speed.reduction.get()
1176 resp.ppm
1177
1178 # Sync Status
1179 resp = await port.sync_status.get()
1180 resp.sync_status == enums.SyncStatus.IN_SYNC
1181 resp.sync_status == enums.SyncStatus.NO_SYNC
1182
1183 # Transceiver Status
1184 resp = await port.tcvr_status.get()
1185 resp.rx_loss_lane_0
1186 resp.rx_loss_lane_1
1187 resp.rx_loss_lane_2
1188 resp.rx_loss_lane_3
1189
1190 # Transceiver Read & Write
1191 my_int = 1234
1192 await port.transceiver.access_rw(page_address=0, register_address=0).set(value=hex(my_int)[2:])
1193
1194 resp = await port.transceiver.access_rw(page_address=0, register_address=0).get()
1195 resp.value
1196 my_int_resp = int(resp.value, 16)
1197 print(f"Returned value: {my_int_resp}")
1198
1199 # Transceiver Sequential Read & Write
1200 await port.transceiver.access_rw_seq(page_address=0, register_address=0, byte_count=4).set(value=Hex("00FF00FF"))
1201
1202 resp = await port.transceiver.access_rw_seq(page_address=0, register_address=0, byte_count=4).get()
1203 resp.value
1204
1205 # Transceiver Sequential Read & Write (banked)
1206 await port.transceiver.access_rw_seq_bank(bank_address=1, page_address=0x9F, register_address=200, byte_count=1).set(value=Hex("00"))
1207
1208 resp = await port.transceiver.access_rw_seq_bank(bank_address=1, page_address=0x9F, register_address=200, byte_count=1).get()
1209 resp.value
1210
1211 # Transceiver MII
1212 await port.transceiver.access_mii(register_address=0).set(value=Hex("00"))
1213
1214 resp = await port.transceiver.access_mii(register_address=0).get()
1215 resp.value
1216
1217 # Transceiver Temperature
1218 resp = await port.transceiver.access_temperature().get()
1219 resp.integral_part
1220 resp.fractional_part
1221
1222 # Transceiver RX Laser Power
1223 resp = await port.pcs_pma.transceiver.rx_laser_power.get()
1224 resp.nanowatts
1225
1226 # Transceiver TX Laser Power
1227 resp = await port.pcs_pma.transceiver.tx_laser_power.get()
1228 resp.nanowatts
1229
1230 # Traffic Control - Rate Percent
1231 await port.rate.fraction.set(port_rate_ppm=1_000_000)
1232
1233 resp = await port.rate.fraction.get()
1234 resp.port_rate_ppm
1235
1236 # Traffic Control - Rate L2 Bits Per Second
1237 await port.rate.l2_bps.set(port_rate_bps=1_000_000)
1238
1239 resp = await port.rate.l2_bps.get()
1240 resp.port_rate_bps
1241
1242 # Traffic Control - Rate Frames Per Second
1243 await port.rate.pps.set(port_rate_pps=10_000)
1244
1245 resp = await port.rate.pps.get()
1246 resp.port_rate_pps
1247
1248 # Traffic Control - Start and Stop
1249 await port.traffic.state.set(on_off=enums.StartOrStop.START)
1250 await port.traffic.state.set_start()
1251 await port.traffic.state.set(on_off=enums.StartOrStop.STOP)
1252 await port.traffic.state.set_stop()
1253
1254 resp = await port.traffic.state.get()
1255 resp.on_off
1256
1257 # Traffic Control - Traffic Error
1258 resp = await port.traffic.error.get()
1259 resp.error
1260
1261 # Traffic Control - Single Frame TX
1262 await port.tx_single_pkt.send.set(hex_data=Hex("00000000000102030405060800FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"))
1263
1264 # Traffic Control - Single Frame Time
1265 resp = await port.tx_single_pkt.time.get()
1266 resp.nanoseconds
1267
1268 # TPLD Mode
1269 await port.tpld_mode.set(mode=enums.TPLDMode.NORMAL)
1270 await port.tpld_mode.set_normal()
1271 await port.tpld_mode.set(mode=enums.TPLDMode.MICRO)
1272 await port.tpld_mode.set_micro()
1273
1274 resp = await port.tpld_mode.get()
1275 resp.mode
1276
1277 # TX Mode
1278 await port.tx_config.mode.set(mode=enums.TXMode.NORMAL)
1279 await port.tx_config.mode.set_normal()
1280 await port.tx_config.mode.set(mode=enums.TXMode.BURST)
1281 await port.tx_config.mode.set_burst()
1282 await port.tx_config.mode.set(mode=enums.TXMode.SEQUENTIAL)
1283 await port.tx_config.mode.set_sequential()
1284 await port.tx_config.mode.set(mode=enums.TXMode.STRICTUNIFORM)
1285 await port.tx_config.mode.set_strictuniform()
1286
1287 resp = await port.tx_config.mode.get()
1288 resp.mode
1289
1290 # Burst Period
1291 await port.tx_config.burst_period.set(burst_period=100)
1292
1293 resp = await port.tx_config.burst_period.get()
1294 resp.burst_period
1295
1296 # TX Delay
1297 await port.tx_config.delay.set(delay_val=100)
1298
1299 resp = await port.tx_config.delay.get()
1300 resp.delay_val
1301
1302 # TX Enable
1303 await port.tx_config.enable.set(on_off=enums.OnOff.ON)
1304 await port.tx_config.enable.set(on_off=enums.OnOff.OFF)
1305
1306 resp = await port.tx_config.enable.get()
1307 resp.on_off
1308
1309 # Packet Limit
1310 await port.tx_config.packet_limit.set(packet_count_limit=1_000_000)
1311
1312 resp = await port.tx_config.packet_limit.get()
1313 resp.packet_count_limit
1314
1315 # Time Limit
1316 await port.tx_config.time_limit.set(microseconds=1_000_000)
1317
1318 resp = await port.tx_config.time_limit.get()
1319 resp.microseconds
1320
1321 # TX Time Elapsed
1322 resp = await port.tx_config.time.get()
1323 resp.microseconds
1324
1325 # Prepare TX
1326 await port.tx_config.prepare.set()
1327
1328 # Dynamic Traffic Rate
1329 await port.dynamic.set(on_off=enums.OnOff.OFF)
1330 await port.dynamic.set_off()
1331 await port.dynamic.set(on_off=enums.OnOff.ON)
1332 await port.dynamic.set_on()
1333
1334 resp = await port.dynamic.get()
1335 resp.on_off
1336
1337 await port.uat.mode.set(mode=enums.OnOff.ON, delay=500)
1338 await port.uat.mode.set(mode=enums.OnOff.OFF, delay=500)
1339 await port.uat.frame_loss_ratio.get()
1340
1341 #################################################
1342 # Port Filter #
1343 #################################################
1344
1345 # Create and Obtain
1346 # Create a filter on the port, and obtain the filter object. The filter index is automatically assigned by the port.
1347 filter = await port.filters.create()
1348
1349 # Obtain One or Multiple
1350 filter = port.filters.obtain(position_idx=0)
1351 filter_list = port.filters.obtain_multiple(*[0,1,2])
1352
1353 # Remove
1354 # Remove a filter on the port with an explicit filter index by the index manager of the port.
1355 await port.filters.remove(position_idx=0)
1356
1357 # Filter - Enable
1358 await filter.enable.set(on_off=enums.OnOff.ON)
1359 await filter.enable.set_on()
1360 await filter.enable.set(on_off=enums.OnOff.OFF)
1361 await filter.enable.set_off()
1362
1363 resp = await filter.enable.get()
1364 resp.on_off
1365
1366 # Filter - Description
1367 await filter.comment.set(comment="this is a comment")
1368
1369 resp = await filter.comment.get()
1370 resp.comment
1371
1372 # Filter - Condition
1373 await filter.condition.set(and_expression_0=0, and_not_expression_0=0, and_expression_1=1, and_not_expression_1=0, and_expression_2=0, and_expression_3=0)
1374
1375 resp = await filter.condition.get()
1376 resp.and_expression_0
1377 resp.and_not_expression_0
1378 resp.and_expression_1
1379 resp.and_not_expression_1
1380 resp.and_expression_2
1381 resp.and_expression_3
1382
1383 # Filter - String Representation
1384 await filter.string.set(string_name="this is name")
1385
1386 resp = await filter.string.get()
1387 resp.string_name
1388
1389 #################################################
1390 # Port Length Term #
1391 #################################################
1392
1393 # Create and Obtain
1394 # Create a length term on the port, and obtain the length term object. The length term index is automatically assigned by the port.
1395 length_term = await port.length_terms.create()
1396
1397 # Obtain One or Multiple
1398 length_term = port.length_terms.obtain(key=0)
1399 length_term_list = port.length_terms.obtain_multiple(*[0,1,2])
1400
1401 # Remove
1402 # Remove a length term on the port with an explicit length term index by the index manager of the port.
1403 await port.length_terms.remove(position_idx=0)
1404
1405 #################################################
1406 # Port Match Term #
1407 #################################################
1408
1409 # Create and Obtain
1410 # Create a match term on the port, and obtain the match term object. The match term index is automatically assigned by the port.
1411 match_term = await port.match_terms.create()
1412
1413 # Obtain One or Multiple
1414 length_term = port.match_terms.obtain(key=0)
1415 length_term_list = port.match_terms.obtain_multiple(*[0,1,2])
1416
1417 # Remove
1418 # Remove a match term on the port with an explicit match term index by the index manager of the port.
1419 await port.match_terms.remove(position_idx=0)
1420
1421 #################################################
1422 # Port Histogram #
1423 #################################################
1424
1425 # Create and Obtain
1426 # Create a histogram on the port, and obtain the histogram object. The histogram index is automatically assigned by the port.
1427 dataset = await port.datasets.create()
1428
1429 # Obtain One or Multiple
1430 length_term = port.datasets.obtain(key=0)
1431 length_term_list = port.datasets.obtain_multiple(*[0,1,2])
1432
1433 # Remove
1434 # Remove a histogram on the port with an explicit histogram index by the index manager of the port.
1435 await port.datasets.remove(position_idx=0)
1436
1437 #################################################
1438 # Port PCS/PMA #
1439 #################################################
1440
1441 # Auto-Negotiation Settings
1442 resp = await port.pcs_pma.auto_neg.settings.get()
1443 resp.tec_ability
1444 resp.fec_capable
1445 resp.fec_requested
1446 resp.pause_mode
1447
1448 # Auto-Negotiation Status
1449 resp = await port.pcs_pma.auto_neg.status.get()
1450 resp.mode
1451 resp.auto_state
1452 resp.tec_ability
1453 resp.fec_capable
1454 resp.fec_requested
1455 resp.fec
1456 resp.pause_mode
1457
1458 # Auto-Negotiation Selection
1459 # Only applicable to RJ45 ports
1460 await port.autoneg_selection.set(on_off=enums.OnOff.ON)
1461 await port.autoneg_selection.set_on()
1462 await port.autoneg_selection.set(on_off=enums.OnOff.OFF)
1463 await port.autoneg_selection.set_off()
1464
1465 resp = await port.autoneg_selection.get()
1466 resp.on_off
1467
1468 # FEC Mode
1469 await port.pcs_pma.phy.auto_neg.set(fec_mode=enums.OnOff.ON,reserved_1=0, reserved_2=0, reserved_3=0, reserved_4=0)
1470
1471 await port.fec_mode.set(mode=enums.FECMode.RS_FEC)
1472 await port.fec_mode.set(mode=enums.FECMode.RS_FEC_KP)
1473 await port.fec_mode.set(mode=enums.FECMode.RS_FEC_KR)
1474 await port.fec_mode.set(mode=enums.FECMode.FC_FEC)
1475 await port.fec_mode.set(mode=enums.FECMode.OFF)
1476 await port.fec_mode.set(mode=enums.FECMode.ON)
1477
1478 resp = await port.fec_mode.get()
1479 resp.mode
1480
1481 # Link Training Settings
1482 await port.pcs_pma.link_training.settings.set(
1483 mode=enums.LinkTrainingMode.DISABLED,
1484 pam4_frame_size=enums.PAM4FrameSize.P4K_FRAME,
1485 nrz_pam4_init_cond=enums.LinkTrainingInitCondition.NO_INIT,
1486 nrz_preset=enums.NRZPreset.NRZ_WITH_PRESET,
1487 timeout_mode=enums.TimeoutMode.DEFAULT)
1488 await port.pcs_pma.link_training.settings.set(
1489 mode=enums.LinkTrainingMode.STANDALONE,
1490 pam4_frame_size=enums.PAM4FrameSize.P4K_FRAME,
1491 nrz_pam4_init_cond=enums.LinkTrainingInitCondition.NO_INIT,
1492 nrz_preset=enums.NRZPreset.NRZ_WITH_PRESET,
1493 timeout_mode=enums.TimeoutMode.DEFAULT)
1494 await port.pcs_pma.link_training.settings.set(
1495 mode=enums.LinkTrainingMode.INTERACTIVE,
1496 pam4_frame_size=enums.PAM4FrameSize.P4K_FRAME,
1497 nrz_pam4_init_cond=enums.LinkTrainingInitCondition.NO_INIT,
1498 nrz_preset=enums.NRZPreset.NRZ_WITH_PRESET,
1499 timeout_mode=enums.TimeoutMode.DISABLED)
1500 await port.pcs_pma.link_training.settings.set(
1501 mode=enums.LinkTrainingMode.START_AFTER_AUTONEG,
1502 pam4_frame_size=enums.PAM4FrameSize.P4K_FRAME,
1503 nrz_pam4_init_cond=enums.LinkTrainingInitCondition.NO_INIT,
1504 nrz_preset=enums.NRZPreset.NRZ_WITH_PRESET,
1505 timeout_mode=enums.TimeoutMode.DEFAULT)
1506
1507 resp = await port.pcs_pma.link_training.settings.get()
1508 resp.mode
1509 resp.pam4_frame_size
1510 resp.nrz_pam4_init_cond
1511 resp.nrz_preset
1512 resp.timeout_mode
1513
1514 # Link Training Serdes Status
1515 resp = await port.pcs_pma.link_training.per_lane_status[0].get()
1516 resp.mode
1517 resp.failure
1518 resp.status
1519
1520 # PMA Pulse Error Inject Control
1521 await port.pcs_pma.pma_pulse_err_inj.enable.set(on_off=enums.OnOff.ON)
1522 await port.pcs_pma.pma_pulse_err_inj.enable.set_on()
1523 await port.pcs_pma.pma_pulse_err_inj.enable.set(on_off=enums.OnOff.OFF)
1524 await port.pcs_pma.pma_pulse_err_inj.enable.set_off()
1525
1526 resp = await port.pcs_pma.pma_pulse_err_inj.enable.get()
1527 resp.on_off
1528
1529 # PMA Pulse Error Inject Configuration
1530 await port.pcs_pma.pma_pulse_err_inj.params.set(duration=1000, period=1000, repetition=10, coeff=5, exp=-5)
1531
1532 resp = await port.pcs_pma.pma_pulse_err_inj.params.get()
1533 resp.duration
1534 resp.period
1535 resp.coeff
1536 resp.exp
1537
1538 # RX Status - Lane Error Counters
1539 resp = await port.pcs_pma.lanes[0].rx_status.errors.get()
1540 resp.alignment_error_count
1541 resp.corrected_fec_error_count
1542 resp.header_error_count
1543
1544 # RX Status - Lock Status
1545 resp = await port.pcs_pma.lanes[0].rx_status.lock.get()
1546 resp.align_lock
1547 resp.header_lock
1548
1549 # RX Status - Lane Status
1550 resp = await port.pcs_pma.lanes[0].rx_status.status.get()
1551 resp.skew
1552 resp.virtual_lane
1553
1554 # RX Status - Clear Counters
1555 await port.pcs_pma.rx.clear.set()
1556
1557 # RX Status - RX FEC Stats
1558 resp = await port.pcs_pma.rx.fec_status.get()
1559 resp.stats_type
1560 resp.data_count
1561 resp.stats
1562
1563 # RX Status - RX Total Stats
1564 resp = await port.pcs_pma.rx.total_status.get()
1565 resp.total_corrected_codeword_count
1566 resp.total_corrected_symbol_count
1567 resp.total_post_fec_ber
1568 resp.total_pre_fec_ber
1569 resp.total_rx_bit_count
1570 resp.total_rx_codeword_count
1571 resp.total_uncorrectable_codeword_count
1572
1573 # TX Configuration - Error Counters
1574 resp = await port.pcs_pma.alarms.errors.get()
1575 resp.total_alarms
1576 resp.los_error_count
1577 resp.total_align_error_count
1578 resp.total_bip_error_count
1579 resp.total_fec_error_count
1580 resp.total_header_error_count
1581 resp.total_higher_error_count
1582 resp.total_pcs_error_count
1583 resp.valid_mask
1584
1585 # TX Configuration - Error Generation Rate
1586 resp = await port.pcs_pma.error_gen.error_rate.get()
1587 resp.rate
1588
1589 # TX Configuration - Error Generation Inject
1590 await port.pcs_pma.error_gen.inject_one.set()
1591
1592 # TX Configuration - Error Injection
1593 await port.pcs_pma.lanes[0].tx_error_inject.set_alignerror()
1594 await port.pcs_pma.lanes[0].tx_error_inject.set_bip8error()
1595 await port.pcs_pma.lanes[0].tx_error_inject.set_headererror()
1596
1597 # TX Configuration - Lane Configuration
1598 await port.pcs_pma.lanes[0].tx_config.set(virt_lane_index=1, skew=10)
1599
1600 resp = await port.pcs_pma.lanes[0].tx_config.get()
1601 resp.virt_lane_index
1602 resp.skew
1603
1604 #################################################
1605 # Port Medium #
1606 #################################################
1607
1608 # Eye Diagram Information
1609 resp = await port.serdes[0].eye_diagram.info.get()
1610 resp.width_mui
1611 resp.height_mv
1612 resp.h_slope_left
1613 resp.h_slope_right
1614 resp.y_intercept_left
1615 resp.y_intercept_right
1616 resp.r_squared_fit_left
1617 resp.r_squared_fit_right
1618 resp.est_rj_rms_left
1619 resp.est_rj_rms_right
1620 resp.est_dj_pp
1621 resp.v_slope_bottom
1622 resp.v_slope_top
1623 resp.x_intercept_bottom
1624 resp.x_intercept_top
1625 resp.r_squared_fit_bottom
1626 resp.r_squared_fit_top
1627 resp.est_rj_rms_bottom
1628 resp.est_rj_rms_top
1629
1630 # Eye Diagram Bit Error Rate
1631 resp = await port.serdes[0].eye_diagram.ber.get()
1632 resp.eye_ber_estimation
1633
1634 # Eye Diagram Dwell Bits
1635 resp = await port.serdes[0].eye_diagram.dwell_bits.get()
1636 resp.max_dwell_bit_count
1637 resp.min_dwell_bit_count
1638
1639 # Eye Diagram Measure
1640 resp = await port.serdes[0].eye_diagram.measure.get()
1641 resp.status
1642
1643 # Eye Diagram Resolution
1644 resp = await port.serdes[0].eye_diagram.resolution.get()
1645 resp.x_resolution
1646 resp.y_resolution
1647
1648 # Eye Diagram Data Columns
1649 resp = await port.serdes[0].eye_diagram.read_column[0].get()
1650 resp.valid_column_count
1651 resp.values
1652 resp.x_resolution
1653 resp.y_resolution
1654
1655 # PHY - Signal Status
1656 resp = await port.pcs_pma.phy.signal_status.get()
1657 resp.phy_signal_status
1658
1659 # PHY - Settings
1660 await port.pcs_pma.phy.settings.set(
1661 link_training_on_off=enums.OnOff.ON,
1662 precode_on_off=enums.OnOffDefault.DEFAULT,
1663 graycode_on_off=enums.OnOff.OFF, pam4_msb_lsb_swap=enums.OnOff.OFF)
1664
1665 resp = await port.pcs_pma.phy.settings.get()
1666 resp.link_training_on_off
1667 resp.precode_on_off
1668 resp.graycode_on_off
1669 resp.pam4_msb_lsb_swap
1670
1671 # TX Tap Autotune
1672 await port.serdes[0].phy.autotune.set(on_off=enums.OnOff.ON)
1673 await port.serdes[0].phy.autotune.set_on()
1674 await port.serdes[0].phy.autotune.set(on_off=enums.OnOff.OFF)
1675 await port.serdes[0].phy.autotune.set_off()
1676
1677 resp = await port.serdes[0].phy.autotune.get()
1678 resp.on_off
1679
1680 # TX Tap Retune
1681 await port.serdes[0].phy.retune.set(dummy=1)
1682
1683 # TX Tap Configuration
1684 await port.serdes[0].phy.tx_equalizer.set(pre2=0, pre1=0, main=86, post1=0, post2=0, post3=0)
1685 resp = await port.serdes[0].phy.tx_equalizer.get()
1686 resp.pre2
1687 resp.pre
1688 resp.main
1689 resp.post
1690 resp.pre3_post2
1691 resp.post3
1692
1693 # RX Tap Configuration
1694 await port.serdes[0].phy.rx_equalizer.set(auto=0, ctle=0, reserved=0)
1695
1696 resp = await port.serdes[0].phy.rx_equalizer.get()
1697 resp.auto
1698 resp.ctle
1699
1700 #################################################
1701 # Port PRBS #
1702 #################################################
1703
1704 # PRBS Configuration
1705 await port.serdes[0].prbs.config.type.set(
1706 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1707 polynomial=enums.PRBSPolynomial.PRBS7,
1708 invert=enums.PRBSInvertState.NON_INVERTED,
1709 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1710 await port.serdes[0].prbs.config.type.set(
1711 prbs_inserted_type=enums.PRBSInsertedType.CAUI_VIRTUAL,
1712 polynomial=enums.PRBSPolynomial.PRBS9,
1713 invert=enums.PRBSInvertState.NON_INVERTED,
1714 statistics_mode=enums.PRBSStatisticsMode.PERSECOND)
1715 await port.serdes[0].prbs.config.type.set(
1716 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1717 polynomial=enums.PRBSPolynomial.PRBS10,
1718 invert=enums.PRBSInvertState.NON_INVERTED,
1719 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1720 await port.serdes[0].prbs.config.type.set(
1721 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1722 polynomial=enums.PRBSPolynomial.PRBS11,
1723 invert=enums.PRBSInvertState.NON_INVERTED,
1724 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1725 await port.serdes[0].prbs.config.type.set(
1726 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1727 polynomial=enums.PRBSPolynomial.PRBS13,
1728 invert=enums.PRBSInvertState.NON_INVERTED,
1729 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1730 await port.serdes[0].prbs.config.type.set(
1731 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1732 polynomial=enums.PRBSPolynomial.PRBS15,
1733 invert=enums.PRBSInvertState.NON_INVERTED,
1734 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1735 await port.serdes[0].prbs.config.type.set(
1736 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1737 polynomial=enums.PRBSPolynomial.PRBS20,
1738 invert=enums.PRBSInvertState.NON_INVERTED,
1739 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1740 await port.serdes[0].prbs.config.type.set(
1741 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1742 polynomial=enums.PRBSPolynomial.PRBS23,
1743 invert=enums.PRBSInvertState.NON_INVERTED,
1744 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1745 await port.serdes[0].prbs.config.type.set(
1746 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1747 polynomial=enums.PRBSPolynomial.PRBS31,
1748 invert=enums.PRBSInvertState.NON_INVERTED,
1749 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1750 await port.serdes[0].prbs.config.type.set(
1751 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1752 polynomial=enums.PRBSPolynomial.PRBS49,
1753 invert=enums.PRBSInvertState.NON_INVERTED,
1754 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1755 await port.serdes[0].prbs.config.type.set(
1756 prbs_inserted_type=enums.PRBSInsertedType.PHY_LINE,
1757 polynomial=enums.PRBSPolynomial.PRBS58,
1758 invert=enums.PRBSInvertState.NON_INVERTED,
1759 statistics_mode=enums.PRBSStatisticsMode.ACCUMULATIVE)
1760
1761 resp = await port.serdes[0].prbs.config.type.get()
1762 resp.prbs_inserted_type
1763 resp.polynomial
1764 resp.invert
1765 resp.statistics_mode
1766
1767
1768 # PRBS Statistics
1769 resp = await port.serdes[0].prbs.status.get()
1770 resp.byte_count
1771 resp.error_count
1772 resp.lock
1773# endregion
1774
1775# region Statistics
1776 #################################################
1777 # Statistics #
1778 #################################################
1779
1780 # Error Counter
1781 resp = await port.errors_count.get()
1782 resp.error_count
1783
1784 # RX Statistics - Clear Counter
1785 await port.statistics.rx.clear.set()
1786
1787 # RX Statistics - Calibrate
1788 await port.statistics.rx.calibrate.set()
1789
1790 # RX Statistics - Total Counter
1791 resp = await port.statistics.rx.total.get()
1792 resp.byte_count_since_cleared
1793 resp.packet_count_since_cleared
1794 resp.bit_count_last_sec
1795 resp.packet_count_last_sec
1796
1797 # RX Statistics - Non-TPLD Counter
1798 resp = await port.statistics.rx.no_tpld.get()
1799 resp.byte_count_since_cleared
1800 resp.packet_count_since_cleared
1801 resp.bit_count_last_sec
1802 resp.packet_count_last_sec
1803
1804 # RX Statistics - PFC Counter
1805 resp = await port.statistics.rx.pfc_stats.get()
1806 resp.packet_count
1807 resp.quanta_pri_0
1808 resp.quanta_pri_1
1809 resp.quanta_pri_2
1810 resp.quanta_pri_3
1811 resp.quanta_pri_4
1812 resp.quanta_pri_5
1813 resp.quanta_pri_6
1814 resp.quanta_pri_7
1815
1816 # RX Statistics - Extra Counter
1817 resp = await port.statistics.rx.extra.get()
1818 resp.fcs_error_count
1819 resp.pause_frame_count
1820 resp.gap_count
1821 resp.gap_duration
1822 resp.pause_frame_count
1823 resp.rx_arp_reply_count
1824 resp.rx_arp_request_count
1825 resp.rx_ping_reply_count
1826 resp.rx_ping_request_count
1827
1828 # RX Statistics - Received TPLDs
1829 await port.statistics.rx.obtain_available_tplds()
1830
1831 # RX Statistics - TPLD - Error Counter
1832 resp = await port.statistics.rx.access_tpld(tpld_id=0).errors.get()
1833 resp.non_incre_payload_packet_count
1834 resp.non_incre_seq_event_count
1835 resp.swapped_seq_misorder_event_count
1836
1837 # RX Statistics - TPLD - Latency Counter
1838 resp = await port.statistics.rx.access_tpld(tpld_id=0).latency.get()
1839 resp.avg_last_sec
1840 resp.max_last_sec
1841 resp.min_last_sec
1842 resp.avg_val
1843 resp.max_val
1844 resp.min_val
1845
1846 # RX Statistics - TPLD - Jitter Counter
1847 resp = await port.statistics.rx.access_tpld(tpld_id=0).jitter.get()
1848 resp.avg_last_sec
1849 resp.max_last_sec
1850 resp.min_last_sec
1851 resp.avg_val
1852 resp.max_val
1853 resp.min_val
1854
1855 # RX Statistics - TPLD - Traffic Counter
1856 resp = await port.statistics.rx.access_tpld(tpld_id=0).traffic.get()
1857 resp.byte_count_since_cleared
1858 resp.packet_count_since_cleared
1859 resp.bit_count_last_sec
1860 resp.packet_count_last_sec
1861
1862 # RX Statistics - Filter Statistics
1863 resp = await port.statistics.rx.obtain_filter_statistics(filter=0).get()
1864 resp.byte_count_since_cleared
1865 resp.packet_count_since_cleared
1866 resp.bit_count_last_sec
1867 resp.packet_count_last_sec
1868
1869 # TX Statistics - Clear Counter
1870 await port.statistics.tx.clear.set()
1871
1872 # TX Statistics - Total Counter
1873 resp = await port.statistics.tx.total.get()
1874 resp.byte_count_since_cleared
1875 resp.packet_count_since_cleared
1876 resp.bit_count_last_sec
1877 resp.packet_count_last_sec
1878
1879 # TX Statistics - Non-TPLD Counter
1880 resp = await port.statistics.tx.no_tpld.get()
1881 resp.byte_count_since_cleared
1882 resp.packet_count_since_cleared
1883 resp.bit_count_last_sec
1884 resp.packet_count_last_sec
1885
1886 # TX Statistics - Extra Counter
1887 resp = await port.statistics.tx.extra.get()
1888 resp.tx_arp_req_count
1889
1890 # TX Statistics - Stream Counter
1891 resp = await port.statistics.tx.obtain_from_stream(stream=0).get()
1892 resp.byte_count_since_cleared
1893 resp.packet_count_since_cleared
1894 resp.bit_count_last_sec
1895 resp.packet_count_last_sec
1896# endregion
1897
1898# region Stream
1899 #################################################
1900 # Stream #
1901 #################################################
1902
1903 # Create and Obtain
1904 # Create a stream on the port, and obtain the stream object. The stream index is automatically assigned by the port.
1905 stream = await port.streams.create()
1906
1907 # Obtain One or Multiple
1908 stream = port.streams.obtain(0)
1909 stream_list = port.streams.obtain_multiple(*[0,1,2])
1910
1911 # Remove
1912 # Remove a stream on the port with an explicit stream index.
1913 await port.streams.remove(position_idx=0)
1914
1915 # Description
1916 await stream.comment.set(comment="description")
1917
1918 resp = await stream.comment.get()
1919 resp.comment
1920
1921 # Test Payload ID
1922 await stream.tpld_id.set(test_payload_identifier=0)
1923
1924 resp = await stream.tpld_id.get()
1925 resp.test_payload_identifier
1926
1927 # State
1928 await stream.enable.set(state=enums.OnOffWithSuppress.OFF)
1929 await stream.enable.set_off()
1930 await stream.enable.set(state=enums.OnOffWithSuppress.ON)
1931 await stream.enable.set_on()
1932 await stream.enable.set(state=enums.OnOffWithSuppress.SUPPRESS)
1933 await stream.enable.set_suppress()
1934
1935 resp = await stream.enable.get()
1936 resp.state
1937
1938 # Header Protocol Segment
1939 await stream.packet.header.protocol.set(segments=[
1940 enums.ProtocolOption.ETHERNET,
1941 enums.ProtocolOption.VLAN,
1942 enums.ProtocolOption.IP,
1943 enums.ProtocolOption.UDP,
1944 ])
1945
1946 # ETHERNET = 1
1947 # """Ethernet II"""
1948 # VLAN = 2
1949 # """VLAN"""
1950 # ARP = 3
1951 # """Address Resolution Protocol"""
1952 # IP = 4
1953 # """IPv4"""
1954 # IPV6 = 5
1955 # """IPv6"""
1956 # UDP = 6
1957 # """User Datagram Protocol (w/o checksum)"""
1958 # TCP = 7
1959 # """Transmission Control Protocol (w/o checksum)"""
1960 # LLC = 8
1961 # """Logic Link Control"""
1962 # SNAP = 9
1963 # """Subnetwork Access Protocol"""
1964 # GTP = 10
1965 # """GPRS Tunnelling Protocol"""
1966 # ICMP = 11
1967 # """Internet Control Message Protocol"""
1968 # RTP = 12
1969 # """Real-time Transport Protocol"""
1970 # RTCP = 13
1971 # """RTP Control Protocol"""
1972 # STP = 14
1973 # """Spanning Tree Protocol"""
1974 # SCTP = 15
1975 # """Stream Control Transmission Protocol"""
1976 # MACCTRL = 16
1977 # """MAC Control"""
1978 # MPLS = 17
1979 # """Multiprotocol Label Switching"""
1980 # PBBTAG = 18
1981 # """Provider Backbone Bridge tag"""
1982 # FCOE = 19
1983 # """Fibre Channel over Ethernet"""
1984 # FC = 20
1985 # """Fibre Channel"""
1986 # FCOETAIL = 21
1987 # """Fibre Channel over Ethernet (tail)"""
1988 # IGMPV3L0 = 22
1989 # """IGMPv3 Membership Query L=0"""
1990 # IGMPV3L1 = 23
1991 # """IGMPv3 Membership Query L=1"""
1992 # UDPCHECK = 24
1993 # """User Datagram Protocol (w/ checksum)"""
1994 # IGMPV2 = 25
1995 # """Internet Group Management Protocol v2"""
1996 # MPLS_TP_OAM = 26
1997 # """MPLS-TP, OAM Header"""
1998 # GRE_NOCHECK = 27
1999 # """Generic Routing Encapsulation (w/o checksum)"""
2000 # GRE_CHECK = 28
2001 # """Generic Routing Encapsulation (w/ checksum)"""
2002 # TCPCHECK = 29
2003 # """Transmission Control Protocol (w/ checksum)"""
2004 # GTPV1L0 = 30
2005 # """GTPv1 (no options), GPRS Tunneling Protocol v1"""
2006 # GTPV1L1 = 31
2007 # """GTPv1 (w/ options), GPRS Tunneling Protocol v1"""
2008 # GTPV2L0 = 32
2009 # """GTPv2 (no options), GPRS Tunneling Protocol v2"""
2010 # GTPV2L1 = 33
2011 # """GTPv2 (w/ options), GPRS Tunneling Protocol v2"""
2012 # IGMPV1 = 34
2013 # """Internet Group Management Protocol v1"""
2014 # PWETHCTRL = 35
2015 # """PW Ethernet Control Word"""
2016 # VXLAN = 36
2017 # """Virtual eXtensible LAN"""
2018 # ETHERNET_8023 = 37
2019 # """Ethernet 802.3"""
2020 # NVGRE = 38
2021 # """Generic Routing Encapsulation (Network Virtualization)"""
2022 # DHCPV4 = 39
2023 # """Dynamic Host Configuration Protocol (IPv4)"""
2024 # GENEVE = 40
2025 # """Generic Network Virtualization Encapsulation"""
2026
2027 resp = await stream.packet.header.protocol.get()
2028 resp.segments
2029
2030 # Header Value
2031 await stream.packet.header.data.set(
2032 hex_data=Hex("00000000000004F4BC7FFE908100000008004500002A000000007F113BC400000000000000000000000000160000"))
2033
2034 resp = await stream.packet.header.data.get()
2035 resp.hex_data
2036
2037 # Packet Size
2038 await stream.packet.length.set(length_type=enums.LengthType.FIXED, min_val=64, max_val=64)
2039 await stream.packet.length.set(length_type=enums.LengthType.INCREMENTING, min_val=64, max_val=1500)
2040 await stream.packet.length.set(length_type=enums.LengthType.BUTTERFLY, min_val=64, max_val=1500)
2041 await stream.packet.length.set(length_type=enums.LengthType.RANDOM, min_val=64, max_val=1500)
2042 await stream.packet.length.set(length_type=enums.LengthType.MIX, min_val=64, max_val=64)
2043
2044 resp = await stream.packet.length.get()
2045 resp.length_type
2046 resp.min_val
2047 resp.max_val
2048
2049 # Packet Auto Size
2050 await stream.packet.auto_adjust.set()
2051
2052 # Payload Type
2053 # Pattern string in hex, min = 1 byte, max = 18 bytes
2054 await stream.payload.content.set(payload_type=enums.PayloadType.PATTERN, hex_data=Hex("000102030405060708090A0B0C0D0E0FDEAD"))
2055 await stream.payload.content.set(payload_type=enums.PayloadType.PATTERN, hex_data=Hex("F5"))
2056
2057 # Patter string ignored for non-pattern types
2058 await stream.payload.content.set(payload_type=enums.PayloadType.INC16, hex_data=Hex("F5"))
2059 await stream.payload.content.set_inc_word("00")
2060 await stream.payload.content.set(payload_type=enums.PayloadType.INC8, hex_data=Hex("F5"))
2061 await stream.payload.content.set_inc_byte("00")
2062 await stream.payload.content.set(payload_type=enums.PayloadType.DEC8, hex_data=Hex("F5"))
2063 await stream.payload.content.set_dec_byte("00")
2064 await stream.payload.content.set(payload_type=enums.PayloadType.DEC16, hex_data=Hex("F5"))
2065 await stream.payload.content.set_dec_word("00")
2066 await stream.payload.content.set(payload_type=enums.PayloadType.PRBS, hex_data=Hex("F5"))
2067 await stream.payload.content.set_prbs("00")
2068 await stream.payload.content.set(payload_type=enums.PayloadType.RANDOM, hex_data=Hex("F5"))
2069 await stream.payload.content.set_random("00")
2070
2071 resp = await stream.payload.content.get()
2072 resp.hex_data
2073 resp.payload_type
2074
2075 # Extended Payload
2076 # Use await port.payload_mode.set_extpl() to set the port's payload mode to Extended Payload.
2077 await stream.payload.extended.set(hex_data=Hex("00110022FF"))
2078
2079 resp = await stream.payload.extended.get()
2080 resp.hex_data
2081
2082 # Rate Fraction
2083 await stream.rate.fraction.set(stream_rate_ppm=1_000_000)
2084
2085 resp = await stream.rate.fraction.get()
2086 resp.stream_rate_ppm
2087
2088 # Packet Rate
2089 await stream.rate.pps.set(stream_rate_pps=1_000)
2090
2091 resp = await stream.rate.pps.get()
2092 resp.stream_rate_pps
2093
2094 # Bit Rate L2
2095 await stream.rate.l2bps.set(l2_bps=1_000_000)
2096
2097 resp = await stream.rate.l2bps.get()
2098 resp.l2_bps
2099
2100 # Packet Limit
2101 await stream.packet.limit.set(packet_count=1_000)
2102
2103 resp = await stream.packet.limit.get()
2104 resp.packet_count
2105
2106 # Burst Size and Density
2107 await stream.burst.burstiness.set(size=20, density=80)
2108
2109 resp = await stream.burst.burstiness.get()
2110 resp.size
2111 resp.density
2112
2113 # Inter Burst/Packet Gap
2114 await stream.burst.gap.set(inter_packet_gap=30, inter_burst_gap=30)
2115
2116 resp = await stream.burst.gap.get()
2117 resp.inter_packet_gap
2118 resp.inter_burst_gap
2119
2120 # Priority Flow
2121 await stream.priority_flow.set(cos=enums.PFCMode.ZERO)
2122 await stream.priority_flow.set(cos=enums.PFCMode.ONE)
2123 await stream.priority_flow.set(cos=enums.PFCMode.TWO)
2124 await stream.priority_flow.set(cos=enums.PFCMode.THREE)
2125 await stream.priority_flow.set(cos=enums.PFCMode.FOUR)
2126 await stream.priority_flow.set(cos=enums.PFCMode.FIVE)
2127 await stream.priority_flow.set(cos=enums.PFCMode.SIX)
2128 await stream.priority_flow.set(cos=enums.PFCMode.SEVEN)
2129 await stream.priority_flow.set(cos=enums.PFCMode.VLAN_PCP)
2130
2131 resp = await stream.priority_flow.get()
2132 resp.cos
2133
2134 # IPv4 Gateway Address
2135 await stream.gateway.ipv4.set(gateway=ipaddress.IPv4Address("10.10.10.1"))
2136
2137 resp = await stream.gateway.ipv4.get()
2138 resp.gateway
2139
2140 # IPv6 Gateway Address
2141 await stream.gateway.ipv6.set(gateway=ipaddress.IPv6Address("::0001"))
2142
2143 resp = await stream.gateway.ipv6.get()
2144 resp.gateway
2145
2146 # ARP Resolve Peer Address
2147 # You need to make sure either the port has a correct gateway or the stream has a correct destination IP address to ARP resolve the MAC address.
2148 resp = await stream.request.arp.get()
2149 resp.mac_address
2150
2151 # PING Check IP Peer
2152 # You need to make sure either the port has a correct gateway or the stream has a correct destination IP address to ping.
2153 resp = await stream.request.ping.get()
2154 resp.delay
2155 resp.time_to_live
2156
2157 # Custom Data Field
2158 # Use await port.payload_mode.set_cdf() to set the port's payload mode to Custom Data Field.
2159
2160 # Field Offset
2161 await stream.cdf.offset.set(offset=1)
2162
2163 resp = await stream.cdf.offset.get()
2164 resp.offset
2165
2166 # Byte Count
2167 await stream.cdf.count.set(cdf_count=1)
2168
2169 resp = await stream.cdf.count.get()
2170 resp.cdf_count
2171
2172 ################################################
2173 # Stream Modifier #
2174 ################################################
2175
2176 # Create
2177 await stream.packet.header.modifiers.configure(number=1)
2178
2179 # Clear
2180 await stream.packet.header.modifiers.clear()
2181
2182 # Obtain
2183 # Must create modifiers before obtain.
2184 modifier = stream.packet.header.modifiers.obtain(idx=0)
2185
2186 # Range
2187 await modifier.range.set(min_val=0, step=10, max_val=9)
2188
2189 resp = await modifier.range.get()
2190 resp.min_val
2191 resp.max_val
2192 resp.step
2193
2194 # Position, Action, Mask
2195 await modifier.specification.set(position=0, mask=Hex("FFFF0000"), action=enums.ModifierAction.INC, repetition=1)
2196 await modifier.specification.set(position=0, mask=Hex("FFFF0000"), action=enums.ModifierAction.DEC, repetition=1)
2197 await modifier.specification.set(position=0, mask=Hex("FFFF0000"), action=enums.ModifierAction.RANDOM, repetition=1)
2198
2199 resp = await modifier.specification.get()
2200 resp.action
2201 resp.mask
2202 resp.position
2203 resp.repetition
2204
2205 # #################################################
2206 # # Stream 32-bit Modifier #
2207 # #################################################
2208
2209 # Create
2210 await stream.packet.header.modifiers_extended.configure(number=1)
2211
2212 # Clear
2213 await stream.packet.header.modifiers_extended.clear()
2214
2215 # Obtain
2216 # Must create modifiers before obtain.
2217 modifier_ext = stream.packet.header.modifiers_extended.obtain(idx=0)
2218
2219 # Range
2220 await modifier_ext.range.set(min_val=0, step=1, max_val=100)
2221
2222 resp = await modifier_ext.range.get()
2223 resp.max_val
2224 resp.min_val
2225 resp.step
2226
2227 # Position, Action, Mask
2228 await modifier_ext.specification.set(position=0, mask=Hex("FFFFFFFF"), action=enums.ModifierAction.INC, repetition=1)
2229 await modifier_ext.specification.set(position=0, mask=Hex("FFFFFFFF"), action=enums.ModifierAction.DEC, repetition=1)
2230 await modifier_ext.specification.set(position=0, mask=Hex("FFFFFFFF"), action=enums.ModifierAction.RANDOM, repetition=1)
2231
2232 resp = await modifier_ext.specification.get()
2233 resp.action
2234 resp.mask
2235 resp.position
2236 resp.repetition
2237
2238 # #################################################
2239 # # Stream Error Control #
2240 # #################################################
2241
2242 # Misorder Error Injection
2243 await stream.inject_err.misorder.set()
2244
2245 # Payload Integrity Error Injection
2246 await stream.inject_err.payload_integrity.set()
2247
2248 # Sequence Error Injection
2249 await stream.inject_err.sequence.set()
2250
2251 # Test Payload Error Injection
2252 await stream.inject_err.test_payload.set()
2253
2254 # Checksum Error Injection
2255 await stream.inject_err.frame_checksum.set()
2256
2257 # Insert Frame Checksum
2258 await stream.insert_packets_checksum.set(on_off=enums.OnOff.ON)
2259 await stream.insert_packets_checksum.set_on()
2260 await stream.insert_packets_checksum.set(on_off=enums.OnOff.OFF)
2261 await stream.insert_packets_checksum.set_off()
2262
2263 resp = await stream.insert_packets_checksum.get()
2264 resp.on_off
2265# endregion
2266
2267# region Network Emulation
2268 #################################################
2269 # Network Emulation #
2270 #################################################
2271
2272 # Configure Chimera port
2273 if isinstance(module, modules.ModuleChimera):
2274 port = module.ports.obtain(0)
2275
2276 await port.pcs_pma.link_flap.params.set(duration=100, period=1000, repetition=0)
2277 await port.pcs_pma.link_flap.enable.set_on()
2278 await port.pcs_pma.link_flap.enable.set_off()
2279
2280 await port.pcs_pma.pma_pulse_err_inj.params.set(duration=100, period=1000, repetition=0, coeff=100, exp=-4)
2281 await port.pcs_pma.pma_pulse_err_inj.enable.set_on()
2282 await port.pcs_pma.pma_pulse_err_inj.enable.set_off()
2283
2284 # Enable impairment on the port.
2285 await port.emulate.set_off()
2286 await port.emulate.set_on()
2287
2288 resp = await port.emulate.get()
2289 resp.action
2290
2291 # Set TPLD mode
2292 await port.emulation.tpld_mode.set(mode=enums.TPLDMode.NORMAL)
2293 await port.emulation.tpld_mode.set(mode=enums.TPLDMode.MICRO)
2294
2295 resp = await port.emulation.tpld_mode.get()
2296 resp.mode
2297
2298 # Configure flow's basic filter on a port
2299 # Configure flow properties
2300 flow = port.emulation.flows[1]
2301
2302 await flow.comment.set(comment="Flow description")
2303
2304 resp = await flow.comment.get()
2305 resp.comment
2306
2307 # Initializing the shadow copy of the filter.
2308 await flow.shadow_filter.initiating.set()
2309
2310 # Configure shadow filter to BASIC mode
2311 await flow.shadow_filter.use_basic_mode()
2312
2313 # Query the mode of the filter (either basic or extended)
2314 filter = await flow.shadow_filter.get_mode()
2315
2316 if isinstance(filter, misc.BasicImpairmentFlowFilter):
2317 #------------------
2318 # Ethernet subfilter
2319 #------------------
2320 # Use and configure basic-mode shadow filter's Ethernet subfilter
2321 await utils.apply(
2322 filter.ethernet.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2323 filter.ethernet.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2324 filter.ethernet.src_address.set(use=enums.OnOff.ON, value=Hex("AAAAAAAAAAAA"), mask=Hex("FFFFFFFFFFFF")),
2325 filter.ethernet.dest_address.set(use=enums.OnOff.ON, value=Hex("BBBBBBBBBBBB"), mask=Hex("FFFFFFFFFFFF"))
2326 )
2327
2328 #------------------
2329 # Layer 2+ subfilter
2330 #------------------
2331 # Not use basic-mode shadow filter's Layer 2+ subfilter
2332 await filter.l2plus_use.set(use=enums.L2PlusPresent.NA)
2333
2334 # Use and configure basic-mode shadow filter's Layer2+ subfilter (One VLAN tag)
2335 await utils.apply(
2336 filter.l2plus_use.set(use=enums.L2PlusPresent.VLAN1),
2337 filter.vlan.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2338 filter.vlan.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2339 filter.vlan.inner.tag.set(use=enums.OnOff.ON, value=1234, mask=Hex("0FFF")),
2340 filter.vlan.inner.pcp.set(use=enums.OnOff.OFF, value=3, mask=Hex("07")),
2341 )
2342 # Use and configure basic-mode shadow filter's Layer2+ subfilter (Two VLAN tag)
2343 await utils.apply(
2344 filter.l2plus_use.set(use=enums.L2PlusPresent.VLAN2),
2345 filter.vlan.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2346 filter.vlan.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2347 filter.vlan.inner.tag.set(use=enums.OnOff.ON, value=1234, mask=Hex("0FFF")),
2348 filter.vlan.inner.pcp.set(use=enums.OnOff.OFF, value=3, mask=Hex("07")),
2349 filter.vlan.outer.tag.set(use=enums.OnOff.ON, value=2345, mask=Hex("0FFF")),
2350 filter.vlan.outer.pcp.set(use=enums.OnOff.OFF, value=0, mask=Hex("07")),
2351 )
2352 # Use and configure basic-mode shadow filter's Layer2+ subfilter (MPLS)
2353 await utils.apply(
2354 filter.l2plus_use.set(use=enums.L2PlusPresent.MPLS),
2355 filter.mpls.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2356 filter.mpls.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2357 filter.mpls.label.set(use=enums.OnOff.ON, value=1000, mask=Hex("FFFFF")),
2358 filter.mpls.toc.set(use=enums.OnOff.ON, value=0, mask=Hex("07")),
2359 )
2360
2361 #------------------
2362 # Layer 3 subfilter
2363 #------------------
2364 # Not use basic-mode shadow filter's Layer 3 subfilter
2365 await filter.l3_use.set(use=enums.L3Present.NA)
2366 # Use and configure basic-mode shadow filter's Layer 3 subfilter (IPv4)
2367 await utils.apply(
2368 filter.l3_use.set(use=enums.L3Present.IP4),
2369 filter.ip.v4.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2370 filter.ip.v4.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2371 filter.ip.v4.src_address.set(use=enums.OnOff.ON, value=ipaddress.IPv4Address("10.0.0.2"), mask=Hex("FFFFFFFF")),
2372 filter.ip.v4.dest_address.set(use=enums.OnOff.ON, value=ipaddress.IPv4Address("10.0.0.2"), mask=Hex("FFFFFFFF")),
2373 filter.ip.v4.dscp.set(use=enums.OnOff.ON, value=0, mask=Hex("FC")),
2374 )
2375 # Use and configure basic-mode shadow filter's Layer 3 subfilter (IPv6)
2376 await utils.apply(
2377 filter.l3_use.set(use=enums.L3Present.IP6),
2378 filter.ip.v6.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2379 filter.ip.v6.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2380 filter.ip.v6.src_address.set(use=enums.OnOff.ON, value=ipaddress.IPv6Address("2001::2"), mask=Hex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")),
2381 filter.ip.v6.dest_address.set(use=enums.OnOff.ON, value=ipaddress.IPv6Address("2002::2"), mask=Hex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")),
2382 filter.ip.v6.traffic_class.set(use=enums.OnOff.ON, value=0, mask=Hex("FC")),
2383 )
2384
2385 #------------------
2386 # Layer 4 subfilter
2387 #------------------
2388 # Use and configure basic-mode shadow filter's Layer 4 subfilter (TCP)
2389 await utils.apply(
2390 filter.tcp.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2391 filter.tcp.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2392 filter.tcp.src_port.set(use=enums.OnOff.ON, value=1234, mask=Hex("FFFF")),
2393 filter.tcp.dest_port.set(use=enums.OnOff.ON, value=80, mask=Hex("FFFF")),
2394 )
2395 # Use and configure basic-mode shadow filter's Layer 4 subfilter (UDP)
2396 await utils.apply(
2397 filter.udp.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2398 filter.udp.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2399 filter.udp.src_port.set(use=enums.OnOff.ON, value=1234, mask=Hex("FFFF")),
2400 filter.udp.dest_port.set(use=enums.OnOff.ON, value=80, mask=Hex("FFFF")),
2401 )
2402
2403 #------------------
2404 # Layer Xena subfilter
2405 #------------------
2406 await utils.apply(
2407 filter.tpld.settings.set(action=enums.InfoAction.EXCLUDE),
2408 filter.tpld.settings.set(action=enums.InfoAction.INCLUDE),
2409 filter.tpld.test_payload_filters_config[0].set(use=enums.OnOff.ON, id = 2),
2410 filter.tpld.test_payload_filters_config[0].set(use=enums.OnOff.OFF, id = 2),
2411 filter.tpld.test_payload_filters_config[1].set(use=enums.OnOff.ON, id = 4),
2412 filter.tpld.test_payload_filters_config[1].set(use=enums.OnOff.OFF, id = 4),
2413 filter.tpld.test_payload_filters_config[2].set(use=enums.OnOff.ON, id = 6),
2414 filter.tpld.test_payload_filters_config[2].set(use=enums.OnOff.OFF, id = 6),
2415 filter.tpld.test_payload_filters_config[3].set(use=enums.OnOff.ON, id = 8),
2416 filter.tpld.test_payload_filters_config[3].set(use=enums.OnOff.OFF, id = 8),
2417 filter.tpld.test_payload_filters_config[4].set(use=enums.OnOff.ON, id = 10),
2418 filter.tpld.test_payload_filters_config[4].set(use=enums.OnOff.OFF, id = 10),
2419 filter.tpld.test_payload_filters_config[5].set(use=enums.OnOff.ON, id = 20),
2420 filter.tpld.test_payload_filters_config[5].set(use=enums.OnOff.OFF, id = 20),
2421 filter.tpld.test_payload_filters_config[6].set(use=enums.OnOff.ON, id = 40),
2422 filter.tpld.test_payload_filters_config[6].set(use=enums.OnOff.OFF, id = 40),
2423 filter.tpld.test_payload_filters_config[7].set(use=enums.OnOff.ON, id = 60),
2424 filter.tpld.test_payload_filters_config[7].set(use=enums.OnOff.OFF, id = 60),
2425 filter.tpld.test_payload_filters_config[8].set(use=enums.OnOff.ON, id = 80),
2426 filter.tpld.test_payload_filters_config[8].set(use=enums.OnOff.OFF, id = 80),
2427 filter.tpld.test_payload_filters_config[9].set(use=enums.OnOff.ON, id = 100),
2428 filter.tpld.test_payload_filters_config[9].set(use=enums.OnOff.OFF, id = 100),
2429 filter.tpld.test_payload_filters_config[10].set(use=enums.OnOff.ON, id = 102),
2430 filter.tpld.test_payload_filters_config[10].set(use=enums.OnOff.OFF, id = 102),
2431 filter.tpld.test_payload_filters_config[11].set(use=enums.OnOff.ON, id = 104),
2432 filter.tpld.test_payload_filters_config[11].set(use=enums.OnOff.OFF, id = 104),
2433 filter.tpld.test_payload_filters_config[12].set(use=enums.OnOff.ON, id = 106),
2434 filter.tpld.test_payload_filters_config[12].set(use=enums.OnOff.OFF, id = 106),
2435 filter.tpld.test_payload_filters_config[13].set(use=enums.OnOff.ON, id = 108),
2436 filter.tpld.test_payload_filters_config[13].set(use=enums.OnOff.OFF, id = 108),
2437 filter.tpld.test_payload_filters_config[14].set(use=enums.OnOff.ON, id = 110),
2438 filter.tpld.test_payload_filters_config[14].set(use=enums.OnOff.OFF, id = 110),
2439 filter.tpld.test_payload_filters_config[15].set(use=enums.OnOff.ON, id = 200),
2440 filter.tpld.test_payload_filters_config[15].set(use=enums.OnOff.OFF, id = 200),
2441 )
2442
2443 #------------------
2444 # Layer Any subfilter
2445 #------------------
2446 await utils.apply(
2447 filter.any.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.EXCLUDE),
2448 filter.any.settings.set(use=enums.FilterUse.AND, action=enums.InfoAction.INCLUDE),
2449 filter.any.config.set(position=0, value=Hex("112233445566"), mask=Hex("112233445566"))
2450 )
2451
2452 # Apply the filter so the configuration data in the shadow copy is committed to the working copy automatically.
2453 await flow.shadow_filter.enable.set_off()
2454 await flow.shadow_filter.enable.set_on()
2455 await flow.shadow_filter.apply.set()
2456
2457 # Configure flow's extended filter on a port
2458 # Configure flow properties
2459 flow = port.emulation.flows[1]
2460 await flow.comment.set("Flow description")
2461
2462 # Initializing the shadow copy of the filter.
2463 await flow.shadow_filter.initiating.set()
2464
2465 # Configure shadow filter to EXTENDED mode
2466 await flow.shadow_filter.use_extended_mode()
2467
2468 # Query the mode of the filter (either basic or extended)
2469 filter = await flow.shadow_filter.get_mode()
2470
2471 if isinstance(filter, misc.ExtendedImpairmentFlowFilter):
2472
2473 await filter.use_segments(
2474 enums.ProtocolOption.VLAN
2475 )
2476 protocol_segments = await filter.get_protocol_segments()
2477 await protocol_segments[0].value.set(value=Hex("AAAAAAAAAAAABBBBBBBBBBBB8100"))
2478 await protocol_segments[0].mask.set(masks=Hex("0000000000000000000000000000"))
2479 await protocol_segments[1].value.set(value=Hex("0064FFFF"))
2480 await protocol_segments[1].mask.set(masks=Hex("00000000"))
2481
2482 await protocol_segments[1].get()
2483
2484 # Configure impairment - Drop
2485 # Fixed Burst distribution for impairment Drop
2486 await utils.apply(
2487 flow.impairment_distribution.drop_type_config.fixed_burst.set(burst_size=5),
2488 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=5), #repeat (duration = 1, period = x)
2489 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=0), #one shot
2490 )
2491
2492 # Random Burst distribution for impairment Drop
2493 await utils.apply(
2494 flow.impairment_distribution.drop_type_config.random_burst.set(minimum=1, maximum=10, probability=10_000),
2495 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1), # repeat pattern
2496 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2497 )
2498
2499 # Fixed Rate distribution for impairment Drop
2500 await utils.apply(
2501 flow.impairment_distribution.drop_type_config.fixed_rate.set(probability=10_000),
2502 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2503 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2504 )
2505
2506 # Bit Error Rate distribution for impairment Drop
2507 await utils.apply(
2508 flow.impairment_distribution.drop_type_config.bit_error_rate.set(coef=1, exp=1),
2509 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2510 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2511 )
2512
2513 # Random Rate distribution for impairment Drop
2514 await utils.apply(
2515 flow.impairment_distribution.drop_type_config.random_rate.set(probability=10_000),
2516 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2517 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2518 )
2519
2520 # Gilbert Elliot distribution for impairment Drop
2521 await utils.apply(
2522 flow.impairment_distribution.drop_type_config.ge.set(good_state_prob=0, good_state_trans_prob=0, bad_state_prob=0, bad_state_trans_prob=0),
2523 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2524 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2525 )
2526
2527 # Uniform distribution for impairment Drop
2528 await utils.apply(
2529 flow.impairment_distribution.drop_type_config.uniform.set(minimum=1, maximum=1),
2530 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2531 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2532 )
2533
2534 # Gaussian distribution for impairment Drop
2535 await utils.apply(
2536 flow.impairment_distribution.drop_type_config.gaussian.set(mean=1, std_deviation=1),
2537 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),# repeat pattern
2538 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2539 )
2540
2541 # Poisson distribution for impairment Drop
2542 await utils.apply(
2543 flow.impairment_distribution.drop_type_config.poisson.set(mean=9),
2544 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1), # repeat pattern
2545 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2546 )
2547
2548 # Gamma distribution for impairment Drop
2549 await utils.apply(
2550 flow.impairment_distribution.drop_type_config.gamma.set(shape=1, scale=1),
2551 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1), # repeat pattern
2552 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2553 )
2554
2555 # Custom distribution for impairment Drop
2556 data_x=[0, 1] * 256
2557 await port.custom_distributions.assign(0)
2558 await port.custom_distributions[0].comment.set(comment="Example Custom Distribution")
2559 await port.custom_distributions[0].definition.set(linear=enums.OnOff.OFF, symmetric=enums.OnOff.OFF, entry_count=len(data_x), data_x=data_x)
2560 await utils.apply(
2561 flow.impairment_distribution.drop_type_config.custom.set(cust_id=0),
2562 flow.impairment_distribution.drop_type_config.schedule.set(duration=1, period=1),
2563 flow.impairment_distribution.drop_type_config.schedule.set(duration=0, period=0), #continuous
2564 )
2565
2566 # Set distribution and start impairment Drop
2567 await flow.impairment_distribution.drop_type_config.enable.set_on()
2568 await flow.impairment_distribution.drop_type_config.enable.set_off()
2569
2570 # Configure impairment - Misordering
2571
2572 # Fixed Burst distribution for impairment Misordering
2573 # dist = distributions.misordering.FixedBurst(burst_size=1)
2574 # dist.repeat(period=5)
2575 # dist.one_shot()
2576
2577 # Fixed Burst distribution for impairment Drop
2578 await utils.apply(
2579 flow.impairment_distribution.misorder_type_config.fixed_burst.set(burst_size=5),
2580 flow.impairment_distribution.misorder_type_config.schedule.set(duration=1, period=5), #repeat
2581 flow.impairment_distribution.misorder_type_config.schedule.set(duration=1, period=0), #one shot
2582 )
2583
2584 # Fixed Rate distribution for impairment Drop
2585 await utils.apply(
2586 flow.impairment_distribution.misorder_type_config.fixed_rate.set(probability=10_000),
2587 flow.impairment_distribution.misorder_type_config.schedule.set(duration=1, period=1), # repeat pattern
2588 flow.impairment_distribution.misorder_type_config.schedule.set(duration=0, period=0), #continuous
2589 )
2590
2591 # Set distribution and start impairment Misordering
2592 await flow.misordering.set(depth=1)
2593 await flow.impairment_distribution.misorder_type_config.enable.set_on()
2594 await flow.impairment_distribution.misorder_type_config.enable.set_off()
2595
2596 # Configure impairment - Latency & Jitter
2597 # Fixed Burst distribution for impairment Latency & Jitter
2598 await flow.impairment_distribution.latency_jitter_type_config.constant_delay.set(delay=100)
2599
2600 # Random Burst distribution for impairment Latency & Jitter
2601 await utils.apply(
2602 flow.impairment_distribution.latency_jitter_type_config.accumulate_and_burst.set(delay=1300),
2603 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=1, period=1), #repeat (duration = 1, period = x)
2604 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=1, period=0), #one shot
2605 )
2606
2607 # Step distribution for impairment Latency & Jitter
2608 await utils.apply(
2609 flow.impairment_distribution.latency_jitter_type_config.step.set(low=1300, high=77000),
2610 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2611 )
2612 await flow.impairment_distribution.corruption_type_config.off.set()
2613
2614 # Uniform distribution for impairment Latency & Jitter
2615 await utils.apply(
2616 flow.impairment_distribution.latency_jitter_type_config.uniform.set(minimum=1, maximum=1),
2617 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2618 )
2619
2620 # Gaussian distribution for impairment Latency & Jitter
2621 await utils.apply(
2622 flow.impairment_distribution.latency_jitter_type_config.gaussian.set(mean=1, std_deviation=1),
2623 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2624 )
2625
2626 resp = await flow.latency_range.get()
2627 resp.
2628
2629
2630 # Poisson distribution for impairment Latency & Jitter
2631 await utils.apply(
2632 flow.impairment_distribution.latency_jitter_type_config.poisson.set(mean=1),
2633 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2634 )
2635
2636 # Gamma distribution for impairment Latency & Jitter
2637 await utils.apply(
2638 flow.impairment_distribution.latency_jitter_type_config.gamma.set(shape=1, scale=1),
2639 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2640 )
2641
2642 # Custom distribution for impairment Latency & Jitter
2643 data_x=[0, 1] * 256
2644 await port.custom_distributions.assign(0)
2645 await port.custom_distributions[0].comment.set(comment="Example Custom Distribution")
2646 await port.custom_distributions[0].definition.set(linear=enums.OnOff.OFF, symmetric=enums.OnOff.OFF, entry_count=len(data_x), data_x=data_x)
2647 await utils.apply(
2648 flow.impairment_distribution.latency_jitter_type_config.custom.set(cust_id=0),
2649 flow.impairment_distribution.latency_jitter_type_config.schedule.set(duration=0, period=0), #continuous
2650 )
2651
2652 # Set distribution and start impairment Latency & Jitter
2653 await flow.impairment_distribution.latency_jitter_type_config.enable.set_on()
2654 await flow.impairment_distribution.latency_jitter_type_config.enable.set_off()
2655
2656 # Configure impairment - Duplication
2657
2658 # Fixed Burst distribution for impairment Duplication
2659 # dist.one_shot()
2660 await utils.apply(
2661 flow.impairment_distribution.duplication_type_config.fixed_burst.set(burst_size=1300),
2662 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1), #repeat (duration = 1, period = x)
2663 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=0), #one shot
2664 )
2665
2666 # Random Burst distribution for impairment Duplication
2667 await utils.apply(
2668 flow.impairment_distribution.duplication_type_config.random_burst.set(minimum=1, maximum=1, probability=10_0000),
2669 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2670 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2671 )
2672
2673 # Fixed Rate distribution for impairment Duplication
2674 await utils.apply(
2675 flow.impairment_distribution.duplication_type_config.fixed_rate.set(probability=10_000),
2676 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1), # repeat pattern
2677 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2678 )
2679
2680 # Bit Error Rate distribution for impairment Duplication
2681 await utils.apply(
2682 flow.impairment_distribution.duplication_type_config.bit_error_rate.set(coef=1, exp=1),
2683 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2684 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2685 )
2686
2687 # Random Rate distribution for impairment Duplication
2688 await utils.apply(
2689 flow.impairment_distribution.duplication_type_config.random_rate.set(probability=10_000),
2690 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2691 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2692 )
2693
2694 # Gilbert Elliot distribution for impairment Duplication
2695 await utils.apply(
2696 flow.impairment_distribution.duplication_type_config.ge.set(good_state_prob=0, good_state_trans_prob=0, bad_state_prob=0, bad_state_trans_prob=0),
2697 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2698 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2699 )
2700
2701 # Uniform distribution for impairment Duplication
2702 await utils.apply(
2703 flow.impairment_distribution.duplication_type_config.uniform.set(minimum=1, maximum=1),
2704 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2705 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2706 )
2707
2708 # Gaussian distribution for impairment Duplication
2709 await utils.apply(
2710 flow.impairment_distribution.duplication_type_config.gaussian.set(mean=1, std_deviation=1),
2711 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),# repeat pattern
2712 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2713 )
2714
2715 # Poisson distribution for impairment Duplication
2716 await utils.apply(
2717 flow.impairment_distribution.duplication_type_config.poisson.set(mean=9),
2718 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1), # repeat pattern
2719 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2720 )
2721
2722 # Gamma distribution for impairment Duplication
2723 await utils.apply(
2724 flow.impairment_distribution.duplication_type_config.gamma.set(shape=1, scale=1),
2725 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1), # repeat pattern
2726 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2727 )
2728
2729 # Custom distribution for impairment Duplication
2730 data_x=[0, 1] * 256
2731 await port.custom_distributions.assign(0)
2732 await port.custom_distributions[0].comment.set(comment="Example Custom Distribution")
2733 await port.custom_distributions[0].definition.set(linear=enums.OnOff.OFF, symmetric=enums.OnOff.OFF, entry_count=len(data_x), data_x=data_x)
2734 await utils.apply(
2735 flow.impairment_distribution.duplication_type_config.custom.set(cust_id=0),
2736 flow.impairment_distribution.duplication_type_config.schedule.set(duration=1, period=1),
2737 flow.impairment_distribution.duplication_type_config.schedule.set(duration=0, period=0), #continuous
2738 )
2739
2740 # Set distribution and start impairment Duplication
2741 await flow.impairment_distribution.duplication_type_config.enable.set_on()
2742 await flow.impairment_distribution.duplication_type_config.enable.set_off()
2743
2744 # Configure impairment - Corruption
2745
2746 # Fixed Burst distribution for impairment Corruption
2747 await utils.apply(
2748 flow.impairment_distribution.corruption_type_config.fixed_burst.set(burst_size=1300),
2749 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1), #repeat (duration = 1, period = x)
2750 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=0), #one shot
2751 )
2752 # Random Burst distribution for impairment Corruption
2753 await utils.apply(
2754 flow.impairment_distribution.corruption_type_config.random_burst.set(minimum=1, maximum=1, probability=10_0000),
2755 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2756 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2757 )
2758
2759 # Fixed Rate distribution for impairment Corruption
2760 await utils.apply(
2761 flow.impairment_distribution.corruption_type_config.fixed_rate.set(probability=10_000),
2762 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1), # repeat pattern
2763 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2764 )
2765
2766 # Bit Error Rate distribution for impairment Corruption
2767 await utils.apply(
2768 flow.impairment_distribution.corruption_type_config.bit_error_rate.set(coef=1, exp=1),
2769 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2770 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2771 )
2772
2773 # Random Rate distribution for impairment Corruption
2774 await utils.apply(
2775 flow.impairment_distribution.corruption_type_config.random_rate.set(probability=10_000),
2776 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2777 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2778 )
2779
2780 # Gilbert Elliot distribution for impairment Corruption
2781 await utils.apply(
2782 flow.impairment_distribution.corruption_type_config.ge.set(good_state_prob=0, good_state_trans_prob=0, bad_state_prob=0, bad_state_trans_prob=0),
2783 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2784 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2785 )
2786
2787 # Uniform distribution for impairment Corruption
2788 await utils.apply(
2789 flow.impairment_distribution.corruption_type_config.uniform.set(minimum=1, maximum=1),
2790 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2791 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2792 )
2793
2794 # Gaussian distribution for impairment Corruption
2795 await utils.apply(
2796 flow.impairment_distribution.corruption_type_config.gaussian.set(mean=1, std_deviation=1),
2797 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),# repeat pattern
2798 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2799 )
2800
2801 # Poisson distribution for impairment Corruption
2802 await utils.apply(
2803 flow.impairment_distribution.corruption_type_config.poisson.set(mean=9),
2804 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1), # repeat pattern
2805 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2806 )
2807
2808 # Gamma distribution for impairment Corruption
2809 await utils.apply(
2810 flow.impairment_distribution.corruption_type_config.gamma.set(shape=1, scale=1),
2811 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1), # repeat pattern
2812 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2813 )
2814
2815
2816 # Custom distribution for impairment Corruption
2817 data_x=[0, 1] * 256
2818 await port.custom_distributions.assign(0)
2819 await port.custom_distributions[0].comment.set(comment="Example Custom Distribution")
2820 await port.custom_distributions[0].definition.set(linear=enums.OnOff.OFF, symmetric=enums.OnOff.OFF, entry_count=len(data_x), data_x=data_x)
2821 await utils.apply(
2822 flow.impairment_distribution.corruption_type_config.custom.set(cust_id=0),
2823 flow.impairment_distribution.corruption_type_config.schedule.set(duration=1, period=1),
2824 flow.impairment_distribution.corruption_type_config.schedule.set(duration=0, period=0), #continuous
2825 )
2826
2827 # Set distribution and start impairment Corruption
2828 await flow.corruption.set(corruption_type=enums.CorruptionType.OFF)
2829 await flow.corruption.set(corruption_type=enums.CorruptionType.ETH)
2830 await flow.corruption.set(corruption_type=enums.CorruptionType.IP)
2831 await flow.corruption.set(corruption_type=enums.CorruptionType.TCP)
2832 await flow.corruption.set(corruption_type=enums.CorruptionType.UDP)
2833 await flow.corruption.set(corruption_type=enums.CorruptionType.BER)
2834 await flow.impairment_distribution.corruption_type_config.enable.set_on()
2835 await flow.impairment_distribution.corruption_type_config.enable.set_off()
2836
2837 await flow.impairment_distribution.corruption_type_config.enable.set_on()
2838
2839 resp = await flow.impairment_distribution.corruption_type_config.one_shot_status.get()
2840 resp.one_shot_status
2841
2842 # Configure bandwidth control - Policer
2843
2844 await flow.bandwidth_control.policer.set(on_off=enums.OnOff.ON, mode=enums.PolicerMode.L1, cir=10_000, cbs=1_000)
2845 await flow.bandwidth_control.policer.set(on_off=enums.OnOff.ON, mode=enums.PolicerMode.L2, cir=10_000, cbs=1_000)
2846
2847
2848 # Configure bandwidth control - Shaper
2849
2850 # Set and start bandwidth control Shaper
2851 await flow.bandwidth_control.shaper.set(on_off=enums.OnOff.ON, mode=enums.PolicerMode.L1, cir=10_000, cbs=1_000, buffer_size=1_000)
2852 await flow.bandwidth_control.shaper.set(on_off=enums.OnOff.ON, mode=enums.PolicerMode.L2, cir=10_000, cbs=1_000, buffer_size=1_000)
2853
2854 # Flow statistics
2855
2856 rx_total = await flow.statistics.rx.total.get()
2857 rx_total.byte_count
2858 rx_total.packet_count
2859 rx_total.l2_bps
2860 rx_total.pps
2861
2862 tx_total = await flow.statistics.tx.total.get()
2863 tx_total.byte_count
2864 tx_total.packet_count
2865 tx_total.l2_bps
2866 tx_total.pps
2867
2868 flow_drop_total = await flow.statistics.total.drop_packets.get()
2869 flow_drop_total.pkt_drop_count_total
2870 flow_drop_total.pkt_drop_count_programmed
2871 flow_drop_total.pkt_drop_count_bandwidth
2872 flow_drop_total.pkt_drop_count_other
2873 flow_drop_total.pkt_drop_ratio_total
2874 flow_drop_total.pkt_drop_ratio_programmed
2875 flow_drop_total.pkt_drop_ratio_bandwidth
2876 flow_drop_total.pkt_drop_ratio_other
2877
2878 flow_corrupted_total = await flow.statistics.total.corrupted_packets.get()
2879 flow_corrupted_total.fcs_corrupted_pkt_count
2880 flow_corrupted_total.fcs_corrupted_pkt_ratio
2881 flow_corrupted_total.ip_corrupted_pkt_count
2882 flow_corrupted_total.ip_corrupted_pkt_ratio
2883 flow_corrupted_total.tcp_corrupted_pkt_count
2884 flow_corrupted_total.tcp_corrupted_pkt_ratio
2885 flow_corrupted_total.total_corrupted_pkt_count
2886 flow_corrupted_total.total_corrupted_pkt_ratio
2887 flow_corrupted_total.udp_corrupted_pkt_count
2888 flow_corrupted_total.udp_corrupted_pkt_ratio
2889
2890 flow_delayed_total = await flow.statistics.total.latency_packets.get()
2891 flow_delayed_total.pkt_count
2892 flow_delayed_total.ratio
2893
2894 flow_jittered_total = await flow.statistics.total.jittered_packets.get()
2895 flow_jittered_total.pkt_count
2896 flow_jittered_total.ratio
2897
2898 flow_duplicated_total = await flow.statistics.total.duplicated_packets.get()
2899 flow_duplicated_total.pkt_count
2900 flow_duplicated_total.ratio
2901
2902 flow_misordered_total = await flow.statistics.total.mis_ordered_packets.get()
2903 flow_misordered_total.pkt_count
2904 flow_misordered_total.ratio
2905
2906 await flow.statistics.tx.clear.set()
2907 await flow.statistics.rx.clear.set()
2908 await flow.statistics.clear.set()
2909
2910 # Port statistics
2911 port_drop = await port.emulation.statistics.drop.get()
2912 port_drop.pkt_drop_count_total
2913 port_drop.pkt_drop_count_programmed
2914 port_drop.pkt_drop_count_bandwidth
2915 port_drop.pkt_drop_count_other
2916 port_drop.pkt_drop_ratio_total
2917 port_drop.pkt_drop_ratio_programmed
2918 port_drop.pkt_drop_ratio_bandwidth
2919 port_drop.pkt_drop_ratio_other
2920
2921 port_corrupted = await port.emulation.statistics.corrupted.get()
2922 port_corrupted.fcs_corrupted_pkt_count
2923 port_corrupted.fcs_corrupted_pkt_ratio
2924 port_corrupted.ip_corrupted_pkt_count
2925 port_corrupted.ip_corrupted_pkt_ratio
2926 port_corrupted.tcp_corrupted_pkt_count
2927 port_corrupted.tcp_corrupted_pkt_ratio
2928 port_corrupted.total_corrupted_pkt_count
2929 port_corrupted.total_corrupted_pkt_ratio
2930 port_corrupted.udp_corrupted_pkt_count
2931 port_corrupted.udp_corrupted_pkt_ratio
2932
2933 port_delayed = await port.emulation.statistics.latency.get()
2934 port_delayed.pkt_count
2935 port_delayed.ratio
2936
2937 port_jittered = await port.emulation.statistics.jittered.get()
2938 port_jittered.pkt_count
2939 port_jittered.ratio
2940
2941 port_duplicated = await port.emulation.statistics.duplicated.get()
2942 port_duplicated.pkt_count
2943 port_duplicated.ratio
2944
2945 port_misordered = await port.emulation.statistics.mis_ordered.get()
2946 port_misordered.pkt_count
2947 port_misordered.ratio
2948
2949 await port.emulation.clear.set()
2950# endregion