Ejemplo n.º 1
0
	def test_A_create_network_component(self):

		u"""
		Create and search new network component module
		"""

		logging.basicConfig(filename="Network_components.log", level=logging.INFO, filemode='w')	
	
		driver = self.driver
		self.login()
		detect_and_pass_all_wizards(driver)
		
		agent_name = gen_random_string(6)
		network_component_name = gen_random_string(6)

		activate_api(driver,"1234")

		params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"]
		create_agent_api(driver,params,user="******",pwd="pandora")

		lista = driver.current_url.split('/')

		url = lista[0]+'//'+lista[2]+'/pandora_console'

		driver.get(url)
			
		create_network_component(driver,network_component_name,"Remote TCP network agent, boolean data","Network Management","Application",min_warning=10,max_critical=100,description="New network component by test")

		search_agent(driver,agent_name,go_to_agent=True)

		driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click()
		driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()

		Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new network server module")

		driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click()

		driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click()

		Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management")

		time.sleep(3)
			
		Select(driver.find_element_by_id("network_component")).select_by_visible_text(network_component_name)

		driver.find_element_by_id("submit-crtbutton").click()

		search_module (driver,agent_name,network_component_name,go_to_module=False)

		self.assertEqual(network_component_name in driver.page_source,True)

		logging.info("test_A_create_network_component is correct")
Ejemplo n.º 2
0
	def test_D_plugin_component_with_parameters(self):
	
		u"""
		Create and search new plug-in component with parameters
		"""

		driver = self.driver
	
		agent_name = gen_random_string(6)
		plugin_component_name = gen_random_string(6)

		activate_api(driver,"1234")

		params = [agent_name,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"]
		create_agent_api(driver,params,user="******",pwd="pandora")

		lista = driver.current_url.split('/')
		
		url = lista[0]+'//'+lista[2]+'/pandora_console'
		
		driver.get(url)
		
		create_plugin_component(driver,plugin_component_name,"Generic numeric","Network Management","Application",description="New plugin component",plugin="UDP port check",target_ip="127.0.0.1",port="80")
		
		search_agent(driver,agent_name,go_to_agent=True)

		driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click()
		driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()

		Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new plug-in server module")
					
		driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click()

		driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click()

		Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management")

		time.sleep(3)
		
		Select(driver.find_element_by_id("network_component")).select_by_visible_text(plugin_component_name)
			
		self.assertEqual("80" in driver.page_source,True)
	
		driver.find_element_by_id("submit-crtbutton").click()
		
		search_module (driver,agent_name,plugin_component_name)
		
		self.assertEqual(plugin_component_name in driver.page_source,True)

		logging.info("test_D_plugin_component_with_parameters is correct")
Ejemplo n.º 3
0
    def test_G_edit_module_threshold_in_bulk(self):
        u"""
		Create two agents and one module in this agents. With bulk operation, change FF Threshold with bulk operation
		 Ticket Associated = 4059
		"""

        agent_name_1 = gen_random_string(6)
        agent_name_2 = gen_random_string(6)

        module_name_1 = gen_random_string(6)

        driver = self.driver

        activate_api(driver, "1234")

        params = [
            agent_name_1, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_2, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_1, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        params = [
            agent_name_2, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")
        lista = driver.current_url.split('/')

        url = lista[0] + '//' + lista[2] + '/pandora_console'

        driver.get(url)

        agent_name_list = [agent_name_1, agent_name_2]

        module_name_list = [module_name_1]

        ff_threshold_list = [0, 1, 2]

        edit_modules_in_bulk(driver,
                             module_name_list,
                             agent_name_list,
                             ff_threshold_list=ff_threshold_list)

        self.assertRegexpMatches(self.close_alert_and_get_its_text(),
                                 r"^Are you sure[\s\S]$")
        search_module(driver, agent_name_1, module_name_1, go_to_module=True)

        driver.find_element_by_xpath(
            '//a[contains(.,"Advanced options")]').click()

        element = driver.find_element_by_xpath('//tr//td[contains(.,"0")]')
        self.assertIsInstance(element, WebElement)

        element = driver.find_element_by_xpath('//tr//td[contains(.,"1")]')
        self.assertIsInstance(element, WebElement)

        element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]')
        self.assertIsInstance(element, WebElement)
Ejemplo n.º 4
0
    def test_E_edit_module_group_in_bulk(self):
        u"""
		Create two agents and one module in this agents. With bulk operation, change module group that this module
		"""

        agent_name_1 = gen_random_string(6)
        agent_name_2 = gen_random_string(6)

        module_name_1 = gen_random_string(6)

        driver = self.driver

        activate_api(driver, "1234")

        params = [
            agent_name_1, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_2, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_1, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        params = [
            agent_name_2, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        lista = driver.current_url.split('/')

        url = lista[0] + '//' + lista[2] + '/pandora_console'

        driver.get(url)

        agent_name_list = [agent_name_1, agent_name_2]

        module_name_list = [module_name_1]

        edit_modules_in_bulk(driver,
                             module_name_list,
                             agent_name_list,
                             new_module_group="Users")

        self.assertRegexpMatches(self.close_alert_and_get_its_text(),
                                 r"^Are you sure[\s\S]$")

        search_module(driver, agent_name_1, module_name_1, go_to_module=True)

        self.assertEqual("Users" in driver.page_source, True)
Ejemplo n.º 5
0
    def test_D_delete_modules_in_bulk(self):
        u"""
		Create two agents with two modules and delete this modules through bulk operation	
		"""

        agent_name_1 = gen_random_string(6)
        agent_name_2 = gen_random_string(6)

        module_name_1 = gen_random_string(6)

        driver = self.driver

        activate_api(driver, "1234")

        params = [
            agent_name_1, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_2, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_1, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        params = [
            agent_name_2, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        lista = driver.current_url.split('/')

        url = lista[0] + '//' + lista[2] + '/pandora_console'

        driver.get(url)

        agent_name_list = [agent_name_1, agent_name_2]

        module_name_list = [module_name_1]

        delete_modules_in_bulk(driver, agent_name_list, module_name_list)

        self.assertRegexpMatches(self.close_alert_and_get_its_text(),
                                 r"^Are you sure[\s\S]$")

        search_module(driver, agent_name_1, module_name_1)

        element = driver.find_elements_by_xpath(
            '//a[contains(.,"No available data to show")]')

        self.assertEqual(element, [])
Ejemplo n.º 6
0
    def test_H_copy_modules_in_bulk(self):
        u"""
		Create three agents One of them with a module. Through a bulk operation, copy this module in other two agents
		"""

        agent_name_1 = gen_random_string(6)
        agent_name_2 = gen_random_string(6)
        agent_name_3 = gen_random_string(6)

        module_name_1 = gen_random_string(6)

        driver = self.driver

        activate_api(driver, "1234")

        params = [
            agent_name_1, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_2, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_3, "127.0.0.1", "0", "4", "0", "300", "2", "pandorafms",
            "2", "0", "0", "pruebas"
        ]
        create_agent_api(driver, params, user="******", pwd="pandora")

        params = [
            agent_name_1, module_name_1, "0", "6", "1", "0", "0", "0", "0",
            "0", "0", "0", "0", "129.99.40.1", "0", "0", "180", "0", "0", "0",
            "0", "Host_Alive"
        ]
        add_network_module_to_agent_api(driver,
                                        params,
                                        user="******",
                                        pwd="pandora",
                                        apipwd="1234")

        lista = driver.current_url.split('/')

        url = lista[0] + '//' + lista[2] + '/pandora_console'

        driver.get(url)

        destiny_agents_list = [agent_name_2, agent_name_3]

        module_list = [module_name_1]

        agent_name = agent_name_1.lower()

        copy_modules_in_bulk(driver, agent_name, module_list,
                             destiny_agents_list)

        search_module(driver, agent_name_2, module_name_1)

        self.assertEqual(module_name_1 in driver.page_source, True)

        search_module(driver, agent_name_3, module_name_1)

        self.assertEqual(module_name_1 in driver.page_source, True)

        logging.info("test_H_copy_modules_in_bulk is correct")