list_segments
Retrieve all VMware NSX network segments with details including type, subnet, admin state, and port count for network management.
Instructions
List all NSX network segments with type, subnet, admin state, and port count.
Args: target: Optional NSX Manager target name from config. Uses default if omitted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- vmware_nsx/ops/inventory.py:30-51 (handler)Implementation of the list_segments tool, which fetches network segments from the NSX Policy API.
def list_segments(client: NsxClient) -> list[dict]: """List all network segments.""" items = client.get_all("/policy/api/v1/infra/segments") return [ { "id": _sanitize(s.get("id", "")), "display_name": _sanitize(s.get("display_name", "")), "type": s.get("type", "ROUTED"), "transport_zone_path": _sanitize(s.get("transport_zone_path", "")), "vlan_ids": s.get("vlan_ids", []), "subnet": [ { "gateway": sub.get("gateway_address", ""), "network": sub.get("network", ""), } for sub in s.get("subnets", []) ], "admin_state": s.get("admin_state", "UP"), "connectivity_path": _sanitize(s.get("connectivity_path", "")), } for s in items ]