def test_dm_instance(self): FakeDeviceConnect.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()
def test_dm_instance(self): FakeDeviceConnect.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()
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() FakeNetconfManager.set_model('qfx') pr.physical_router_vendor_name = "juniper" pr.physical_router_product_name = "qfx" self._vnc_lib.physical_router_update(pr) self.check_dm_plugin() # check invalid vendor, product; no plugin FakeDeviceConnect.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() 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() # 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() 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)
def tearDown(self): FakeDeviceConnect.reset() FakeJobHandler.reset() super(DMTestCase, self).tearDown()
def tearDown(self): FakeDeviceConnect.reset() super(DMTestCase, self).tearDown()
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() 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() 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() 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() 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() 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() 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() 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() 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() 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)