Let's just be honest about the state of things from an automation standpoint:
import pandas as pd
import re
# Variable Definitions
template_file_name = 'phonebuttontemplate.csv'
device_file_name = 'deviceprofile.csv'
modified_device_file_name = 'deviceprofile_modified.csv'
replacement_value = 'DELETED'
end_column_number = 89
print_line_counts = False # Flag this if you encounter issues and want to print the Line count for each row in the template csv
first_column_name = 'Device Profile Name'
# Read phonebuttontemplate.csv
print("Reading phonebuttontemplate.csv...")
template_df = pd.read_csv(template_file_name)
# Store header row
header_row_template = list(template_df.columns)
# Initialize a dictionary to store the values
template_dict = {}
# Loop through the DataFrame rows
for _, row in template_df.iterrows():
name = row.get('NAME', None)
# Check if the row has a NAME and is not empty
if pd.notna(name):
# Check each column for "Line", "Speed Dial", or "None" under the "TYPE OF FEATURE \d{1,2}" pattern
count = 0
empty_value_encountered = False
for col in header_row_template:
if re.match(r'TYPE OF FEATURE \d{1,2}', col):
value = row[col]
if value == 'Line':
count += 1
elif value == 'None':
empty_value_encountered = True
break
# If an empty value was encountered, stop counting and break the loop
if empty_value_encountered:
break
template_dict[name] = {'count': count + 1} # Start the count from 1
# If print_line_counts is True, print the name of the template and the count of its lines
if print_line_counts:
print(f"{name}: {count + 1} lines")
# Read deviceprofile.csv
print("Reading deviceprofile.csv...")
device_df = pd.read_csv(device_file_name)
# Store header row
header_row_device = list(device_df.columns)
# Iterate over the rows in deviceprofile.csv
for index, row in device_df.iterrows():
template_name = row['Phone Button Template']
device_profile_name = row[first_column_name]
if pd.notna(template_name) and pd.notna(device_profile_name):
# Check if the template name exists in the template_dict
if template_name in template_dict:
template_info = template_dict[template_name]
count = template_info['count']
directory_number_col = f'Directory Number {count}'
call_id_presentation_col = f'Calling Line ID Presentation When Diverted {end_column_number}'
device_df.loc[index, directory_number_col:call_id_presentation_col] = replacement_value
# Write the DataFrame to a new file
device_df.to_csv(modified_device_file_name, index=False)
print("Processing completed successfully.")
The prominent issue in terms of coding is chatGPT, which needs to be addressed when considering collaboration (collab).
To begin with, it would be beneficial to develop a universal UC API that can merge various methods and functions, enabling the automation of any task. Although this idea is intriguing, it necessitates the complete rewriting of these large-scale applications. The goal would be to leverage AI and prioritize an API-first approach.
Once this is accomplished, a standardized UC dashboard could be implemented. This would unify platforms like Webex and CUCM, allowing for seamless provisioning, integration, and communication without the need for intermediary components. These components were not specifically designed for the purpose and still rely on outdated Unix code, essentially being rooted in the Tandberg system.
I propose a significant transformation, a genuine movement empowered by AI, to bring UC up to date and in line with current advancements.
Anyhow, that's my hot-take. I am working on automating all the provisioning in my lab, check back here in a couple months. Maybe I will have a solid solution. As it stands right now I just have a certificate generation, request and load API for various UC devices.
That is the start of my ucEngineersToolKit API
Good day and may it be a great one!