Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Raise an error if the user try to import ASA 8 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gns3converter/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from gns3converter.interfaces import INTERFACE_RE, NUMBER_RE, MAPINT_RE, \
VBQ_INT_RE, Interfaces
from gns3converter.utils import fix_path
from gns3converter.converterror import ConvertError


class Node(Interfaces):
Expand Down Expand Up @@ -213,6 +214,10 @@ def add_to_qemu(self):
global conf section
"""
device = self.device_info['ext_conf']

if device == "5520":
raise ConvertError("ASA 8 is not supported by GNS3 1.4. You should switch to ASAv. This topology can not be converted.")

node_prop = self.node['properties']
hv_device = self.hypervisor[device]
# QEMU HDD Images
Expand Down
27 changes: 23 additions & 4 deletions tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from gns3converter.node import Node

from gns3converter.converterror import ConvertError

class TestNode(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -391,10 +391,29 @@ def test_add_vm_ethernet_ports(self):
self.assertListEqual(self.app.node['ports'], exp_res)
self.assertEqual(self.app.port_id, 3)

@unittest.skip
def test_add_to_qemu(self):
# TODO
self.fail()
self.app.node['qemu_id'] = 1
self.app.device_info['ext_conf'] = 'QemuDevice'
self.app.hypervisor['QemuDevice'] = {}
self.app.hypervisor['qemu_path'] = '/bin/qemu'

self.app.add_to_qemu()

self.assertEqual(self.app.node['properties']['adapters'], 6)
self.assertEqual(self.app.node['properties']['console'], 5001)
self.assertEqual(self.app.node['properties']['qemu_path'], '/bin/qemu')
self.assertEqual(self.app.node['properties']['ram'], 256)

def test_add_to_qemu_asa(self):
self.app.node['qemu_id'] = 1
self.app.device_info['ext_conf'] = '5520'
self.app.hypervisor['QemuDevice'] = {}
self.app.hypervisor['qemu_path'] = '/bin/qemu'

try:
self.app.add_to_qemu()
except ConvertError:
self.assertRaises(ConvertError)

def test_add_to_virtualbox(self):
self.app.node['vbox_id'] = 1
Expand Down