oci-cli icon indicating copy to clipboard operation
oci-cli copied to clipboard

[BUG] Assign IPv6 fails with an ip-address set

Open Diniboy1123 opened this issue 4 years ago • 1 comments

Hi,

I wanted to assign an IPv6 address of my choice within the subnet using oci-cli. For that I have used the following command:

oci network vnic assign-ipv6 --vnic-id $vnicId --ip-address "2603:<redacted>::2" --unassign-if-already-assigned

Which then returns:

ServiceError:
{
    "code": "InvalidParameter",
    "message": "Conflicting query parameters {vnicId and ipAddress} are specified {Both parameters cannot be specified}",
    "opc-request-id": "<redacted>",
    "status": 400
}

If I don't specify the --ip-address flag then it works fine and it creates a new IPv6 address assigned to the VM, however that one is random.

Using the webinterface I was able to add the same IPv6 I wanted. So I copied the exact same JSON body the browser sent into $HOME/test.json:

{"vnicId":"<redacted>","ipAddress":"2603:<redacted>::2","definedTags":{},"freeformTags":{}}

And then executed: oci network vnic assign-ipv6 --from-json file://$HOME/test.json

The result was the same error like above.

I am wondering why is this happening exactly when even the docs mentions that you can specify both together: https://docs.oracle.com/en-us/iaas/tools/oci-cli/2.25.2/oci_cli_docs/cmdref/network/vnic/assign-ipv6.html#cmdoption-ip-address

--ip-address [text]

An IPv6 address of your choice. Must be an available IP address within the subnet's CIDR. If you don't specify a value, Oracle automatically assigns an IPv6 address from the subnet. The subnet is the one that contains the VNIC you specify in vnicId.

Am I doing something wrong?

Diniboy1123 avatar Jun 14 '21 22:06 Diniboy1123

I also get this issue. I don't think you're doing anything wrong. The way I read it, the ServiceError message text contradicts the documentation; it doesn't make sense for a required parameter to conflict with any other parameter, since then that other parameter is not possible to use.

Edit to add: This issue exists for me today with oci-cli v3.0.5.

i-g-k avatar Sep 29 '21 04:09 i-g-k

This issue is fixed with the latest version of OCI CLI.

niskulka71 avatar Aug 16 '23 19:08 niskulka71