{"id":8240,"library":"ixnetwork-restpy","title":"IxNetwork Python Client","description":"The ixnetwork-restpy library is the official Python client for automating Keysight's IxNetwork via its REST API. It provides an object-oriented interface to programmatically control test platforms, configure network topologies, generate traffic, and collect statistics. The library is actively maintained, with frequent minor releases (typically monthly or bi-monthly) to support new IxNetwork features and address bug fixes, currently at version 1.9.0.","status":"active","version":"1.9.0","language":"python","source_language":"en","source_url":"https://github.com/OpenIxia/ixnetwork_restpy","tags":["ixnetwork","network-testing","traffic-generator","automation","rest-api","keysight"],"install":[{"cmd":"pip install --upgrade ixnetwork-restpy","lang":"bash","label":"Install or Upgrade"}],"dependencies":[{"reason":"Used for underlying HTTP REST communication with the IxNetwork API server.","package":"requests","optional":false}],"imports":[{"note":"SessionAssistant is the recommended entry point for general scripting, providing simplified session management and access to the IxNetwork object.","symbol":"SessionAssistant","correct":"from ixnetwork_restpy import SessionAssistant"},{"note":"While functional, SessionAssistant is generally preferred for its consolidated features. If using TestPlatform, ensure to import from the full path `ixnetwork_restpy.testplatform.testplatform`. Older examples might show a direct import that is now incorrect.","wrong":"from ixnetwork_restpy import TestPlatform","symbol":"TestPlatform","correct":"from ixnetwork_restpy.testplatform.testplatform import TestPlatform"}],"quickstart":{"code":"import os\nfrom ixnetwork_restpy import SessionAssistant, Files\n\n# Configure connection parameters\nIXNETWORK_API_SERVER_IP = os.environ.get('IXNET_SERVER_IP', '127.0.0.1')\nIXNETWORK_USERNAME = os.environ.get('IXNET_USERNAME', 'admin')\nIXNETWORK_PASSWORD = os.environ.get('IXNET_PASSWORD', 'admin')\n\n# Create a session and connect to IxNetwork\ntry:\n    session_assistant = SessionAssistant(\n        IpAddress=IXNETWORK_API_SERVER_IP,\n        UserName=IXNETWORK_USERNAME,\n        Password=IXNETWORK_PASSWORD,\n        ClearConfig=True, # Clears any existing configuration on the server\n        LogLevel=SessionAssistant.LOGLEVEL_INFO\n    )\n    ixnetwork = session_assistant.Ixnetwork\n    print(f\"Connected to IxNetwork API Server at {IXNETWORK_API_SERVER_IP}\")\n\n    # Example: Create a simple configuration (e.g., two ports, basic traffic)\n    # These IPs and ports must match your physical setup\n    port_map = session_assistant.PortMapAssistant()\n    port_map.Map('10.0.0.1', 1, 1, Name='TxPort') # Chassis IP, Card ID, Port ID\n    port_map.Map('10.0.0.1', 1, 2, Name='RxPort') # Chassis IP, Card ID, Port ID\n    port_map.Connect(ForceOwnership=True)\n    print(\"Ports mapped and connected.\")\n\n    # Add a traffic item\n    traffic_item = ixnetwork.Traffic.TrafficItem.add(Name='Simple Traffic', TrafficType='raw')\n    traffic_item.EndpointSet.add(\n        Sources=ixnetwork.Vport.find(Name='^TxPort$').Protocols.find(),\n        Destinations=ixnetwork.Vport.find(Name='^RxPort$').Protocols.find()\n    )\n    traffic_config = traffic_item.ConfigElement.find()\n    traffic_config.FrameRate.update(Type='percentLineRate', Rate='10')\n    traffic_config.TransmissionControl.update(Type='continuous')\n    print(\"Traffic item configured.\")\n\n    # Apply and start traffic\n    ixnetwork.Traffic.Apply()\n    ixnetwork.Traffic.StartStatelessTrafficBlocking()\n    print(\"Traffic started. Waiting for stats...\")\n\n    # Get and print statistics\n    port_stats = session_assistant.StatViewAssistant('Port Statistics')\n    traffic_item_stats = session_assistant.StatViewAssistant('Traffic Item Statistics')\n    \n    print(\"\\n--- Port Statistics ---\")\n    print(port_stats)\n    print(\"\\n--- Traffic Item Statistics ---\")\n    print(traffic_item_stats)\n\n    # Stop traffic and clear config\n    ixnetwork.Traffic.StopStatelessTrafficBlocking()\n    session_assistant.ClearConfig()\n    print(\"Traffic stopped and configuration cleared.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    if 'session_assistant' in locals() and session_assistant.Is</span>Connected:\n        # Ensure the session is properly closed if it was opened\n        session_assistant.Session.delete()\n        print(\"Session deleted.\")\n","lang":"python","description":"This quickstart demonstrates how to connect to an IxNetwork API server, authenticate, map physical ports, create a basic traffic item, start/stop traffic, and retrieve statistics. Replace '10.0.0.1' with your IxNetwork chassis IP, and ensure the `IXNET_SERVER_IP`, `IXNET_USERNAME`, and `IXNET_PASSWORD` environment variables are set or updated in the script. It uses `SessionAssistant` for simplified workflow and `PortMapAssistant` for port management."},"warnings":[{"fix":"Review existing scripts and update property access to match the official API. Use `help()` on objects or consult online documentation to verify valid properties.","message":"Introduction of `slots` support in version 1.0.41 (September 2019) causes `AttributeError` when accessing non-existent properties.","severity":"breaking","affected_versions":">=1.0.41"},{"fix":"Always use a configuration file saved with a version of IxNetwork that is equal to or older than the target IxNetwork API server version.","message":"IxNetwork saved configuration files (`.ixncfg`) are generally forward-compatible but not backward-compatible. A configuration saved with a newer IxNetwork server version will not load on an older server version.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Migrate any scripts using `IxNetRestApi` to `ixnetwork-restpy` for continued support and access to new features.","message":"The older `IxNetRestApi` library is deprecated in favor of `ixnetwork-restpy`. The `IxNetRestApi` is no longer maintained, and new features/enhancements will not be added to it.","severity":"deprecated","affected_versions":"All versions (deprecation announced starting around 2021)"}],"env_vars":null,"search_vec":"'1.9.0':70 'activ':46 'address':64 'api':22,81 'autom':15,78 'bi':56 'bi-month':55 'bug':65 'client':3,13 'collect':41 'configur':35 'control':32 'current':67 'featur':62 'fix':66 'frequent':49 'generat':38,77 'interfac':29 'ixnetwork':1,6,18,61,71 'ixnetwork-restpi':5 'keysight':16,82 'librari':8,44 'maintain':47 'minor':50 'month':53,57 'network':36,73 'network-test':72 'new':60 'object':27 'object-ori':26 'offici':11 'orient':28 'platform':34 'programmat':31 'provid':24 'python':2,12 'releas':51 'rest':21,80 'rest-api':79 'restpi':7 'statist':42 'support':59 'test':33,74 'topolog':37 'traffic':39,76 'traffic-gener':75 'typic':52 'version':69 'via':19","created_at":"2026-04-16T17:01:09.752844+00:00","updated_at":"2026-04-16T17:01:09.752844+00:00","problems":{"verify_error":"error: unexpected argument '--upgrade ixnetwork-restpy' found\n\n  tip: a similar argument exists: '--upgrade'\n\nUsage: uv pip install --upgrade <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDITABLE>|--group <GROUP>>\n\nFor more information, try '--help'."},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.10.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.keysight.com/us/en/products/network-test/network-test-software/ixnetwork.html","github":"https://github.com/OpenIxia/ixnetwork_restpy","docs":null,"changelog":null,"pypi":"https://pypi.org/project/ixnetwork-restpy/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}