I want to use python oci package to get information about environment. how to list all IPs addresses (both public or private) attached to compute node? list_instances() does not provide this part of compute details unfortunately. thanks.
Please use this code. Basically you have to lookup VNIC Attachment object and filter VNIC_ID based on InstanceId. VNIC_ID can be used for looking up IP Addresses subsequently.
I have used data[0] to indicate the first attachment. You could use a loop to go through all attachments and print the IP.
compute_client = oci.core.ComputeClient(config={}, signer=signer)
network_client = oci.core.VirtualNetworkClient(
config={}, signer=signer)
vnic_id = compute_client.list_vnic_attachments(
cd_compartment_id, instance_id=instanceId).data[0].vnic_id
private_ip = network_client.get_vnic(vnic_id).data.private_ip