Repository navigation
{OracleDatabase} Update listPrivateIps for cloud VM cluster #10474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JaysonTaiMicrosoft
merged 5 commits into
Azure:main
from
mihretkidane-OCI:list-privateIps
Oct 16, 2026
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7684ea6
list private Ips
mihretkidane-OCI 4eb27dc
fix version
mihretkidane-OCI 87c94df
comment resolution
mihretkidane-OCI cc2aff6
Update src/oracle-database/HISTORY.rst
mihretkidane-OCI 3169855
Merge branch 'refs/heads/main' into list-privateIps
mihretkidane-OCI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...tests/latest/recordings/test_oracledatabase_cloud_vm_cluster_list_private_ip_address.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"subnetId": "ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq", | ||
| "vnicId": "ocid1.vnic.oc1.uk-london-1.abwgiljswbwvdpkhucoaztvv24rkri6toyo4mvkandol5h7zognd7tnycc5q"}' | ||
| headers: | ||
| Accept: | ||
| - application/json | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| CommandName: | ||
| - oracle-database cloud-vm-cluster list-private-ip-address | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '206' | ||
| Content-Type: | ||
| - application/json | ||
| ParameterSetName: | ||
| - --resource-group --cloudvmclustername --subnet-id --vnic-id | ||
| User-Agent: | ||
| - AZURECLI/2.81.0 azsdk-python-core/1.35.0 Python/3.13.3 (macOS-26.7.1-arm64-arm-64bit-Mach-O) | ||
| method: POST | ||
| uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/advancedNetworkingTest/providers/Oracle.Database/cloudVmClusters/DataGuardTest0504/listPrivateIpAddresses?api-version=2026-07-01-preview | ||
| response: | ||
| body: | ||
| string: '{"value":[{"displayName":"dataguardtest-7vmff2-vip","hostnameLabel":"dataguardtest-7vmff2-vip","ipAddress":"10.0.1.232","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaabzrtdqptg5h3g6f7c7lpfs7ps7vqpimuyhjbmdbonf5nthdubjsq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"dataguardtest-7vmff-scan-0","hostnameLabel":"","ipAddress":"10.0.1.195","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaadumrne6zk5y7rb7np425esjralbxjmdk74rqvyoigmsjky3nxvbq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"dataguardtest-7vmff2","hostnameLabel":"dataguardtest-7vmff2","ipAddress":"10.0.1.164","ocid":"ocid1.privateip.oc1.uk-london-1.aaaaaaaammhumrkjjefvo5iaipmd7ezrfh2itw35ketajeync7l7v33vblja","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"},{"displayName":"ocid1.dbnode.oc1.uk-london-1.anwgiljs2edokzyafrndhxrytvfrg3xto2jxhj2c3f52mavzeetc3kvinuwq-dataguardtest-7vmff2-client1","hostnameLabel":"dataguardtest-7vmff2-client1","ipAddress":"10.0.1.210","ocid":"ocid1.privateip.oc1.uk-london-1.abwgiljsockazxrkvcg6es7lbplt55u4gghn6piceeac6x4nwbr5ubx5ovcq","subnetId":"ocid1.subnet.oc1.uk-london-1.aaaaaaaaequboxnii6bxqgkhvabu4hmsywaz5msdd4es4crvpxfqif6ahrnq"}],"nextLink":null}' | ||
| headers: | ||
| cache-control: | ||
| - no-cache | ||
| content-length: | ||
| - '1359' | ||
| content-type: | ||
| - application/json; charset=utf-8 | ||
| date: | ||
| - Thu, 15 Oct 2026 17:17:57 GMT | ||
| expires: | ||
| - '-1' | ||
| opc-request-id: | ||
| - oci-6149484495C1B14-202610151717/667A29D3E9A69142C40AD16A4C485272/8014486A6A85A90A86519691A6DD9DC6 | ||
| pragma: | ||
| - no-cache | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubDomains | ||
| vary: | ||
| - Origin,Accept-Encoding | ||
| x-cache: | ||
| - CONFIG_NOCACHE | ||
| x-content-type-options: | ||
| - nosniff | ||
| x-ms-operation-identifier: | ||
| - tenantId=9ef05df2-ad7c-4737-aba9-a5e1b3fa5ae1,objectId=ed0404db-6d52-44c6-a09d-182ac122b912/uksouth/435a1a2d-938a-49bb-ba0d-875a31d66474 | ||
| x-ms-providerhub-traffic: | ||
| - 'True' | ||
| x-ms-ratelimit-remaining-subscription-global-writes: | ||
| - '2999' | ||
| x-ms-ratelimit-remaining-subscription-writes: | ||
| - '199' | ||
| x-msedge-ref: | ||
| - 'Ref A: 3725DD5E2C224528ADF9D6FD3DCF8A7A Ref B: BY1AA1072318031 Ref C: 2026-10-15T17:17:50Z' | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
37 changes: 37 additions & 0 deletions
37
...le-database/azext_oracle_database/tests/latest/test_oracle_database_private_ip_address.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
|
|
||
| from azure.cli.testsdk import ScenarioTest, live_only | ||
| from azure.cli.testsdk.scenario_tests import AllowLargeResponse | ||
|
|
||
|
|
||
| class OracleDatabasePrivateIpAddressScenario(ScenarioTest): | ||
|
|
||
| # @live_only() | ||
| @AllowLargeResponse(size_kb=10240) | ||
| def test_oracledatabase_cloud_vm_cluster_list_private_ip_address(self): | ||
| # Populate the existing cluster details and set its OCI subnet/VNIC environment variables. | ||
| resource_group = 'advancedNetworkingTest' | ||
| cloud_vm_cluster_name = 'DataGuardTest0504' | ||
| subnet_id = os.environ.get('AZURE_ORACLE_DATABASE_SUBNET_ID', '<subnet-ocid>') | ||
| vnic_id = os.environ.get('AZURE_ORACLE_DATABASE_VNIC_ID', '<vnic-ocid>') | ||
|
|
||
| result = self.cmd( | ||
| 'az oracle-database cloud-vm-cluster list-private-ip-address ' | ||
| '--resource-group {} ' | ||
| '--cloudvmclustername {} ' | ||
| '--subnet-id {} ' | ||
| '--vnic-id {}'.format( | ||
| resource_group, | ||
| cloud_vm_cluster_name, | ||
| subnet_id, | ||
| vnic_id, | ||
| ) | ||
| ).get_output_in_json() | ||
| self.assertIsInstance(result, list) | ||
| self.assertTrue(result) | ||
| self.assertTrue(all('ipAddress' in address for address in result)) |
86 changes: 86 additions & 0 deletions
86
...tabase/azext_oracle_database/tests/latest/test_oracle_database_private_ip_address_unit.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import json | ||
| import unittest | ||
| from types import SimpleNamespace | ||
| from unittest.mock import patch | ||
|
|
||
| from azure.cli.core.aaz._command_ctx import AAZCommandCtx | ||
| from azure.cli.core.mock import DummyCli | ||
| from azure.core import PipelineClient | ||
| from azure.core.pipeline.policies import ContentDecodePolicy | ||
|
|
||
| from azext_oracle_database.aaz.latest.oracle_database.cloud_vm_cluster._list_private_ip_address import ( | ||
| ListPrivateIpAddress, | ||
| ) | ||
|
|
||
|
|
||
| class PrivateIpAddressPagingTest(unittest.TestCase): | ||
| SUBSCRIPTION = '00000000-0000-0000-0000-000000000000' | ||
| URL = ( | ||
| 'https://management.azure.com/subscriptions/' + SUBSCRIPTION + | ||
| '/resourceGroups/test-rg/providers/Oracle.Database/cloudVmClusters/test-cluster/' | ||
| 'listPrivateIpAddresses?api-version=2026-07-01-preview' | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def _address(ip_address): | ||
| return { | ||
| 'displayName': 'test-address', | ||
| 'hostnameLabel': 'test-host', | ||
| 'ipAddress': ip_address, | ||
| 'ocid': 'ocid1.privateip.test', | ||
| 'subnetId': 'ocid1.subnet.test', | ||
| } | ||
|
|
||
| def _run_command(self, pages): | ||
| cli_ctx = DummyCli() | ||
| client = PipelineClient(base_url='https://management.azure.com') | ||
| sessions = [ | ||
| SimpleNamespace( | ||
| http_response=SimpleNamespace(status_code=200), | ||
| context={ContentDecodePolicy.CONTEXT_NAME: page}, | ||
| ) | ||
| for page in pages | ||
| ] | ||
| command = ListPrivateIpAddress(cli_ctx=cli_ctx) | ||
| with patch.object(AAZCommandCtx, 'get_http_client', return_value=client), \ | ||
| patch.object(client, 'send_request', side_effect=sessions) as send_request: | ||
| output = list(command({ | ||
| 'subscription': self.SUBSCRIPTION, | ||
| 'resource_group': 'test-rg', | ||
| 'cloudvmclustername': 'test-cluster', | ||
| 'subnet_id': 'ocid1.subnet.test', | ||
| 'vnic_id': 'ocid1.vnic.test', | ||
| })) | ||
| return output, [call.kwargs['request'] for call in send_request.call_args_list] | ||
|
|
||
| def test_single_page_returns_address_array(self): | ||
| addresses = [self._address('10.0.1.10'), self._address('10.0.1.11')] | ||
| output, requests = self._run_command([{'value': addresses, 'nextLink': None}]) | ||
|
|
||
| self.assertEqual(output, addresses) | ||
| self.assertEqual(len(requests), 1) | ||
| self.assertEqual(requests[0].method, 'POST') | ||
| self.assertEqual(requests[0].url, self.URL) | ||
| self.assertEqual(json.loads(requests[0].body), { | ||
| 'subnetId': 'ocid1.subnet.test', 'vnicId': 'ocid1.vnic.test', | ||
| }) | ||
|
|
||
| def test_continuation_link_fetches_and_combines_address_pages(self): | ||
| first = self._address('10.0.1.10') | ||
| second = self._address('10.0.1.11') | ||
| next_link = self.URL + '&$skiptoken=next-page' | ||
| output, requests = self._run_command([ | ||
| {'value': [first], 'nextLink': next_link}, | ||
| {'value': [second], 'nextLink': None}, | ||
| ]) | ||
|
|
||
| self.assertEqual(output, [first, second]) | ||
| self.assertEqual(len(requests), 2) | ||
| self.assertEqual(requests[0].method, 'POST') | ||
| self.assertEqual(requests[1].method, 'GET') | ||
| self.assertEqual(requests[1].url, next_link) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.