Option to reset or not all MAC addresses when exporting or duplicating a project.

This commit is contained in:
grossmj committed 2020-05-27 12:14:47 +09:30
1 parent 5575657318
commit 8eefaa3f32
3 files changed
+24 -6

No files matched your search

+3 -2
View File
@@ -999,7 +999,7 @@ class Project:
while self._loading:
await asyncio.sleep(0.5)
async def duplicate(self, name=None, location=None):
async def duplicate(self, name=None, location=None, reset_mac_addresses=True):
"""
Duplicate a project
@@ -1009,6 +1009,7 @@ class Project:
:param name: Name of the new project. A new one will be generated in case of conflicts
:param location: Parent directory of the new project
:param reset_mac_addresses: Reset MAC addresses for the new project
"""
# If the project was not open we open it temporary
previous_status = self._status
@@ -1022,7 +1023,7 @@ class Project:
with tempfile.TemporaryDirectory() as tmpdir:
# Do not compress the exported project when duplicating
with aiozipstream.ZipFile(compression=zipfile.ZIP_STORED) as zstream:
await export_project(zstream, self, tmpdir, keep_compute_id=True, allow_all_nodes=True, reset_mac_addresses=True)
await export_project(zstream, self, tmpdir, keep_compute_id=True, allow_all_nodes=True, reset_mac_addresses=reset_mac_addresses)
# export the project to a temporary location
project_path = os.path.join(tmpdir, "project.gns3p")