Require Dynamips version 0.2.16 to change the default QinQ Ethernet type.

This commit is contained in:
grossmj 2015-09-08 03:03:11 -06:00
parent 6dd381a745
commit 8031cf1030

View File

@ -21,12 +21,12 @@ http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L558
""" """
import asyncio import asyncio
from pkg_resources import parse_version
from .device import Device from .device import Device
from ..nios.nio_udp import NIOUDP from ..nios.nio_udp import NIOUDP
from ..dynamips_error import DynamipsError from ..dynamips_error import DynamipsError
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -255,6 +255,9 @@ class EthernetSwitch(Device):
raise DynamipsError("Port {} is not allocated".format(port_number)) raise DynamipsError("Port {} is not allocated".format(port_number))
nio = self._nios[port_number] nio = self._nios[port_number]
if ethertype != "0x8100" and parse_version(self.hypervisor.version) < parse_version('0.2.16'):
raise DynamipsError("Dynamips version required is >= 0.2.16 to change the default QinQ Ethernet type, detected version is {}".format(self.hypervisor.version))
yield from self._hypervisor.send('ethsw set_qinq_port "{name}" {nio} {outer_vlan} {ethertype}'.format(name=self._name, yield from self._hypervisor.send('ethsw set_qinq_port "{name}" {nio} {outer_vlan} {ethertype}'.format(name=self._name,
nio=nio, nio=nio,
outer_vlan=outer_vlan, outer_vlan=outer_vlan,