Exemple #1
0
    def test_A_create_new_email_action(self):
        u"""
		Create a new alert action using eMail command and check that create ok
		"""

        logging.basicConfig(filename="Alerts.log",
                            level=logging.INFO,
                            filemode='w')

        action_name = gen_random_string(6)

        driver = self.driver
        self.login()
        detect_and_pass_all_wizards(driver)

        create_new_action_to_alert(driver,
                                   action_name,
                                   "Applications",
                                   "eMail",
                                   field1="*****@*****.**",
                                   field2="Test",
                                   field3="This is a test")

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

        click_menu_element(driver, "Actions")

        element = driver.find_element_by_xpath('//a[contains(.,"' +
                                               action_name + '")]')
        self.assertIsInstance(element, WebElement)

        logging.info("test_A_create_new_email_action is correct")
    def test_A_delete_agent_bulk_operations(self):
        u"""
		Creation two agents and delete this agents using bulk operation'
		Ticket Associated = 3831
		"""

        driver = self.driver
        self.login()
        detect_and_pass_all_wizards

        create_agent(driver, "prueba masivas 1")

        driver.find_element_by_css_selector("b").click()

        create_agent(driver, "prueba masivas 2")

        driver.find_element_by_css_selector("b").click()
        driver.find_element_by_css_selector("b").click()
        click_menu_element(driver, "Agents operations")
        driver.find_element_by_id("option").click()
        Select(driver.find_element_by_id("option")).select_by_visible_text(
            "Bulk agent delete")
        Select(driver.find_element_by_id("id_agents")).select_by_visible_text(
            "prueba masivas 1")
        Select(driver.find_element_by_id("id_agents")).select_by_visible_text(
            "prueba masivas 2")
        driver.find_element_by_id("submit-go").click()

        self.assertRegexpMatches(self.close_alert_and_get_its_text(),
                                 r"^Are you sure[\s\S]$")
        self.assertEqual(
            self.driver.find_element_by_xpath(
                '//div[@id="main"]//td[contains(.,"Successfully deleted (2)")]'
            ).text, "Successfully deleted (2)")
Exemple #3
0
    def test_japanese_characters(self):
        u"""
		Creates an agent and a module with japanese characters and test if the event list show the characters properly
		"""

        driver = self.driver
        self.login()
        detect_and_pass_all_wizards(driver)

        create_agent(driver, u"次のライセンスに基づいていま")

        #Create module
        create_module("network_server",
                      driver,
                      agent_name=u"次のライセンスに基づいていま",
                      module_name=u"管理者ガイド",
                      component_group="Network Management",
                      network_component="Host Alive",
                      ip="192.168.50.50")

        #Create alert
        driver.find_element_by_xpath(
            '//ul[@class="mn"]/li/a/img[@data-title="Alerts"]').click()
        Select(driver.find_element_by_id(
            "id_agent_module")).select_by_visible_text(u"管理者ガイド")
        Select(driver.find_element_by_id("template")).select_by_visible_text(
            "Critical condition")
        Select(driver.find_element_by_id(
            "action_select")).select_by_visible_text("Default action")
        driver.find_element_by_id("submit-add").click()

        #Force alert
        click_menu_element(driver, "Agent detail")
        driver.find_element_by_id("text-search").clear()
        driver.find_element_by_id("text-search").send_keys(u"次のライセンスに基づいていま")
        driver.find_element_by_id("submit-srcbutton").click()
        driver.find_element_by_css_selector("b").click()
        driver.find_element_by_xpath(
            '//ul[@class="mn"]/li/a/img[@data-title="Alerts"]').click()
        driver.find_element_by_xpath(
            '//tr[@id="table2-0"]/td/a/img[@data-title="Force"]').click()
        time.sleep(10)

        #Search events of our agent

        search_events(driver,
                      agent_name=u"次のライセンスに基づいていま",
                      module_name=u"管理者ガイド")

        #Check that there are japanese characters present on the event
        element = driver.find_element_by_xpath(
            u'//a[contains(.,"Alert fired (Critical condition) assigned to (管理者ガイド)")]'
        )
        self.assertIsInstance(element, WebElement)
Exemple #4
0
    def test_B_ACL_reports(self):
        u"""
		Creates a user with Chief Operator permissions over the Applications group. 
		Then creates two reports: one in the Applications group and other in the Servers group. Then, it checks that the given user can only see the Application report
		"""

        user_name = gen_random_string(6)
        report_name_A = agent_name = gen_random_string(6)
        report_name_B = agent_name = gen_random_string(6)

        driver = self.driver
        self.login()

        #Creates a user with Chief Operator - Applications profile
        profile_list = []
        profile_list.append(("Chief Operator", "Applications", []))
        create_user(driver,
                    user_name,
                    user_name,
                    email=user_name + '@pandorafms.com',
                    profile_list=profile_list)

        #Creates report
        create_report(driver, report_name_A, "Applications")
        create_report(driver, report_name_B, "Servers")

        #Logout
        self.logout()

        #Login
        self.login(user=user_name, passwd=user_name)

        #Check that the report is visible
        click_menu_element(driver, "Custom reporting")
        driver.find_element_by_id('text-search').clear()
        driver.find_element_by_id('text-search').send_keys(report_name_A)
        driver.find_element_by_id('submit-search_submit').click()
        self.assertEqual(is_element_present(driver, By.ID, 'report_list-0'),
                         True)

        #Check that the report is not visible
        click_menu_element(driver, "Custom reporting")
        driver.find_element_by_id('text-search').clear()
        driver.find_element_by_id('text-search').send_keys(report_name_B)
        driver.find_element_by_id('submit-search_submit').click()

        time.sleep(6)

        element = driver.find_element_by_xpath(
            '//td[contains(.,"No data found.")]')
        self.assertIsInstance(element, WebElement)

        #Delete reports
        self.logout()
Exemple #5
0
    def test_B_create_new_action_command(self):
        u"""
		Create a new command and then crreate a new action with this command. Check results
		"""

        action_name = gen_random_string(6)
        command_name = gen_random_string(6)

        driver = self.driver

        list_values = ["_agent_", "_agent_status", "_agentdescription_"]
        list_description = [
            "agent name", "status of agent", "agent description"
        ]

        create_new_command_to_alert(driver,
                                    command_name,
                                    "_agent_",
                                    list_field_description=list_description,
                                    list_field_values=list_values,
                                    description="command by test_B of Alerts")

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

        create_new_action_to_alert(driver,
                                   action_name,
                                   "Applications",
                                   command_name,
                                   field1="*****@*****.**",
                                   field2="Test",
                                   field3="This is a action with test B ")

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

        click_menu_element(driver, "Actions")

        element = driver.find_element_by_xpath('//a[contains(.,"' +
                                               action_name + '")]')
        self.assertIsInstance(element, WebElement)

        logging.info("test_B_create_new_action_command is correct")
Exemple #6
0
    def test_C_create_new_template(self):
        u"""
		Create a new template (Unknown Status) and check that changes are applied
		"""

        template_name = gen_random_string(6)

        driver = self.driver

        field_list = [
            "_agent_", "_agentdescription_", "_data_", "_alert_description_"
        ]

        days_list = ["wednesday", "saturday"]

        create_new_template_to_alert(driver,
                                     template_name,
                                     "Applications",
                                     "Mail to Admin",
                                     "Unknown status",
                                     list_days=days_list,
                                     description="Template with test C",
                                     field_list=field_list)

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

        time.sleep(3)

        click_menu_element(driver, "Templates")

        element = driver.find_element_by_xpath('//a[contains(.,"' +
                                               template_name + '")]')
        self.assertIsInstance(element, WebElement)

        logging.info("test_C_create_new_template is correct")
Exemple #7
0
    def test_D_edit_template_created(self):
        u"""
		Create a new template and edit template created, verify the changes
		"""

        template_name = gen_random_string(6)

        driver = self.driver

        field_list = [
            "_agentcustomid_", "_address_", "_module_", "_modulecustomid_"
        ]

        days_list = ["monday", "wednesday", "saturday"]

        create_new_template_to_alert(driver,
                                     template_name,
                                     "Databases",
                                     "Mail to Admin",
                                     "Critical",
                                     list_days=days_list,
                                     description="Template with test C",
                                     field_list=field_list)

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

        time.sleep(3)

        click_menu_element(driver, "Templates")

        element = driver.find_element_by_xpath('//a[contains(.,"' +
                                               template_name + '")]')
        self.assertIsInstance(element, WebElement)

        new_field_list = [
            "_agent_", "_agentdescription_", "_data_", "_alert_description_"
        ]

        edit_template_to_alert(driver,
                               template_name,
                               new_action="Create a ticket in Integria IMS",
                               new_field_list=new_field_list)

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

        click_menu_element(driver, "Templates")

        driver.find_element_by_xpath('//a[contains(.,"' + template_name +
                                     '")]').click()

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

        self.assertEqual(
            "Create a ticket in Integria IMS" in driver.page_source, True)

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

        self.assertEqual("_agentdescription_" in driver.page_source, True)

        logging.info("test_D_edit_template_created is correct")
Exemple #8
0
    def test_pan3(self):
        driver = self.driver
        login(driver, "admin", "pandora", self.base_url)
        click_menu_element(driver, "Agent detail")
        driver.find_element_by_id("submit-crt").click()
        driver.find_element_by_id("text-agente").click()
        driver.find_element_by_id("text-agente").clear()
        driver.find_element_by_id("text-agente").send_keys(
            gen_random_string(10, preffix="PAN3_"))
        driver.find_element_by_id("text-direccion").click()
        driver.find_element_by_id("text-direccion").clear()
        driver.find_element_by_id("text-direccion").send_keys("127.0.0.1")
        driver.find_element_by_id("submit-crtbutton").click()
        driver.find_element_by_css_selector(
            "li.nomn.tab_godmode > a > img.forced_title").click()
        driver.find_element_by_id("moduletype").click()
        Select(driver.find_element_by_id("moduletype")).select_by_visible_text(
            "Create a new network server module")
        driver.find_element_by_name(
            "updbutton").click()  #Alternative XPATH: //*[@class="datos"]/input
        driver.find_element_by_name("updbutton").click(
        )  #IMPORTANT! It's needed to click TWICE! One for leave the combo, and other for clicking the button
        driver.find_element_by_id("id_module_type").click()
        combo = driver.find_element_by_id("id_module_type")
        Select(combo).select_by_visible_text(
            "Remote ICMP network agent, boolean data")
        combo.click()
        driver.find_element_by_id("text-name").clear()
        driver.find_element_by_id("text-name").send_keys("ping test")
        driver.find_element_by_id("submit-crtbutton").click()
        driver.find_element_by_xpath(
            '//*[@id="menu_tab"]//a[contains(@href,"ver_agente")]').click()

        max_retries = 3
        i = 1
        element_text = ""

        while (
                i <= max_retries
        ):  # Temporary workaround to weird StaleElementReferenceException exceptions due Javascript altering the DOM
            try:
                element_text = refresh_N_times_until_find_element(
                    driver, 5, "table1-1-7", how=By.ID).text
                self.assertEqual(
                    "1",
                    element_text.lstrip().rstrip()
                )  # The lstrip.rstrip is done because if not, this error is raised: "'1' != u'1 '"
                print "found it"
                break
            except StaleElementReferenceException as e_stale:
                i = i + 1
                print "found stale"
                if i > max_retries:
                    print "giving up"
                    self.verificationErrors.append(str(e_stale))
                    break
                else:
                    print "retrying"
                    next
            except AssertionError as e:
                print "assertion error"
                self.verificationErrors.append(str(e))
                break
	def test_views_metaconsole(self):

		u"""
		This test do login in metaconsole and check one by one that all views appear.
		"""

		"""

		logging.basicConfig(filename="ViewsMetaconsole.log", level=logging.INFO, filemode='w')

		driver = self.driver
		self.login()
		detect_and_pass_all_wizards(driver)
		
		click_menu_element(driver,"Tree view")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
		
		click_menu_element(driver,"Tactical view")
		time.sleep(2)
		self.assertEqual("Report of events (1 hours)" in driver.page_source,True)
		
		click_menu_element(driver,"Group view")
		time.sleep(2)
		self.assertEqual("Summary by status" in driver.page_source,True)
		
		click_menu_element(driver,"Alerts view")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
		
		click_menu_element(driver,"Monitors view")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
		
		click_menu_element(driver,"Wizard")
		time.sleep(2)

		click_menu_element(driver,"Events")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
				
		click_menu_element(driver,"Create new report")
		time.sleep(2)
		self.assertEqual("Main data" in driver.page_source,True)
				
		click_menu_element(driver,"Reports")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
				
		click_menu_element(driver,"Report templates")
		time.sleep(2)
		self.assertEqual("Template name" in driver.page_source,True)
				
		click_menu_element(driver,"Templates wizard")
		time.sleep(2)
		self.assertEqual("Create template report wizard" in driver.page_source,True)
				
		click_menu_element(driver,"Services")
		time.sleep(2)
		self.assertEqual("Filter" in driver.page_source,True)
				
		click_menu_element(driver,"Network map")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
				
		click_menu_element(driver,"Visual Console")
		time.sleep(2)
		self.assertEqual("Map name" in driver.page_source,True)
		
		click_menu_element(driver,"Live view")
		time.sleep(2)
		self.assertEqual("Draw live filter" in driver.page_source,True)
				
		click_menu_element(driver,"Live view")
		time.sleep(2)
		self.assertEqual("Draw live filter" in driver.page_source,True)	
				
		click_menu_element(driver,"Filters")
		time.sleep(2)
						
		click_menu_element(driver,"Synchronising")
		time.sleep(2)
		self.assertEqual("Synchronizing Users" in driver.page_source,True)			
				
		click_menu_element(driver,"User management")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)

		click_menu_element(driver,"Agent management")
		time.sleep(2)
		self.assertEqual("Source Server" in driver.page_source,True)

		click_menu_element(driver,"Module management")
		time.sleep(2)
		self.assertEqual("Name" in driver.page_source,True)

		click_menu_element(driver,"Alert management")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
		
		click_menu_element(driver,"Event alerts")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
		
		click_menu_element(driver,"Component management")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)

		click_menu_element(driver,"Policy management")
		time.sleep(2)
		self.assertEqual("Show Options" in driver.page_source,True)
						
		click_menu_element(driver,"Cron jobs")
		time.sleep(2)
		self.assertEqual("ADD NEW JOB" in driver.page_source,True)
		
		logging.info("test_views_appear_metaconsole is correct")