1 Reply Latest reply on Jul 4, 2017 2:48 PM by user10739353

    Unable to get VNIC based on VNIC OCID using BMC API through Python

    user10739353

      Hi All,

      I am trying to retrieve private IP of a VNIC using GetVNIC operation available under 'Core Services API'[https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vnic/GetVnic ].

       

      I am trying the following python code snippet -

      response = compute_client.list_vnic_attachments(compartment_id, availability_domain=blocked_ip_query_object['domain']) //get list of Attachments first

      for vnicatt in response.data:

      vnic_response = virtual_network_client.get_vnic(vnicatt.vnic_id)//'ocid1.vnic.oc1.phx.abyhqljt2gsn4fti3lkjwymvrfb7umwpgdq22uzlkpatul4a5oxxcsltbucq' - sample

      error-

      Exception in inheritence {'opc-request-id': '0EF6930ACC2341F58C6B6030F25D85DB/BE98BF1899D647F8B10DD1F51D842A9E/52AF4E5EEF94461596FDF0DB85E01319', 'code': 'NotAuthorizedOrNotFound', 'message': 'Either VNIC with ID ocid1.vnic.oc1.phx.abyhqljt2gsn4fti3lkjwymvrfb7umwpgdq22uzlkpatul4a5oxxcsltbucq does not exist or you are not authorized to access it.', 'status': 404}

      If i try to get VNIC attachment based on the same VNIC Id the same is retrieved.

      VNIC: [{

        "availability_domain": "sXbM:PHX-AD-1",

        "compartment_id": "ocid1.tenancy.oc1..aaaaaaaahem45xe3oflrnc24ms7tf2hoaqotyhfbcnsyxqeya64w7awmtcxq",

        "display_name": null,

        "id": "ocid1.vnicattachment.oc1.phx.abyhqljtdmbeyu6grp2rgeelbka4qvlmarbzr3vinojepqesyx3ciqgycjya",

        "instance_id": "ocid1.instance.oc1.phx.abyhqljt6rkhwr2u5zhcfwi6caat4np7l3srbsggzpvrldo5bfyi74giy2oa",

        "lifecycle_state": "DETACHED",

        "subnet_id": "ocid1.subnet.oc1.phx.aaaaaaaav2o64hm3i3cvaw3xhasuynpvsetteuoydndkhnv6prr2rlgumwja",

        "time_created": "2017-06-02T12:57:45.128000+00:00",

        "vnic_id": "ocid1.vnic.oc1.phx.abyhqljt2gsn4fti3lkjwymvrfb7umwpgdq22uzlkpatul4a5oxxcsltbucq"

      }]

       

      Please let us know whether to access this Rest resource we need any other IAM policy, because the user is already having administrative Role.

       

      Thanks.