diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index 1edc2a39..47dd96a5 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -215,7 +215,7 @@ class Dynamips(BaseManager): rhost = nio_settings["rhost"] rport = nio_settings["rport"] try: - #TODO: handle IPv6 + # TODO: handle IPv6 with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock: sock.connect((rhost, rport)) except OSError as e: diff --git a/gns3server/modules/dynamips/adapters/adapter.py b/gns3server/modules/dynamips/adapters/adapter.py index d963933e..40d82c7e 100644 --- a/gns3server/modules/dynamips/adapters/adapter.py +++ b/gns3server/modules/dynamips/adapters/adapter.py @@ -17,6 +17,7 @@ class Adapter(object): + """ Base class for adapters. diff --git a/gns3server/modules/dynamips/adapters/c1700_mb_1fe.py b/gns3server/modules/dynamips/adapters/c1700_mb_1fe.py index 3c67f3df..c94f551d 100644 --- a/gns3server/modules/dynamips/adapters/c1700_mb_1fe.py +++ b/gns3server/modules/dynamips/adapters/c1700_mb_1fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C1700_MB_1FE(Adapter): + """ Integrated 1 port FastEthernet adapter for c1700 platform. """ diff --git a/gns3server/modules/dynamips/adapters/c1700_mb_wic1.py b/gns3server/modules/dynamips/adapters/c1700_mb_wic1.py index eca72358..9c6d2190 100644 --- a/gns3server/modules/dynamips/adapters/c1700_mb_wic1.py +++ b/gns3server/modules/dynamips/adapters/c1700_mb_wic1.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C1700_MB_WIC1(Adapter): + """ Fake module to provide a placeholder for slot 1 interfaces when WICs are inserted into WIC slot 1. diff --git a/gns3server/modules/dynamips/adapters/c2600_mb_1e.py b/gns3server/modules/dynamips/adapters/c2600_mb_1e.py index 26fe5497..bebe7fa9 100644 --- a/gns3server/modules/dynamips/adapters/c2600_mb_1e.py +++ b/gns3server/modules/dynamips/adapters/c2600_mb_1e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C2600_MB_1E(Adapter): + """ Integrated 1 port Ethernet adapter for the c2600 platform. """ diff --git a/gns3server/modules/dynamips/adapters/c2600_mb_1fe.py b/gns3server/modules/dynamips/adapters/c2600_mb_1fe.py index 768d9c95..1ad294f2 100644 --- a/gns3server/modules/dynamips/adapters/c2600_mb_1fe.py +++ b/gns3server/modules/dynamips/adapters/c2600_mb_1fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C2600_MB_1FE(Adapter): + """ Integrated 1 port FastEthernet adapter for the c2600 platform. """ diff --git a/gns3server/modules/dynamips/adapters/c2600_mb_2e.py b/gns3server/modules/dynamips/adapters/c2600_mb_2e.py index c2ca7442..1e42d5dd 100644 --- a/gns3server/modules/dynamips/adapters/c2600_mb_2e.py +++ b/gns3server/modules/dynamips/adapters/c2600_mb_2e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C2600_MB_2E(Adapter): + """ Integrated 2 port Ethernet adapter for the c2600 platform. """ diff --git a/gns3server/modules/dynamips/adapters/c2600_mb_2fe.py b/gns3server/modules/dynamips/adapters/c2600_mb_2fe.py index a7e6df14..dcd96581 100644 --- a/gns3server/modules/dynamips/adapters/c2600_mb_2fe.py +++ b/gns3server/modules/dynamips/adapters/c2600_mb_2fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C2600_MB_2FE(Adapter): + """ Integrated 2 port FastEthernet adapter for the c2600 platform. """ diff --git a/gns3server/modules/dynamips/adapters/c7200_io_2fe.py b/gns3server/modules/dynamips/adapters/c7200_io_2fe.py index 0b8ae8a4..8b545e99 100644 --- a/gns3server/modules/dynamips/adapters/c7200_io_2fe.py +++ b/gns3server/modules/dynamips/adapters/c7200_io_2fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C7200_IO_2FE(Adapter): + """ C7200-IO-2FE FastEthernet Input/Ouput controller. """ diff --git a/gns3server/modules/dynamips/adapters/c7200_io_fe.py b/gns3server/modules/dynamips/adapters/c7200_io_fe.py index 56e86cf1..784b154d 100644 --- a/gns3server/modules/dynamips/adapters/c7200_io_fe.py +++ b/gns3server/modules/dynamips/adapters/c7200_io_fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C7200_IO_FE(Adapter): + """ C7200-IO-FE FastEthernet Input/Ouput controller. """ diff --git a/gns3server/modules/dynamips/adapters/c7200_io_ge_e.py b/gns3server/modules/dynamips/adapters/c7200_io_ge_e.py index 12ebaed6..f233dffd 100644 --- a/gns3server/modules/dynamips/adapters/c7200_io_ge_e.py +++ b/gns3server/modules/dynamips/adapters/c7200_io_ge_e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class C7200_IO_GE_E(Adapter): + """ C7200-IO-GE-E GigabitEthernet Input/Ouput controller. """ diff --git a/gns3server/modules/dynamips/adapters/leopard_2fe.py b/gns3server/modules/dynamips/adapters/leopard_2fe.py index 0afa95c0..db6ad9c2 100644 --- a/gns3server/modules/dynamips/adapters/leopard_2fe.py +++ b/gns3server/modules/dynamips/adapters/leopard_2fe.py @@ -19,6 +19,7 @@ from .adapter import Adapter class Leopard_2FE(Adapter): + """ Integrated 2 port FastEthernet adapter for c3660 router. """ diff --git a/gns3server/modules/dynamips/adapters/nm_16esw.py b/gns3server/modules/dynamips/adapters/nm_16esw.py index fc3755cd..31e74565 100644 --- a/gns3server/modules/dynamips/adapters/nm_16esw.py +++ b/gns3server/modules/dynamips/adapters/nm_16esw.py @@ -19,6 +19,7 @@ from .adapter import Adapter class NM_16ESW(Adapter): + """ NM-16ESW FastEthernet network module. """ diff --git a/gns3server/modules/dynamips/adapters/nm_1e.py b/gns3server/modules/dynamips/adapters/nm_1e.py index ac200247..59ac5569 100644 --- a/gns3server/modules/dynamips/adapters/nm_1e.py +++ b/gns3server/modules/dynamips/adapters/nm_1e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class NM_1E(Adapter): + """ NM-1E Ethernet network module. """ diff --git a/gns3server/modules/dynamips/adapters/nm_1fe_tx.py b/gns3server/modules/dynamips/adapters/nm_1fe_tx.py index 9723f703..26568306 100644 --- a/gns3server/modules/dynamips/adapters/nm_1fe_tx.py +++ b/gns3server/modules/dynamips/adapters/nm_1fe_tx.py @@ -19,6 +19,7 @@ from .adapter import Adapter class NM_1FE_TX(Adapter): + """ NM-1FE-TX FastEthernet network module. """ diff --git a/gns3server/modules/dynamips/adapters/nm_4e.py b/gns3server/modules/dynamips/adapters/nm_4e.py index ae6a51ed..086b04ee 100644 --- a/gns3server/modules/dynamips/adapters/nm_4e.py +++ b/gns3server/modules/dynamips/adapters/nm_4e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class NM_4E(Adapter): + """ NM-4E Ethernet network module. """ diff --git a/gns3server/modules/dynamips/adapters/nm_4t.py b/gns3server/modules/dynamips/adapters/nm_4t.py index df6db299..77c3ecc8 100644 --- a/gns3server/modules/dynamips/adapters/nm_4t.py +++ b/gns3server/modules/dynamips/adapters/nm_4t.py @@ -19,6 +19,7 @@ from .adapter import Adapter class NM_4T(Adapter): + """ NM-4T Serial network module. """ diff --git a/gns3server/modules/dynamips/adapters/pa_2fe_tx.py b/gns3server/modules/dynamips/adapters/pa_2fe_tx.py index 8589ff2e..09b677f3 100644 --- a/gns3server/modules/dynamips/adapters/pa_2fe_tx.py +++ b/gns3server/modules/dynamips/adapters/pa_2fe_tx.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_2FE_TX(Adapter): + """ PA-2FE-TX FastEthernet port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_4e.py b/gns3server/modules/dynamips/adapters/pa_4e.py index 32564992..d5981860 100644 --- a/gns3server/modules/dynamips/adapters/pa_4e.py +++ b/gns3server/modules/dynamips/adapters/pa_4e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_4E(Adapter): + """ PA-4E Ethernet port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_4t.py b/gns3server/modules/dynamips/adapters/pa_4t.py index 6a098a24..5a1393bc 100644 --- a/gns3server/modules/dynamips/adapters/pa_4t.py +++ b/gns3server/modules/dynamips/adapters/pa_4t.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_4T(Adapter): + """ PA-4T+ Serial port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_8e.py b/gns3server/modules/dynamips/adapters/pa_8e.py index a6b5075f..96684055 100644 --- a/gns3server/modules/dynamips/adapters/pa_8e.py +++ b/gns3server/modules/dynamips/adapters/pa_8e.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_8E(Adapter): + """ PA-8E Ethernet port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_8t.py b/gns3server/modules/dynamips/adapters/pa_8t.py index 600a5c29..723e026f 100644 --- a/gns3server/modules/dynamips/adapters/pa_8t.py +++ b/gns3server/modules/dynamips/adapters/pa_8t.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_8T(Adapter): + """ PA-8T Serial port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_a1.py b/gns3server/modules/dynamips/adapters/pa_a1.py index 21d51f15..469d9ce4 100644 --- a/gns3server/modules/dynamips/adapters/pa_a1.py +++ b/gns3server/modules/dynamips/adapters/pa_a1.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_A1(Adapter): + """ PA-A1 ATM port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_fe_tx.py b/gns3server/modules/dynamips/adapters/pa_fe_tx.py index 70ce8489..6434d2b4 100644 --- a/gns3server/modules/dynamips/adapters/pa_fe_tx.py +++ b/gns3server/modules/dynamips/adapters/pa_fe_tx.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_FE_TX(Adapter): + """ PA-FE-TX FastEthernet port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_ge.py b/gns3server/modules/dynamips/adapters/pa_ge.py index f0287408..e466d905 100644 --- a/gns3server/modules/dynamips/adapters/pa_ge.py +++ b/gns3server/modules/dynamips/adapters/pa_ge.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_GE(Adapter): + """ PA-GE GigabitEthernet port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/pa_pos_oc3.py b/gns3server/modules/dynamips/adapters/pa_pos_oc3.py index b120de97..de0bc5d1 100644 --- a/gns3server/modules/dynamips/adapters/pa_pos_oc3.py +++ b/gns3server/modules/dynamips/adapters/pa_pos_oc3.py @@ -19,6 +19,7 @@ from .adapter import Adapter class PA_POS_OC3(Adapter): + """ PA-POS-OC3 port adapter. """ diff --git a/gns3server/modules/dynamips/adapters/wic_1enet.py b/gns3server/modules/dynamips/adapters/wic_1enet.py index dac79b6b..2d5e62b7 100644 --- a/gns3server/modules/dynamips/adapters/wic_1enet.py +++ b/gns3server/modules/dynamips/adapters/wic_1enet.py @@ -17,6 +17,7 @@ class WIC_1ENET(object): + """ WIC-1ENET Ethernet """ diff --git a/gns3server/modules/dynamips/adapters/wic_1t.py b/gns3server/modules/dynamips/adapters/wic_1t.py index 0f7cb3ad..2067246d 100644 --- a/gns3server/modules/dynamips/adapters/wic_1t.py +++ b/gns3server/modules/dynamips/adapters/wic_1t.py @@ -17,6 +17,7 @@ class WIC_1T(object): + """ WIC-1T Serial """ diff --git a/gns3server/modules/dynamips/adapters/wic_2t.py b/gns3server/modules/dynamips/adapters/wic_2t.py index 2bf2d565..b5af954e 100644 --- a/gns3server/modules/dynamips/adapters/wic_2t.py +++ b/gns3server/modules/dynamips/adapters/wic_2t.py @@ -17,6 +17,7 @@ class WIC_2T(object): + """ WIC-2T Serial """ diff --git a/gns3server/modules/dynamips/dynamips_hypervisor.py b/gns3server/modules/dynamips/dynamips_hypervisor.py index 01a92248..071019f5 100644 --- a/gns3server/modules/dynamips/dynamips_hypervisor.py +++ b/gns3server/modules/dynamips/dynamips_hypervisor.py @@ -32,6 +32,7 @@ log = logging.getLogger(__name__) class DynamipsHypervisor: + """ Creates a new connection to a Dynamips server (also called hypervisor) diff --git a/gns3server/modules/dynamips/dynamips_vm.py b/gns3server/modules/dynamips/dynamips_vm.py index b73b1dbf..bcdd5636 100644 --- a/gns3server/modules/dynamips/dynamips_vm.py +++ b/gns3server/modules/dynamips/dynamips_vm.py @@ -38,6 +38,7 @@ PLATFORMS = {'c1700': C1700, class DynamipsVM: + """ Factory to create an Router object based on the correct platform. """ diff --git a/gns3server/modules/dynamips/hypervisor.py b/gns3server/modules/dynamips/hypervisor.py index 57afb37a..778c490b 100644 --- a/gns3server/modules/dynamips/hypervisor.py +++ b/gns3server/modules/dynamips/hypervisor.py @@ -32,6 +32,7 @@ log = logging.getLogger(__name__) class Hypervisor(DynamipsHypervisor): + """ Hypervisor. diff --git a/gns3server/modules/dynamips/nios/nio.py b/gns3server/modules/dynamips/nios/nio.py index 256ddc1b..f829e4ed 100644 --- a/gns3server/modules/dynamips/nios/nio.py +++ b/gns3server/modules/dynamips/nios/nio.py @@ -28,6 +28,7 @@ log = logging.getLogger(__name__) class NIO: + """ Base NIO class diff --git a/gns3server/modules/dynamips/nios/nio_fifo.py b/gns3server/modules/dynamips/nios/nio_fifo.py index 60c9aa3f..55b91b8d 100644 --- a/gns3server/modules/dynamips/nios/nio_fifo.py +++ b/gns3server/modules/dynamips/nios/nio_fifo.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOFIFO(NIO): + """ Dynamips FIFO NIO. diff --git a/gns3server/modules/dynamips/nios/nio_generic_ethernet.py b/gns3server/modules/dynamips/nios/nio_generic_ethernet.py index fc0ab006..af631654 100644 --- a/gns3server/modules/dynamips/nios/nio_generic_ethernet.py +++ b/gns3server/modules/dynamips/nios/nio_generic_ethernet.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOGenericEthernet(NIO): + """ Dynamips generic Ethernet NIO. @@ -46,8 +47,6 @@ class NIOGenericEthernet(NIO): self._name = 'nio_gen_eth' + str(self._id) self._ethernet_device = ethernet_device - - @classmethod def reset(cls): """ diff --git a/gns3server/modules/dynamips/nios/nio_linux_ethernet.py b/gns3server/modules/dynamips/nios/nio_linux_ethernet.py index 513bc12a..1d3b280f 100644 --- a/gns3server/modules/dynamips/nios/nio_linux_ethernet.py +++ b/gns3server/modules/dynamips/nios/nio_linux_ethernet.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOLinuxEthernet(NIO): + """ Dynamips Linux Ethernet NIO. diff --git a/gns3server/modules/dynamips/nios/nio_mcast.py b/gns3server/modules/dynamips/nios/nio_mcast.py index cf03aaab..ed6ea896 100644 --- a/gns3server/modules/dynamips/nios/nio_mcast.py +++ b/gns3server/modules/dynamips/nios/nio_mcast.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOMcast(NIO): + """ Dynamips Linux Ethernet NIO. diff --git a/gns3server/modules/dynamips/nios/nio_null.py b/gns3server/modules/dynamips/nios/nio_null.py index df666fb8..b2c0e65f 100644 --- a/gns3server/modules/dynamips/nios/nio_null.py +++ b/gns3server/modules/dynamips/nios/nio_null.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIONull(NIO): + """ Dynamips NULL NIO. diff --git a/gns3server/modules/dynamips/nios/nio_tap.py b/gns3server/modules/dynamips/nios/nio_tap.py index 926e9b0b..e077161e 100644 --- a/gns3server/modules/dynamips/nios/nio_tap.py +++ b/gns3server/modules/dynamips/nios/nio_tap.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOTAP(NIO): + """ Dynamips TAP NIO. diff --git a/gns3server/modules/dynamips/nios/nio_udp.py b/gns3server/modules/dynamips/nios/nio_udp.py index 999fdf9a..f1b0ca18 100644 --- a/gns3server/modules/dynamips/nios/nio_udp.py +++ b/gns3server/modules/dynamips/nios/nio_udp.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOUDP(NIO): + """ Dynamips UDP NIO. diff --git a/gns3server/modules/dynamips/nios/nio_udp_auto.py b/gns3server/modules/dynamips/nios/nio_udp_auto.py index 1caaaea0..40eb6768 100644 --- a/gns3server/modules/dynamips/nios/nio_udp_auto.py +++ b/gns3server/modules/dynamips/nios/nio_udp_auto.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOUDPAuto(NIO): + """ Dynamips auto UDP NIO. diff --git a/gns3server/modules/dynamips/nios/nio_unix.py b/gns3server/modules/dynamips/nios/nio_unix.py index 234fd65b..d37c83ad 100644 --- a/gns3server/modules/dynamips/nios/nio_unix.py +++ b/gns3server/modules/dynamips/nios/nio_unix.py @@ -27,6 +27,7 @@ log = logging.getLogger(__name__) class NIOUNIX(NIO): + """ Dynamips UNIX NIO. diff --git a/gns3server/modules/dynamips/nios/nio_vde.py b/gns3server/modules/dynamips/nios/nio_vde.py index 6b00cf2f..04b9fc07 100644 --- a/gns3server/modules/dynamips/nios/nio_vde.py +++ b/gns3server/modules/dynamips/nios/nio_vde.py @@ -26,6 +26,7 @@ log = logging.getLogger(__name__) class NIOVDE(NIO): + """ Dynamips VDE NIO. diff --git a/gns3server/modules/dynamips/nodes/c1700.py b/gns3server/modules/dynamips/nodes/c1700.py index faee65cd..9ff6e51b 100644 --- a/gns3server/modules/dynamips/nodes/c1700.py +++ b/gns3server/modules/dynamips/nodes/c1700.py @@ -30,6 +30,7 @@ log = logging.getLogger(__name__) class C1700(Router): + """ Dynamips c1700 router. diff --git a/gns3server/modules/dynamips/nodes/c2600.py b/gns3server/modules/dynamips/nodes/c2600.py index e3972253..497a5d56 100644 --- a/gns3server/modules/dynamips/nodes/c2600.py +++ b/gns3server/modules/dynamips/nodes/c2600.py @@ -32,6 +32,7 @@ log = logging.getLogger(__name__) class C2600(Router): + """ Dynamips c2600 router. diff --git a/gns3server/modules/dynamips/nodes/c2691.py b/gns3server/modules/dynamips/nodes/c2691.py index 273b33de..d40efd2c 100644 --- a/gns3server/modules/dynamips/nodes/c2691.py +++ b/gns3server/modules/dynamips/nodes/c2691.py @@ -29,6 +29,7 @@ log = logging.getLogger(__name__) class C2691(Router): + """ Dynamips c2691 router. diff --git a/gns3server/modules/dynamips/nodes/c3600.py b/gns3server/modules/dynamips/nodes/c3600.py index fe11b48d..415d9a74 100644 --- a/gns3server/modules/dynamips/nodes/c3600.py +++ b/gns3server/modules/dynamips/nodes/c3600.py @@ -29,6 +29,7 @@ log = logging.getLogger(__name__) class C3600(Router): + """ Dynamips c3600 router. diff --git a/gns3server/modules/dynamips/nodes/c3725.py b/gns3server/modules/dynamips/nodes/c3725.py index 6cb4213c..0d0ce36d 100644 --- a/gns3server/modules/dynamips/nodes/c3725.py +++ b/gns3server/modules/dynamips/nodes/c3725.py @@ -29,6 +29,7 @@ log = logging.getLogger(__name__) class C3725(Router): + """ Dynamips c3725 router. diff --git a/gns3server/modules/dynamips/nodes/c3745.py b/gns3server/modules/dynamips/nodes/c3745.py index 28acfe99..d94b9883 100644 --- a/gns3server/modules/dynamips/nodes/c3745.py +++ b/gns3server/modules/dynamips/nodes/c3745.py @@ -29,6 +29,7 @@ log = logging.getLogger(__name__) class C3745(Router): + """ Dynamips c3745 router. diff --git a/gns3server/modules/dynamips/nodes/c7200.py b/gns3server/modules/dynamips/nodes/c7200.py index 4d69e825..ca70ecb7 100644 --- a/gns3server/modules/dynamips/nodes/c7200.py +++ b/gns3server/modules/dynamips/nodes/c7200.py @@ -32,6 +32,7 @@ log = logging.getLogger(__name__) class C7200(Router): + """ Dynamips c7200 router (model is 7206). diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index e8c05618..bfff9d27 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -145,14 +145,14 @@ class Router(BaseVM): "system_id": self._system_id} # FIXME: add default slots/wics - #slot_id = 0 - #for slot in self._slots: + # slot_id = 0 + # for slot in self._slots: # if slot: # slot = str(slot) # router_defaults["slot" + str(slot_id)] = slot # slot_id += 1 - #if self._slots[0] and self._slots[0].wics: + # if self._slots[0] and self._slots[0].wics: # for wic_slot_id in range(0, len(self._slots[0].wics)): # router_defaults["wic" + str(wic_slot_id)] = None @@ -1014,8 +1014,8 @@ class Router(BaseVM): # Only c7200, c3600 and c3745 (NM-4T only) support new adapter while running if is_running and not ((self._platform == 'c7200' and not str(adapter).startswith('C7200')) - and not (self._platform == 'c3600' and self.chassis == '3660') - and not (self._platform == 'c3745' and adapter == 'NM-4T')): + and not (self._platform == 'c3600' and self.chassis == '3660') + and not (self._platform == 'c3745' and adapter == 'NM-4T')): raise DynamipsError('Adapter {adapter} cannot be added while router "{name}" is running'.format(adapter=adapter, name=self._name)) @@ -1060,8 +1060,8 @@ class Router(BaseVM): # Only c7200, c3600 and c3745 (NM-4T only) support to remove adapter while running if is_running and not ((self._platform == 'c7200' and not str(adapter).startswith('C7200')) - and not (self._platform == 'c3600' and self.chassis == '3660') - and not (self._platform == 'c3745' and adapter == 'NM-4T')): + and not (self._platform == 'c3600' and self.chassis == '3660') + and not (self._platform == 'c3745' and adapter == 'NM-4T')): raise DynamipsError('Adapter {adapter} cannot be removed while router "{name}" is running'.format(adapter=adapter, name=self._name)) @@ -1181,7 +1181,7 @@ class Router(BaseVM): adapter = self._slots[slot_id] except IndexError: raise DynamipsError('Slot {slot_id} does not exist on router "{name}"'.format(name=self._name, - slot_id=slot_id)) + slot_id=slot_id)) if not adapter.port_exists(port_id): raise DynamipsError("Port {port_id} does not exist in adapter {adapter}".format(adapter=adapter, port_id=port_id)) @@ -1246,13 +1246,14 @@ class Router(BaseVM): is_running = yield from self.is_running() if is_running: # running router yield from self._hypervisor.send('vm slot_enable_nio "{name}" {slot_id} {port_id}'.format(name=self._name, - slot_id=slot_id, - port_id=port_id)) + slot_id=slot_id, + port_id=port_id)) log.info('Router "{name}" [{id}]: NIO enabled on port {slot_id}/{port_id}'.format(name=self._name, id=self._id, slot_id=slot_id, port_id=port_id)) + @asyncio.coroutine def slot_disable_nio(self, slot_id, port_id): """ @@ -1301,11 +1302,10 @@ class Router(BaseVM): raise DynamipsError("Port {port_id} has already a filter applied on {adapter}".format(adapter=adapter, port_id=port_id)) - # FIXME: capture - #try: + # try: # os.makedirs(os.path.dirname(output_file), exist_ok=True) - #except OSError as e: + # except OSError as e: # raise DynamipsError("Could not create captures directory {}".format(e)) yield from nio.bind_filter("both", "capture") @@ -1316,6 +1316,7 @@ class Router(BaseVM): nio_name=nio.name, slot_id=slot_id, port_id=port_id)) + @asyncio.coroutine def stop_capture(self, slot_id, port_id): """ diff --git a/tests/modules/dynamips/test_dynamips_router.py b/tests/modules/dynamips/test_dynamips_router.py index c7fbb236..174fe7aa 100644 --- a/tests/modules/dynamips/test_dynamips_router.py +++ b/tests/modules/dynamips/test_dynamips_router.py @@ -44,7 +44,7 @@ def test_router(project, manager): def test_router_invalid_dynamips_path(project, manager, loop): with patch("gns3server.config.Config.get_section_config", return_value={"dynamips_path": "/bin/test_fake"}): - with pytest.raises(DynamipsError): + with pytest.raises(DynamipsError): router = Router("test", "00010203-0405-0607-0809-0a0b0c0d0e0e", project, manager) loop.run_until_complete(asyncio.async(router.create())) assert router.name == "test" diff --git a/tox.ini b/tox.ini index 53eaab0b..155cefab 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ commands = python setup.py test deps = -rdev-requirements.txt [pep8] -ignore = E501 +ignore = E501,E402 [pytest] norecursedirs = old_tests .tox