create_segment
Create a new NSX network segment (overlay or VLAN-backed) via the Policy API. Provide a segment ID, display name, transport zone, and optionally subnet or VLAN IDs.
Instructions
[WRITE] Create a new NSX network segment (overlay or VLAN-backed) via the Policy API.
Prerequisite: get the transport zone from list_transport_zones first. Pass subnet for overlay routed segments, or vlan_ids for VLAN-backed transport zones. Re-running with the same segment_id overwrites that segment (PUT semantics). Returns the created segment dict (id, display_name, subnets, transport_zone_path); on failure returns {"error", "hint"}. The operation is recorded in the audit log (~/.vmware/audit.db).
Args: segment_id: Unique segment identifier (alphanumerics, hyphens, underscores only); becomes policy path /infra/segments/. display_name: Human-readable name shown in the NSX UI. transport_zone_path: Full transport zone policy path, e.g. "/infra/sites/default/enforcement-points/default/transport-zones/". vlan_ids: VLAN ID(s) for VLAN-backed segments, comma- or hyphen-separated individual IDs (e.g. "100" or "100,200"). Omit for overlay. subnet: Gateway IP in CIDR notation, e.g. "192.168.1.1/24" (the gateway address, not the network address). Omit for VLAN-backed segments. target: NSX Manager name from config.yaml. Uses the default target if omitted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subnet | No | ||
| target | No | ||
| vlan_ids | No | ||
| segment_id | Yes | ||
| display_name | Yes | ||
| transport_zone_path | Yes |