def test_flash_firmware(self): print("Test Router_Flash_Firmware") router = self._create_router() print("Download/Import firmware-image from UpdateServer/PI ...") # Download firmare-image from UpdateServer sysupdate = Sysupdate(router) sysupdate.start() sysupdate.join() # NVAssisten nv_assist = NVAssistent("eth0") nv_assist.create_namespace_vlan(router) # Set netns for the current process netns.setns(router.namespace_name) # The IP where the Router can download the firmware image (should be the frameworks IP) web_server_ip = nv_assist.get_ip_address(router.namespace_name, router.vlan_iface_name)[0] try: # Copy firmware-image to the Router (/tmp/image) print("Copy firmware-image to Router ...") sysupgrade = Sysupgrade(router, n=True, web_server_ip=web_server_ip, debug=True) sysupgrade.start() sysupgrade.join() except Exception: raise finally: nv_assist.close()
def sysupdate_firmware(cls, router_ids: Union[List[int], None], update_all: bool) -> None: """ Downloads and copies the firmware to the :py:class:`Router` given in the List(by a unique id) resp. to all Routers. :param router_ids: List of unique numbers to identify a :py:class:`Router` :param update_all: Is True if all Routers should be updated """ if update_all: for router in cls.get_routers(): sysupdate = Sysupdate(router) sysupdate.start() sysupdate.join() else: for router_id in router_ids: router = cls.get_router_by_id(router_id) sysupdate = Sysupdate(router) sysupdate.start() sysupdate.join()
def sysupdate_firmware(cls, router_ids: Union[List[int], None], update_all: bool) -> None: """ Downloads and copies the firmware to the :py:class:`Router` given in the List(by a unique id) resp. to all Routers :param router_ids: List of unique numbers to identify a :py:class:`Router` :param update_all: Is True if all Routers should be updated """ if update_all: for router in cls.get_routers(): sysupdate = Sysupdate(router) sysupdate.start() sysupdate.join() else: for router_id in router_ids: router = cls.get_router_by_id(router_id) sysupdate = Sysupdate(router) sysupdate.start() sysupdate.join()