get_segment
Retrieve detailed configuration and status information for a specific network segment in VMware NSX environments to manage network infrastructure.
Instructions
Get detailed info for a specific network segment.
Args: segment_id: The segment ID (policy path name). target: Optional NSX Manager target name from config. Uses default if omitted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| segment_id | Yes | ||
| target | No |
Implementation Reference
- vmware_nsx/ops/inventory.py:54-79 (handler)The implementation of the get_segment tool logic, which retrieves segment details and their associated ports from the NSX Policy API.
def get_segment(client: NsxClient, segment_id: str) -> dict: """Get segment details including ports.""" seg = client.get(f"/policy/api/v1/infra/segments/{segment_id}") # Get ports on this segment ports = client.get_all( f"/policy/api/v1/infra/segments/{segment_id}/ports" ) return { "id": _sanitize(seg.get("id", "")), "display_name": _sanitize(seg.get("display_name", "")), "type": seg.get("type", "ROUTED"), "admin_state": seg.get("admin_state", "UP"), "subnets": seg.get("subnets", []), "transport_zone_path": _sanitize(seg.get("transport_zone_path", "")), "connectivity_path": _sanitize(seg.get("connectivity_path", "")), "vlan_ids": seg.get("vlan_ids", []), "port_count": len(ports), "ports": [ { "id": _sanitize(p.get("id", "")), "display_name": _sanitize(p.get("display_name", "")), "attachment": p.get("attachment", {}), } for p in ports[:50] # Limit to 50 ports ], }