Slide 25
Slide 25 text
試験自動化
Open Traffic Generator(OTG)API
特定のハードウェアやソフトウェアに依存しない共通インターフェイス
• 標準的なAPI設計でCI/CDとの統合が簡単
ベンダーごとに独自のコントローラー
デバイスモードとポートモード
Tester
29
Vendor B
Vendor A
Vendor A
Vendor A
Vendor A
#! bin/python3
"""
This is my script to test snappi with ixia-c, trex, and IxNetworks
in ShowNet 2023!!
"""
import datetime
import ipaddress
import snappi
import random
import time
def main():
p1 = Port("port1",
**{
"location": "172.16.18.12;1;7",
"mac": "00:00:01:00:00:01",
"addr4": "192.168.7.2/24",
"gw4": "192.168.7.1",
"gw4_mac": "00:00:00:00:00:00",
})
p2 = Port("port2",
**{
"location": "172.16.18.12;1;8",
"mac": "00:00:02:00:00:01",
"addr4": "192.168.8.2/24",
"gw4": "192.168.8.1",
"gw4_mac": "00:00:00:00:00:00",
})
api = snappi.api(location = "https://10.39.19.198:8443", verify = False)
config = snappishow_test_unidi(api, p1, p2)
if wait_for(lambda: verify_port_statistics(api, config), timeout = 60):
print("SUCCESS")
else:
print("FAILED")
def verify_port_statistics(api, config):
# Create a port statistics request and filter based on port names
statistics = api.metrics_request()
statistics.port.port_names = [p.name for p in config.ports]
# Create a filter to include only sent and received packet statistics
statistics.port.column_names = [statistics.port.FRAMES_TX, statistics.port.FRAMES_RX]
# Collect port statistics
results = api.get_metrics(statistics)
...