Support conversion to dynamips new directory layout on remote

Ref https://github.com/GNS3/gns3-gui/issues/1761
This commit is contained in:
Julien Duponchelle
2017-01-10 12:15:31 +01:00
parent a2fdc92fcb
commit 6150929a5b
2 changed files with 42 additions and 2 deletions

View File

@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import pytest
import asyncio
import configparser
@ -44,6 +45,21 @@ def test_router(project, manager):
assert router.id == "00010203-0405-0607-0809-0a0b0c0d0e0f"
def test_convert_project_before_2_0_0_b3(project, manager):
wdir = project.module_working_directory(manager.module_name.lower())
os.makedirs(os.path.join(wdir, "00010203-0405-0607-0809-0a0b0c0d0e0f"))
os.makedirs(os.path.join(wdir, "configs"))
open(os.path.join(wdir, "configs", "i1_startup-config.cfg"), "w+").close()
open(os.path.join(wdir, "configs", "i2_startup-config.cfg"), "w+").close()
open(os.path.join(wdir, "c7200_i1_nvram"), "w+").close()
open(os.path.join(wdir, "c7200_i2_nvram"), "w+").close()
router = Router("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, dynamips_id=1)
assert os.path.exists(os.path.join(wdir, "00010203-0405-0607-0809-0a0b0c0d0e0f", "configs", "i1_startup-config.cfg"))
assert not os.path.exists(os.path.join(wdir, "00010203-0405-0607-0809-0a0b0c0d0e0f", "configs", "i2_startup-config.cfg"))
assert os.path.exists(os.path.join(wdir, "00010203-0405-0607-0809-0a0b0c0d0e0f", "c7200_i1_nvram"))
assert not os.path.exists(os.path.join(wdir, "00010203-0405-0607-0809-0a0b0c0d0e0f", "c7200_i2_nvram"))
def test_router_invalid_dynamips_path(project, manager, loop):
config = Config.instance()