$ uuid1f876390-cd8e-11ee-a1ba-6b8af6d72721$ uuid2015d0c6-cd8e-11ee-b340-032d755e306c$ uuid2077689a-cd8e-11ee-a8eb-2bc263ba9a06
import uuidoutput_file = open(r'C:\Users\patri\Documents\python\abc.txt', 'w')devices = ["dev1", "dev2","dev3"]for x in devices: u = uuid.uuid4() print(x, ": ",u) #output_file.writelines(x, ": ",u) output_file.writelines(f"{'':>10}{x}{": "}{u}{"\n"}")# Close fileoutput_file.close()# Checking if the data is written to file or notoutput_file = open(r'C:\Users\patri\Documents\python\abc.txt', 'r') print("Read the saved file: \n")print(output_file.read())output_file.close()
abc.txt dev1: 298007e3-2244-42cc-a9d7-bcf15b6d6de0 dev2: 8b59170a-b013-46d5-bb3e-31c6529b7299 dev3: a22907f6-0e6c-4779-bf2a-7794c72f1c8f
<dhcpd> <lan> <enable>1</enable> <ddnsdomainalgorithm>hmac-md5</ddnsdomainalgorithm> <numberoptions> <item/> </numberoptions> <range> <from>10.59.11.200</from> <to>10.59.11.245</to> </range> <winsserver/> <dnsserver/> <ntpserver/> <staticmap> <mac>a1:b1:c1:d1:e1:f1</mac> <ipaddr>10.59.11.100</ipaddr> <hostname>DAD-DESKTOP</hostname> <descr>DAD-DESKTOP</descr> <winsserver/> <dnsserver/> <ntpserver/> </staticmap> <staticmap> <mac>a2:b2:c2:d2:e2:f2</mac> <ipaddr>10.59.11.101</ipaddr> <hostname>MOM-DESKTOP</hostname> <descr>MOM-DESKTOP</descr> <winsserver/> <dnsserver/> <ntpserver/> </staticmap> </lan> </dhcpd>
<reservation uuid="c7495e59-000b-4bf3-b083-0d35f099e946"> <subnet>4e3016b1-b603-44bd-a361-b33c44333c98</subnet> <ip_address>10.59.11.100</ip_address> <hw_address>a1:b1:c1:d1:e1:f1</hw_address> <hostname>DAD-DESKTOP</hostname> <description>DAD-DESKTOP</description> </reservation> <reservation uuid="c82430df-45c7-4d9b-b11b-22f228af7e02"> <subnet>4e3016b1-b603-44bd-a361-b33c44333c98</subnet> <ip_address>10.59.11.101</ip_address> <hw_address>a2:b2:c2:d2:e2:f2</hw_address> <hostname>MOM-DESKTOP</hostname> <description>MOM-DESKTOP</description> </reservation>
# OPNsense admin: copy OPNsense_isc_to_kea_reservations.py and the two input_file# into a directory# input_file: current set to config-OPNsense.localdomain-20240218111111.xml# input_file: config-OPNsense.localdomain-20240218000000.xml## >>>> python3 OPNsense_isc_to_kea_reservations.py## >>>>>> TO MODIFY YOUR OPNsense CONFIG <<<<<<# OPNsense admin: Search [ADD YOUR CONFIG] and change input_file and add # your config-OPNsense.localdomain-2024*.xml## merge_file: merge.xml