def test_dm_instance(self):
     FakeDeviceConnect.reset()
     FakeJobHandler.reset()
     kill_device_manager(TestInfraDM._dm_greenlet)
     self.check_dm_instance()
     TestInfraDM._dm_greenlet = gevent.spawn(launch_device_manager,
         self._cluster_id, TestInfraDM._api_server_ip, TestInfraDM._api_server_port)
     wait_for_device_manager_up()
Пример #2
0
 def test_dm_instance(self):
     FakeDeviceConnect.reset()
     FakeJobHandler.reset()
     kill_device_manager(TestInfraDM._dm_greenlet)
     self.check_dm_instance()
     TestInfraDM._dm_greenlet = gevent.spawn(launch_device_manager,
         self._cluster_id, TestInfraDM._api_server_ip, TestInfraDM._api_server_port)
     wait_for_device_manager_up()
Пример #3
0
 def tearDown(self):
     FakeDeviceConnect.reset()
     FakeJobHandler.reset()
     super(DMTestCase, self).tearDown()
 def tearDown(self):
     FakeDeviceConnect.reset()
     FakeJobHandler.reset()
     super(DMTestCase, self).tearDown()
Пример #5
0
 def check_dm_ansible_config_push(self):
     job_template = FakeJobHandler.get_job_template()
     job_input = FakeJobHandler.get_job_input()
     self.assertIsNotNone(job_input)
     self._logger.debug("Job Template: %s", job_template)
     self._logger.debug("Job Input: %s", job_input)
    def test_dm_plugins(self):
        # check basic valid vendor, product plugin
        bgp_router, pr = self.create_router('router100' + self.id(),
                                            '1.1.1.1',
                                            product=self.product)
        self.check_dm_plugin()
        pr_config = FakeDeviceConnect.params.get("pr_config")

        # update valid another vendor, product; another plugin should be found
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5110')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5110"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5100')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5100"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5200')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5200"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5300')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5300"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin(is_valid=False)

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx10000')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx10000"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # check invalid vendor, product; no plugin
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('cix')
        pr.physical_router_vendor_name = "cix"
        pr.physical_router_product_name = "cix100"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin(is_valid=False)

        # update valid vendor, product; plugin should be found, config should be pushed
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('mx80')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "mx"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('mx480')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "mx480"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # product/vendor names can be case in-sensitive
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('MX480')
        pr.physical_router_vendor_name = "JunIper"
        pr.physical_router_product_name = "mX480"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # device connection is down, config should not be pushed
        pr_config = FakeDeviceConnect.params.get("pr_config")
        pr_config._nc_manager.connected = False
        self.assertFalse(pr_config.is_connected())
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        self.set_hold_time(bgp_router, 100)
        self._vnc_lib.bgp_router_update(bgp_router)
        self.check_dm_plugin(False)
        # device connection is up, config should be auto pushed
        pr_config._nc_manager.connected = True
        self.check_dm_plugin()

        # unset vnc-managed, should generate delete groups config
        pr.physical_router_vnc_managed = False
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_delete_groups()

        # set vnc-managed, should generate groups config again
        pr.physical_router_vnc_managed = True
        self._vnc_lib.physical_router_update(pr)
        self.check_if_xml_is_generated()

        bgp_router_fq = bgp_router.get_fq_name()
        pr_fq = pr.get_fq_name()
        self.delete_routers(bgp_router, pr)
        self.wait_for_routers_delete(bgp_router_fq, pr_fq)
Пример #7
0
 def check_dm_ansible_config_push(self):
     job_input = FakeJobHandler.get_job_input()
     self.assertIsNotNone(job_input)
     DeviceManager.get_instance().logger.debug(
         "Job Input: %s" % json.dumps(job_input, indent=4))
     return job_input
 def check_dm_ansible_config_push(self):
     job_input = FakeJobHandler.get_job_input()
     self.assertIsNotNone(job_input)
     DeviceManager.get_instance().logger.debug("Job Input: %s" % json.dumps(job_input, indent=4))
Пример #9
0
    def test_dm_plugins(self):
        # check basic valid vendor, product plugin
        bgp_router, pr = self.create_router('router100' + self.id(), '1.1.1.1',
                                                            product=self.product)
        self.check_dm_plugin()
        pr_config = FakeDeviceConnect.params.get("pr_config")

        # update valid another vendor, product; another plugin should be found
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5110')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5110"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5100')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5100"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5200')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5200"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx5300')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx5300"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin(is_valid=False)

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('qfx10000')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "qfx10000"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # check invalid vendor, product; no plugin
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('cix')
        pr.physical_router_vendor_name = "cix"
        pr.physical_router_product_name = "cix100"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin(is_valid=False)

        # update valid vendor, product; plugin should be found, config should be pushed
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('mx80')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "mx"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('mx480')
        pr.physical_router_vendor_name = "juniper"
        pr.physical_router_product_name = "mx480"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # product/vendor names can be case in-sensitive
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        FakeNetconfManager.set_model('MX480')
        pr.physical_router_vendor_name = "JunIper"
        pr.physical_router_product_name = "mX480"
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_plugin()

        # device connection is down, config should not be pushed
        pr_config = FakeDeviceConnect.params.get("pr_config")
        pr_config._nc_manager.connected = False
        self.assertFalse(pr_config.is_connected())
        FakeDeviceConnect.reset()
        FakeJobHandler.reset()
        self.set_hold_time(bgp_router, 100)
        self._vnc_lib.bgp_router_update(bgp_router)
        self.check_dm_plugin(False)
        # device connection is up, config should be auto pushed
        pr_config._nc_manager.connected = True
        self.check_dm_plugin()

        # unset vnc-managed, should generate delete groups config
        pr.physical_router_vnc_managed = False
        self._vnc_lib.physical_router_update(pr)
        self.check_dm_delete_groups()

        # set vnc-managed, should generate groups config again
        pr.physical_router_vnc_managed = True
        self._vnc_lib.physical_router_update(pr)
        self.check_if_xml_is_generated()

        bgp_router_fq = bgp_router.get_fq_name()
        pr_fq = pr.get_fq_name()
        self.delete_routers(bgp_router, pr)
        self.wait_for_routers_delete(bgp_router_fq, pr_fq)