{"id":22383,"library":"snappi","title":"Snappi Open Traffic Generator","description":"Snappi is an open-source Python library for generating and testing network traffic. The current version is 1.53.0, with regular releases approximately every 2-3 weeks. It supports Python >=3.8,<4 and integrates with various traffic generator backends (e.g., IxNetwork, Traffic Server). Snappi provides a unified API to configure traffic flows, endpoints, and capture settings.","status":"active","version":"1.53.0","language":"python","source_language":"en","source_url":"https://github.com/open-traffic-generator/snappi","tags":["network-tests","traffic-generator","open-traffic-generator","testing","automation"],"install":[{"cmd":"pip install snappi","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The library is a package; the main API class is accessed via snappi.Api(), not a submodule.","wrong":"from snappi import snappi","symbol":"Api","correct":"import snappi"}],"quickstart":{"code":"import snappi\n\napi = snappi.Api(address='https://localhost:11009')\nconfig = api.config()\nconfig.flows.flow(name='test_flow').packet().ethernet().eth_ipv4().v4().src.value = '10.0.0.1'\n# No auth needed for local; for remote, set via os.environ.get('SNAPPI_AUTH_TOKEN', '')","lang":"python","description":"Instantiate the API, create a config, and add a simple IPv4 flow."},"warnings":[{"fix":"Always specify full URL: api = snappi.Api(address='https://10.10.10.10:8443')","message":"The API address must include the protocol (http/https) and port. Local default is https://localhost:11009.","severity":"gotcha","affected_versions":"all"},{"fix":"Use config = api.config() then api.set_config(config)","message":"Method set_config() and resulting 'elapsed_time' attribute are deprecated in v1.50+. Use set_config() -> config object directly.","severity":"deprecated","affected_versions":">=1.50.0"},{"fix":"Update API address to https:// or set ssl=False explicitly.","message":"In v1.40.0, the default protocol changed from HTTP to HTTPS. Older code using http:// may fail.","severity":"breaking","affected_versions":">=1.40.0"},{"fix":"Use .packet().ethernet().ipv4() for separate layers or .eth_ipv4() for convenience.","message":"Flow packet layers are built using chained methods (e.g., .packet().ethernet().eth_ipv4()). Order matters; .eth_ipv4() is a shorthand for stacking ethernet and IPv4.","severity":"gotcha","affected_versions":"all"},{"fix":"Use config.port instead of config.ports.","message":"The 'config.ports' property was renamed to 'config.port' in v1.20.0.","severity":"breaking","affected_versions":">=1.20.0"},{"fix":"Check docstring: e.g., ipv4.src.increment.start = '10.0.0.1'; ipv4.src.value = '10.0.0.1'","message":"When setting packet headers, some fields require .value assignment, others use .increment or .decrement. Not all fields support all modes.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install snappi' in the correct environment.","cause":"snappi not installed or running in a different Python environment.","error":"ModuleNotFoundError: No module named 'snappi'"},{"fix":"Use 'import snappi' then 'snappi.Api(...)'.","cause":"Import was not done correctly (e.g., from snappi import snappi).","error":"AttributeError: module 'snappi' has no attribute 'Api'"},{"fix":"Verify the API address (e.g., 'https://localhost:11009') and ensure the snappi server is running.","cause":"The controller address is incorrect or the server is not running.","error":"ConnectionError: HTTPConnectionPool ... Max retries exceeded"},{"fix":"Upgrade both client and server to the latest version, or pin to compatible versions.","cause":"Client version incompatible with server version (server may be older).","error":"ValueError: Unsupported protocol version"},{"fix":"Ensure you have added flows to config, e.g., config.flows.flow(name='test')...","cause":"Attempting to iterate over a flow before it is properly configured or added.","error":"TypeError: 'NoneType' object is not iterable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}