Updated on 2022-01-25 GMT+08:00

Updating the Port IP Address

Function

This API is used to update the port IP address.

Restrictions

  • The port must be a primary network port and cannot contain IPv6 addresses.
  • The port cannot be bound to a virtual IP address.
  • The subnet of the port after the update and the current subnet must belong to the same VPC.
  • The ECS corresponding to the port is stopped.

URI

PUT /v1/{project_id}/ports/{port_id}/subnet-ip

Table 1 describes the parameters.
Table 1 Parameter description

Name

Mandatory

Description

port_id

Yes

Specifies the port ID, which uniquely identifies the port.

project_id

Yes

Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Request Message

  • Request parameter
    Table 2 Request parameter

    Name

    Mandatory

    Type

    Description

    subnet_id

    Yes

    String

    Specifies the subnet ID.

    ip_address

    No

    String

    Specifies the port IP address.

    The IP address must be in the subnet CIDR block.

  • Example request
    PUT https://{Endpoint}/v1/{project_id}/ports/7204e0da-40de-4207-a536-6f59b84f6f0e/subnet-ip
    
    {
        "subnet_id": "689156ca-038f-4478-b265-fd26aa8bbe31",
        "ip_address": "192.168.0.9"
    }

Response Message

  • Response parameter
    Table 3 Response parameter

    Name

    Type

    Description

    port

    Object

    Specifies the port objects. For details, see Table 4.

    Table 4 Description of the port field

    Name

    Type

    Description

    id

    String

    Specifies the port ID, which uniquely identifies the port.

    name

    String

    • Specifies the port name.
    • The value can contain no more than 255 characters. This parameter is left blank by default.

    network_id

    String

    • Specifies the ID of the network to which the port belongs.
    • The network ID must be a real one in the network environment.

    admin_state_up

    Boolean

    • Specifies the administrative state of the port.
    • The value can only be true, and the default value is true.

    mac_address

    String

    • Specifies the port MAC address.
    • The system automatically sets this parameter, and you are not allowed to configure the parameter value.

    fixed_ips

    Array of fixed_ip objects

    • Specifies the port IP address. For details, see Table 5.
    • A port supports only one fixed IP address that cannot be changed.

    device_id

    String

    • Specifies the ID of the device to which the port belongs.
    • The system automatically sets this parameter, and you are not allowed to configure or change the parameter value.

    device_owner

    String

    • Specifies the belonged device, which can be the DHCP server, router, load balancer, or Nova.
    • The system automatically sets this parameter, and you are not allowed to configure or change the parameter value.

    tenant_id

    String

    Specifies the project ID.

    status

    String

    • The value can be ACTIVE, BUILD, or DOWN.
    • Specifies the port status. The status of a HANA SR-IOV VM port is always DOWN.

    security_groups

    Array of strings

    Specifies the security group UUID (extended attribute).

    allowed_address_pairs

    Array of allow_address_pair objects

    • Specifies a set of zero or more allowed address pairs. An address pair consists of an IP address and MAC address. This attribute is extended. For details, see parameter allow_address_pair in Table 6.
    • The IP address cannot be 0.0.0.0.
    • Configure an independent security group for the port if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.

    extra_dhcp_opts

    Array of extra_dhcp_opt objects

    Specifies the extended option (extended attribute) of DHCP. For details, see Table 7.

    binding:vnic_type

    String

    • Specifies the type of the bound vNIC.
    • The value can be normal or direct. Parameter normal indicates software switching. Parameter direct indicates SR-IOV PCIe passthrough, which is not supported.
    Table 5 fixed_ip object

    Name

    Type

    Description

    subnet_id

    String

    Specifies the ID of the subnet to which the port belongs.

    ip_address

    String

    Specifies the port IP address.

    Table 6 allow_address_pair object

    Name

    Type

    Description

    ip_address

    String

    • Specifies the IP address.
    • You cannot set it to 0.0.0.0.
    • Configure an independent security group for the port if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.

    mac_address

    String

    Specifies the MAC address.

    Table 7 extra_dhcp_opt object

    Name

    Type

    Description

    opt_name

    String

    Specifies the option name.

    opt_value

    String

    Specifies the option value.

  • Example response
    {
        "port": {
            "id": "7204e0da-40de-4207-a536-6f59b84f6f0e",
            "name": "adc",
            "status": "DOWN",
            "admin_state_up": "true",
            "fixed_ips": [
                {
                    "subnet_id": "689156ca-038f-4478-b265-fd26aa8bbe31",
                    "ip_address": "192.168.0.9"
                }
            ],
            "mac_address": "fa:16:3e:d7:f2:6c",
            "network_id": "b4152e98-e3af-4e49-bb7f-7766e2b5ec63",
            "tenant_id": "caa6cf4337ea47fb823b15709ebe8591",
            "device_id": "",
            "device_owner": "",
            "security_groups": [
                "59b39002-e79b-4bac-8e27-aa884ab1beb6"
            ],
            "extra_dhcp_opts": [],
            "allowed_address_pairs": [],
            "binding:vnic_type": "normal"
        }
    }

Status Code

See Status Codes.

Error Code

See Error Codes.