1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Add default values for exec area and system id settings

This commit is contained in:
grossmj 2014-02-06 11:22:58 -07:00
parent 78ad94f815
commit df798f4bea
9 changed files with 34 additions and 26 deletions

View File

@ -22,6 +22,7 @@ http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L77
from __future__ import unicode_literals
from ..dynamips_error import DynamipsError
import sys
import os
import logging
@ -68,15 +69,18 @@ class Router(object):
self._idlesleep = 30
self._ghost_file = ""
self._ghost_status = 0
self._exec_area = None # Megabytes (None = default for the router platform)
if sys.platform.startswith("win"):
self._exec_area = 16 # 16 MB by default on Windows (Cygwin)
else:
self._exec_area = 64 # 64 MB on other systems
self._jit_sharing_group = None
self._disk0 = 0 # Megabytes
self._disk1 = 0 # Megabytes
self._confreg = '0x2102'
self._confreg = "0x2102"
self._console = None
self._aux = None
self._mac_addr = None
self._system_id = None # processor board ID in IOS
self._system_id = "FTX0945W0MY" # processor board ID in IOS
self._slots = []
self._hypervisor.send("vm create {name} {id} {platform}".format(name=self._name,
@ -90,6 +94,7 @@ class Router(object):
self.console = self._hypervisor.baseconsole + self._id
self.aux = self._hypervisor.baseaux + self._id
# get the default base MAC address
self._mac_addr = self._hypervisor.send("{platform} get_mac_addr {name}".format(platform=self._platform,
name=self._name))[0]
else:

View File

@ -89,7 +89,7 @@ def test_iomem(router_c1700):
def test_mac_addr(router_c1700):
assert router_c1700.mac_addr == None # default value
assert router_c1700.mac_addr != None
router_c1700.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c1700.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -102,7 +102,7 @@ def test_bogus_mac_addr(router_c1700):
def test_system_id(router_c1700):
assert router_c1700.system_id == None # default value
assert router_c1700.system_id == "FTX0945W0MY" # default value
router_c1700.system_id = "FTX0945W0MO"
assert router_c1700.system_id == "FTX0945W0MO"

View File

@ -165,7 +165,7 @@ def test_iomem(router_c2600):
def test_mac_addr(router_c2600):
assert router_c2600.mac_addr == None # default value
assert router_c2600.mac_addr != None
router_c2600.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c2600.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -178,7 +178,7 @@ def test_bogus_mac_addr(router_c2600):
def test_system_id(router_c2600):
assert router_c2600.system_id == None # default value
assert router_c2600.system_id == "FTX0945W0MY" # default value
router_c2600.system_id = "FTX0945W0MO"
assert router_c2600.system_id == "FTX0945W0MO"

View File

@ -29,7 +29,7 @@ def test_iomem(router_c2691):
def test_mac_addr(router_c2691):
assert router_c2691.mac_addr == None # default value
assert router_c2691.mac_addr != None
router_c2691.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c2691.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -40,12 +40,11 @@ def test_bogus_mac_addr(router_c2691):
router_c2691.mac_addr = "zz:zz:zz:zz:zz:zz"
def test_system_id(hypervisor):
router = C2691(hypervisor, "test system id")
assert router.system_id == None # default value
router.system_id = "FTX0945W0MO"
assert router.system_id == "FTX0945W0MO"
router.delete()
def test_system_id(router_c2691):
assert router_c2691.system_id == "FTX0945W0MY" # default value
router_c2691.system_id = "FTX0945W0MO"
assert router_c2691.system_id == "FTX0945W0MO"
def test_get_hardware_info(router_c2691):

View File

@ -60,7 +60,7 @@ def test_iomem(router_c3600):
def test_mac_addr(router_c3600):
assert router_c3600.mac_addr == None # default value
assert router_c3600.mac_addr != None
router_c3600.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c3600.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -73,7 +73,7 @@ def test_bogus_mac_addr(router_c3600):
def test_system_id(router_c3600):
assert router_c3600.system_id == None # default value
assert router_c3600.system_id == "FTX0945W0MY" # default value
router_c3600.system_id = "FTX0945W0MO"
assert router_c3600.system_id == "FTX0945W0MO"

View File

@ -29,7 +29,7 @@ def test_iomem(router_c3725):
def test_mac_addr(router_c3725):
assert router_c3725.mac_addr == None # default value
assert router_c3725.mac_addr != None
router_c3725.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c3725.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -42,7 +42,7 @@ def test_bogus_mac_addr(router_c3725):
def test_system_id(router_c3725):
assert router_c3725.system_id == None # default value
assert router_c3725.system_id == "FTX0945W0MY" # default value
router_c3725.system_id = "FTX0945W0MO"
assert router_c3725.system_id == "FTX0945W0MO"

View File

@ -29,7 +29,7 @@ def test_iomem(router_c3745):
def test_mac_addr(router_c3745):
assert router_c3745.mac_addr == None # default value
assert router_c3745.mac_addr != None
router_c3745.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c3745.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -42,7 +42,7 @@ def test_bogus_mac_addr(router_c3745):
def test_system_id(router_c3745):
assert router_c3745.system_id == None # default value
assert router_c3745.system_id == "FTX0945W0MY" # default value
router_c3745.system_id = "FTX0945W0MO"
assert router_c3745.system_id == "FTX0945W0MO"

View File

@ -57,7 +57,7 @@ def test_power_supplies(router_c7200):
def test_mac_addr(router_c7200):
assert router_c7200.mac_addr == None # default value
assert router_c7200.mac_addr != None
router_c7200.mac_addr = "aa:aa:aa:aa:aa:aa"
assert router_c7200.mac_addr == "aa:aa:aa:aa:aa:aa"
@ -70,7 +70,7 @@ def test_bogus_mac_addr(router_c7200):
def test_system_id(router_c7200):
assert router_c7200.system_id == None # default value
assert router_c7200.system_id == "FTX0945W0MY" # default value
router_c7200.system_id = "FTX0945W0MO"
assert router_c7200.system_id == "FTX0945W0MO"

View File

@ -1,5 +1,6 @@
from gns3server.modules.dynamips import Router
from gns3server.modules.dynamips import DynamipsError
import sys
import pytest
import tempfile
import base64
@ -140,9 +141,12 @@ def test_idlesleep(router):
def test_exec_area(router):
assert router.exec_area == None # default value
router.exec_area = 64
assert router.exec_area == 64
if sys.platform.startswith("win"):
assert router.exec_area == 16 # default value
else:
assert router.exec_area == 64 # default value
router.exec_area = 48
assert router.exec_area == 48
def test_disk0(router):
@ -218,7 +222,7 @@ def test_bogus_mac_addr(router):
def test_system_id(router):
assert router.system_id == None # default value
assert router.system_id == "FTX0945W0MY" # default value
router.system_id = "FTX0945W0MO"
assert router.system_id == "FTX0945W0MO"