get_logical_port_status
Check operational status including admin state, link state, and attachment for VMware NSX logical ports to monitor network connectivity and configuration.
Instructions
Check logical port operational status (admin state, link state, attachment).
Args: port_id: The logical port ID. target: Optional NSX Manager target name from config. Uses default if omitted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port_id | Yes | ||
| target | No |
Implementation Reference
- mcp_server/server.py:347-357 (handler)MCP tool handler that calls the underlying vmware_nsx operation for getting logical port status.
def get_logical_port_status(port_id: str, target: str | None = None) -> dict: """Check logical port operational status (admin state, link state, attachment). Args: port_id: The logical port ID. target: Optional NSX Manager target name from config. Uses default if omitted. """ from vmware_nsx.ops.troubleshoot import get_logical_port_status as _get_port client = _get_connection(target) return _get_port(client, port_id) - vmware_nsx/ops/troubleshoot.py:29-45 (helper)The core logic implementation that interacts with the NSX client to retrieve logical port status.
def get_logical_port_status(client: NsxClient, segment_id: str) -> dict: """Get port status and realized state for all ports on a segment. Retrieves ports from the Policy API and their realized operational state from the Management API. Args: client: Authenticated NSX API client. segment_id: Segment identifier. Returns: Dict with segment info, port list, and per-port realized state. """ # Get segment info seg = client.get(f"/policy/api/v1/infra/segments/{segment_id}") # Get ports on this segment