Add create_plugin_component function in network_components_functions.py file

(cherry picked from commit 7e80de2b80)
This commit is contained in:
cesar991 2016-09-26 12:31:08 +02:00
parent 3e24107f81
commit 9aa182ddf3
1 changed files with 69 additions and 2 deletions

View File

@ -10,8 +10,7 @@ import random, time
import string
def create_network_component_tcp(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None):
def create_network_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None):
# type_component is for example -> Remote ICMP network agent (latency) or Remote TCP network agent, numeric data
@ -77,3 +76,71 @@ def create_network_component_tcp(driver,name,type_component,group,module_group,m
driver.find_element_by_id("submit-crt").click()
def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None):
# Type is for example -> Generic boolean or Generic numeric incremental (absolute)
click_menu_element(driver,"Network components")
driver.find_element_by_id("id_component_type").click()
Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component")
driver.find_element_by_id("text-name").click()
driver.find_element_by_id("text-name").clear()
driver.find_element_by_id("text-name").send_keys(name)
driver.find_element_by_id("type").click()
Select(driver.find_element_by_id("type")).select_by_visible_text(type_component)
driver.find_element_by_id("id_group").click()
Select(driver.find_element_by_id("id_group")).select_by_visible_text(group)
driver.find_element_by_id("id_module_group").click()
Select(driver.find_element_by_id("id_module_group")).select_by_visible_text(module_group)
if min_warning != None:
driver.find_element_by_id("text-min_warning").click()
driver.find_element_by_id("text-min_warning").clear()
driver.find_element_by_id("text-min_warning").send_keys(min_warning)
if max_warning != None:
driver.find_element_by_id("text-max_warning").click()
driver.find_element_by_id("text-max_warning").clear()
driver.find_element_by_id("text-max_warning").send_keys(max_warning)
if min_critical != None:
driver.find_element_by_id("text-min_critical").click()
driver.find_element_by_id("text-min_critical").clear()
driver.find_element_by_id("text-min_critical").send_keys(min_critical)
if max_critical != None:
driver.find_element_by_id("text-max_critical").click()
driver.find_element_by_id("text-max_critical").clear()
driver.find_element_by_id("text-max_critical").send_keys(max_critical)
# str_warning and str_critical for Generic string type:
if str_warning != None:
driver.find_element_by_id("text-str_warning").click()
driver.find_element_by_id("text-str_warning").clear()
driver.find_element_by_id("text-str_warning").send_keys(str_warning)
if str_critical != None:
driver.find_element_by_id("text-str_critical").click()
driver.find_element_by_id("text-str_critical").clear()
driver.find_element_by_id("text-str_critical").send_keys(str_critical)
if description != None:
driver.find_element_by_id("textarea_description").click()
driver.find_element_by_id("textarea_description").clear()
driver.find_element_by_id("textarea_description").send_keys(description)
driver.find_element_by_id("submit-crt").click()