Skip to content

Commit

Permalink
Merge pull request #131 from oracle-devrel/develop
Browse files Browse the repository at this point in the history
Automation Toolkit Release v2024.4.2
  • Loading branch information
xs2suruchi authored Nov 8, 2024
2 parents 8a54274 + 70fc80c commit 15c4406
Show file tree
Hide file tree
Showing 37 changed files with 782 additions and 177 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<br>

[What's New](https://github.com/oracle-devrel/cd3-automation-toolkit/releases/tag/v2024.4.1) &nbsp;&nbsp;[Excel Templates](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/excel-templates/) &nbsp;&nbsp;[CD3 Docs](https://oracle-devrel.github.io/cd3-automation-toolkit/)&nbsp;&nbsp; [Watch & Learn](https://www.youtube.com/playlist?list=PLPIzp-E1msrbJ3WawXVhzimQnLw5iafcp) &nbsp;&nbsp;[Blogs & Tutorials](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/tutorials/) &nbsp;&nbsp;[Livelabs](https://apexapps.oracle.com/pls/apex/f?p=133:180:112501098061930::::wid:3724) &nbsp;&nbsp;[Slack Channel](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/queries)
[What's New](https://github.com/oracle-devrel/cd3-automation-toolkit/releases/tag/v2024.4.2) &nbsp;&nbsp;[Excel Templates](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/excel-templates/) &nbsp;&nbsp;[CD3 Docs](https://oracle-devrel.github.io/cd3-automation-toolkit/)&nbsp;&nbsp; [Watch & Learn](https://www.youtube.com/playlist?list=PLPIzp-E1msrbJ3WawXVhzimQnLw5iafcp) &nbsp;&nbsp;[Blogs & Tutorials](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/tutorials/) &nbsp;&nbsp;[Livelabs](https://apexapps.oracle.com/pls/apex/f?p=133:180:112501098061930::::wid:3724) &nbsp;&nbsp;[Slack Channel](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/queries)

<br>

Expand Down
4 changes: 2 additions & 2 deletions cd3_automation_toolkit/Database/create_terraform_adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def create_terraform_adb(inputfile, outdir, service_dir, prefix, ct):
k +=1
else:
wl_str = ""
tempdict = {'whitelisted_ips': wl_str,'network_compartment_id': network_compartment_id, 'vcn_name': vcn_name,
'subnet_id': subnet_id }
#tempdict = {'whitelisted_ips': wl_str,'network_compartment_id': network_compartment_id, 'vcn_name': vcn_name,'subnet_id': subnet_id }
tempdict = {'whitelisted_ips': wl_str }
tempStr.update(tempdict)


Expand Down
2 changes: 1 addition & 1 deletion cd3_automation_toolkit/Database/templates/adb-template
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ adb = {
database_edition = "{{ database_edition }}" #Only for BYOL license model
{% endif %}

{% if data_storage_size_in_tbs == "" %}
{% if data_storage_size_in_tb == "" %}
data_storage_size_in_tbs = {{ data_storage_size_in_tb }}
{% endif %}
db_version = "19c"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def export_users(inputfile, outdir, service_dir, config, signer, ct,export_domai
domain_name = domain_key.split("@")[1]
domain_client = oci.identity_domains.IdentityDomainsClient(config=config, signer=signer,
service_endpoint=idcs_endpoint)
users = domain_client.list_users()
users = domain_client.list_users(limit=100000) # change this to pagination once api supports
index = 0
for user in users.data.resources:
defined_tags_info = user.urn_ietf_params_scim_schemas_oracle_idcs_extension_oci_tags
Expand Down
14 changes: 11 additions & 3 deletions cd3_automation_toolkit/Network/BaseNetwork/create_major_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ def create_drg_and_attachments(inputfile, outdir):

if columnname == "DRG Name":
drg_name = columnvalue
drg_tf_name = commonTools.check_tf_variable(drg_name)
if ("ocid1.drg.oc" not in drg_name):
drg_tf_name = commonTools.check_tf_variable(drg_name)
else:
drg_tf_name = drg_name
tempdict['drg_tf_name'] = drg_tf_name

if (columnname == 'Attached To'):
Expand Down Expand Up @@ -327,6 +330,8 @@ def create_drg_and_attachments(inputfile, outdir):
#if it is Auto Generated RT(during export) dont attach any RT to DRG attachment
if(columnvalue in commonTools.drg_auto_RTs):
drg_rt_tf_name = ''
elif("ocid1.drgroutetable.oc1" in columnvalue):
drg_rt_tf_name = columnvalue
elif(columnvalue!=''):
drg_rt_tf_name = commonTools.check_tf_variable(drg_name + "_" + columnvalue)
tempStr['drg_rt_tf_name'] = drg_rt_tf_name
Expand All @@ -340,7 +345,9 @@ def create_drg_and_attachments(inputfile, outdir):
drgstr_skeleton = drg_template.render(count=0)[:-1]
region_included_drg.append(region)
tempStr['drg_version'] = drg_versions[region, drg_name]
drgstr = drg_template.render(tempStr)
drgstr=''
if ("ocid1.drg.oc" not in drg_tf_name):
drgstr = drg_template.render(tempStr)

if(attachedto=="attached"):
drg_attach = drg_attach_template.render(tempStr)
Expand All @@ -360,7 +367,8 @@ def create_drg_and_attachments(inputfile, outdir):
if region in region_included_drg:
if(drg_attach_tfStr[region]!=''):
drg_attach_tfStr[region] = drg_attach_skeleton + drg_attach_tfStr[region]
drg_tfStr[region] = drgstr_skeleton + drg_tfStr[region]
if(drg_tfStr[region] != ''):
drg_tfStr[region] = drgstr_skeleton + drg_tfStr[region]

def processVCN(tempStr):
rt_tf_name = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def create_terraform_drg_route(inputfile, outdir, service_dir, prefix, ct, non_g
drg_rt_dstrb_tf_name = ''
drg_rt_dstrb_res_name = ''
region = str(df.loc[i, 'Region']).strip()

vcn_connectivity_in_excel = ""
if str(df.loc[i, 'Attached To']).lower().startswith("rpc"):
vcn_connectivity_in_excel = "connectivity"
elif str(df.loc[i, 'Attached To']).lower().startswith("vcn"):
Expand Down Expand Up @@ -218,6 +218,9 @@ def create_terraform_drg_route(inputfile, outdir, service_dir, prefix, ct, non_g
# Dont create any route table or route distribution name if using Auto Generated ones
if (DRG_RT in commonTools.drg_auto_RTs and DRG_RD in commonTools.drg_auto_RDs):
continue
# Dont create any oute table or route distribution name if OCID is goven in DRG RT Name
if ("ocid1.drgroutetable.oc" in DRG_RT):
continue

region = region.strip().lower()
if region not in ct.all_regions:
Expand Down
35 changes: 30 additions & 5 deletions cd3_automation_toolkit/Network/BaseNetwork/exportRoutetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,39 @@ def get_network_entity_name(config,signer,network_identity_id):
vcn1 = VirtualNetworkClient(config=config, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY,signer=signer)
if('internetgateway' in network_identity_id):
igw=vcn1.get_internet_gateway(network_identity_id)
network_identity_name = "igw:"+igw.data.display_name
network_entity_comp_id=igw.data.compartment_id
if network_entity_comp_id in export_compartment_ids:
network_identity_name = "igw:"+igw.data.display_name
else:
network_identity_name = "igw:" + igw.data.id
return network_identity_name

elif ('servicegateway' in network_identity_id):
sgw = vcn1.get_service_gateway(network_identity_id)
network_identity_name = "sgw:"+sgw.data.display_name
network_entity_comp_id = sgw.data.compartment_id
if network_entity_comp_id in export_compartment_ids:
network_identity_name = "sgw:" + sgw.data.display_name
else:
network_identity_name = "sgw:"+sgw.data.id
return network_identity_name


elif ('natgateway' in network_identity_id):
ngw = vcn1.get_nat_gateway(network_identity_id)
network_identity_name = "ngw:"+ngw.data.display_name
network_entity_comp_id = ngw.data.compartment_id
if network_entity_comp_id in export_compartment_ids:
network_identity_name = "ngw:" + ngw.data.display_name
else:
network_identity_name = "ngw:"+ngw.data.id
return network_identity_name

elif ('localpeeringgateway' in network_identity_id):
lpg = vcn1.get_local_peering_gateway(network_identity_id)
network_identity_name = "lpg:"+lpg.data.display_name
network_entity_comp_id = lpg.data.compartment_id
if network_entity_comp_id in export_compartment_ids:
network_identity_name = "lpg:" + lpg.data.display_name
else:
network_identity_name = "lpg:"+lpg.data.id
return network_identity_name
elif ('drgattachment' in network_identity_id):
drg_attach = vcn1.get_drg_attachment(network_identity_id)
Expand All @@ -46,7 +62,11 @@ def get_network_entity_name(config,signer,network_identity_id):
return network_identity_name
elif ('drg' in network_identity_id):
drg = vcn1.get_drg(network_identity_id)
network_identity_name = "drg:"+drg.data.display_name
network_entity_comp_id = drg.data.compartment_id
if network_entity_comp_id in export_compartment_ids:
network_identity_name = "drg:" + drg.data.display_name
else:
network_identity_name = "drg:"+drg.data.id
return network_identity_name

"""
Expand Down Expand Up @@ -282,6 +302,7 @@ def export_routetable(inputfile, outdir, service_dir,config1,signer1, ct, export
config=config1
global signer,tf_or_tofu
signer=signer1
global export_compartment_ids

tf_or_tofu = ct.tf_or_tofu
tf_state_list = [tf_or_tofu, "state", "list"]
Expand Down Expand Up @@ -316,6 +337,10 @@ def export_routetable(inputfile, outdir, service_dir,config1,signer1, ct, export
"import_commands_network_routerules.sh")
importCommands[reg] = ''

export_compartment_ids = []
for comp in export_compartments:
export_compartment_ids.append(ct.ntk_compartment_ids[comp])

for reg in export_regions:
config.__setitem__("region", commonTools().region_dict[reg])
state = {'path': f'{outdir}/{reg}/{service_dir}', 'resources': []}
Expand Down
Loading

0 comments on commit 15c4406

Please sign in to comment.