Management Plane API > Networking > Logical Switching > Logical Switch Ports

Create a Logical Port

Creates a new logical switch port. The required parameters are the
associated logical_switch_id and admin_state (UP or DOWN). Optional
parameters are the attachment and switching_profile_ids. If you don't
specify switching_profile_ids, default switching profiles are assigned to
the port. If you don't specify an attachment, the switch port remains
empty. To configure an attachment, you must specify an id, and
optionally you can specify an attachment_type (VIF or LOGICALROUTER).
The attachment_type is VIF by default.

Request:

Method:
POST
URI Path(s):
/api/v1/logical-ports
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
LogicalPort+

Example Request:

POST https://<nsx-mgr>/api/v1/logical-ports { "logical_switch_id":"849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": {"attachment_type":"VIF","id":"vif1"}, "admin_state":"UP" } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "Dhcp", "bms_interface_config": { "routing_table": ["101.20.0.0/16", "100.20.20.0/24"], "app_intf_name": "nsx-eth" } } }, "admin_state": "UP" } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "Both", "bms_interface_config": { "routing_table": ["101.20.0.0/16", "100.20.20.0/24"], "app_intf_name": "nsx-eth" } } }, "admin_state": "UP" } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "MacPool", "bms_interface_config": { "default_gateway": "192.168.1.254", "routing_table": ["101.20.0.0/16", "100.20.20.0/24"], "app_intf_name": "nsx-eth" } } }, "admin_state": "UP", "address_bindings": [ {"ip_address":"192.168.1.110"} ] } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "IpPool", "bms_interface_config": { "default_gateway": "192.168.1.254", "routing_table": ["101.20.0.0/16", "100.20.20.0/24"], "app_intf_name": "nsx-eth" } } }, "admin_state": "UP", "address_bindings": [ {"mac_address":"aa:bb:cc:dd:ee:ff"} ] } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "None", "bms_interface_config": { "default_gateway": "192.168.1.254", "routing_table": ["101.20.0.0/16", "100.20.20.0/24"], "app_intf_name": "nsx-eth" } } }, "admin_state": "UP", "address_bindings": [ {"ip_address":"192.168.1.110", "mac_address":"aa:bb:cc:dd:ee:ff"} ] } { "resource_type": "LogicalPort", "display_name": "BM1-LP", "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "attachment": { "attachment_type": "VIF", "id": "d8c2184c-1fcb-472d-a32a-524edbdaa1f8", "context": { "vif_type": "INDEPENDENT", "transport_node_uuid": "b5364421-6fbd-4670-98aa-974d8fe7462e", "app_id": "BM1_APP1", "resource_type": "VifAttachmentContext", "allocate_addresses": "None", "bms_interface_config": { "migrate_intf": "eth0", "app_intf_name": "nsx-eth" } } }, "admin_state": "UP" }

Successful Response:

Response Code:
201 Created
Response Headers:
Content-type: application/json
Response Body:
LogicalPort+

Example Response:

{ "id": "95a93e66-4fb1-4f7d-9484-1c8fd521e741", "display_name": "95a93e66-4fb1-4f7d-9484-1c8fd521e741", "resource_type": "LogicalPort", "address_bindings": [], "logical_switch_id": "849e339e-64b7-47cb-9480-33068f70dc5a", "admin_state": "UP", "attachment": { "id": "vif1", "attachment_type": "VIF" }, "switching_profile_ids": [ { "value": "49781ebb-6f76-464a-9a7e-c365ba26128b", "key": "IpDiscoverySwitchingProfile" }, { "value": "fad98876-d7ff-11e4-b9d6-1681e6b88ec1", "key": "SpoofGuardSwitchingProfile" }, { "value": "93b4b7e8-f116-415d-a50c-3364611b5d09", "key": "PortMirroringSwitchingProfile" }, { "value": "fbc4fb17-83d9-4b53-a286-ccdf04301888", "key": "SwitchSecuritySwitchingProfile" }, { "value": "f313290b-eba8-4262-bd93-fab5026e9495", "key": "QosSwitchingProfile" } ], "_last_modified_user": "admin", "_last_modified_time": 1435284566908, "_create_time": 1435284566908, "_create_user": "admin", "_revision": 0 }

Required Permissions:

crud

Feature:

switching_ports

Additional Errors: