networkapi package

Subpackages

Submodules

networkapi.SQLLogMiddleware module

networkapi.admin_permission module

class networkapi.admin_permission.AdminPermission[source]

Bases: object

ACCESS_TYPE_MANAGEMENT = 'cadastro_de_tipo_acesso'
ACL_APPLY = 'aplicar_acl'
ACL_VLAN_VALIDATION = 'validar_acl_vlans'
AS_MANAGEMENT = 'as_management'
AUDIT_LOG = 'audit_logs'
AUTHENTICATE = 'authenticate'
BRAND_MANAGEMENT = 'cadastro_de_marca'
ENVIRONMENT_MANAGEMENT = 'cadastro_de_ambiente'
ENVIRONMENT_VIP = 'ambiente_vip'
EQUIPMENT_GROUP_MANAGEMENT = 'cadastro_de_grupos_equipamentos'
EQUIPMENT_MANAGEMENT = 'cadastro_de_equipamentos'
EQUIP_READ_OPERATION = 'READ'
EQUIP_UPDATE_CONFIG_OPERATION = 'UPDATE_CONFIG'
EQUIP_WRITE_OPERATION = 'WRITE'
HEALTH_CHECK_EXPECT = 'healthcheck_expect'
IPS = 'ips'
LIST_CONFIG_BGP_DEPLOY_SCRIPT = 'list_config_bgp_deploy_script'
LIST_CONFIG_BGP_MANAGEMENT = 'list_config_bgp_management'
LIST_CONFIG_BGP_UNDEPLOY_SCRIPT = 'list_config_bgp_undeploy_script'
NEIGHBOR_DEPLOY_SCRIPT = 'neighbor_deploy_script'
NEIGHBOR_MANAGEMENT = 'neighbor_management'
NEIGHBOR_UNDEPLOY_SCRIPT = 'neighbor_undeploy_script'
NETWORK_FORCE = 'network_force'
NETWORK_TYPE_MANAGEMENT = 'cadastro_de_tipo_rede'
OBJ_DELETE_OPERATION = 'DELETE'
OBJ_READ_OPERATION = 'READ'
OBJ_TYPE_PEER_GROUP = 'PeerGroup'
OBJ_TYPE_POOL = 'ServerPool'
OBJ_TYPE_VIP = 'VipRequest'
OBJ_TYPE_VLAN = 'Vlan'
OBJ_UPDATE_CONFIG_OPERATION = 'UPDATE_CONFIG'
OBJ_WRITE_OPERATION = 'WRITE'
OPTION_VIP = 'opcao_vip'
PEER_GROUP_MANAGEMENT = 'peer_group_management'
POOL_ALTER_SCRIPT = 'script_alterar_pool'
POOL_CREATE_SCRIPT = 'script_criacao_pool'
POOL_DELETE_OPERATION = 'DELETE'
POOL_MANAGEMENT = 'cadastro_de_pool'
POOL_READ_OPERATION = 'READ'
POOL_REMOVE_SCRIPT = 'script_remover_pool'
POOL_UPDATE_CONFIG_OPERATION = 'UPDATE_CONFIG'
POOL_WRITE_OPERATION = 'WRITE'
READ_OPERATION = 'READ'
ROUTE_MAP_DEPLOY_SCRIPT = 'route_map_deploy_script'
ROUTE_MAP_MANAGEMENT = 'route_map_management'
ROUTE_MAP_UNDEPLOY_SCRIPT = 'route_map_undeploy_script'
SCRIPT_MANAGEMENT = 'cadastro_de_roteiro'
TELCO_CONFIGURATION = 'configuracao_telco'
USER_ADMINISTRATION = 'administracao_usuarios'
VIPS_REQUEST = 'requisicao_vips'
VIP_ALTER_SCRIPT = 'script_alterar_vip'
VIP_CREATE_SCRIPT = 'script_criacao_vip'
VIP_DELETE_OPERATION = 'DELETE'
VIP_READ_OPERATION = 'READ'
VIP_REMOVE_SCRIPT = 'script_remover_vip'
VIP_UPDATE_CONFIG_OPERATION = 'UPDATE_CONFIG'
VIP_VALIDATION = 'validar_vip'
VIP_WRITE_OPERATION = 'WRITE'
VLAN_ALLOCATION = 'alocar_vlan'
VLAN_ALTER_SCRIPT = 'script_alterar_vlan'
VLAN_CREATE_SCRIPT = 'script_criacao_vlan'
VLAN_MANAGEMENT = 'cadastro_de_vlans'
VM_MANAGEMENT = 'cadastro_de_vm'
WRITE_OPERATION = 'WRITE'

networkapi.conftest module

networkapi.cvs module

exception networkapi.cvs.CVSCommandError(error)[source]

Bases: networkapi.cvs.CVSError

exception networkapi.cvs.CVSError(error)[source]

Bases: exceptions.Exception

class networkapi.cvs.Cvs[source]
classmethod add(archive)[source]

Execute command add in cvs

@param archive: file to be add

@raise CVSCommandError: Failed to execute command

classmethod commit(archive, comment)[source]

Execute command commit in cvs

@param archive: file to be committed @param comment: comments

@raise CVSCommandError: Failed to execute command

classmethod remove(archive)[source]

Execute command remove in cvs

@param archive: file to be remove

@raise CVSCommandError: Failed to execute command

classmethod synchronization()[source]

Execute command update in cvs

@raise CVSCommandError: Failed to execute command

networkapi.environment_settings module

networkapi.settings.local_files(path)[source]

networkapi.error_message_utils module

networkapi.error_message_utils.error_dumps(code, *args)[source]

networkapi.exception module

exception networkapi.exception.AddBlockOverrideNotDefined(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred when attempting to change a VIP that has not been created.

exception networkapi.exception.CustomException(cause, message=None)[source]

Bases: exceptions.Exception

Represents an error occurred validating a value.

exception networkapi.exception.EnvironmentEnvironmentServerPoolLinked(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception to EnvironmentEnvironmentVip error.

exception networkapi.exception.EnvironmentEnvironmentVipDuplicatedError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception to EnvironmentEnvironmentVip duplicated.

exception networkapi.exception.EnvironmentEnvironmentVipError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception to EnvironmentEnvironmentVip error.

exception networkapi.exception.EnvironmentEnvironmentVipNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception to EnvironmentEnvironmentVip research by primary key.

exception networkapi.exception.EnvironmentNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception to Environment research by primary key.

exception networkapi.exception.EnvironmentVipAssociatedToSomeNetworkError(cause, message=None)[source]

Bases: networkapi.exception.EnvironmentVipError

returns exception to environment vip delete when it’s associated to some Network

exception networkapi.exception.EnvironmentVipError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred during access to tables related to environment VIP.

exception networkapi.exception.EnvironmentVipNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.EnvironmentVipError

returns exception to environment research by primary key.

exception networkapi.exception.EquipmentGroupsNotAuthorizedError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error when the groups of equipment registered with the IP of the VIP request is not allowed acess.

exception networkapi.exception.InvalidValueError(cause, param=None, value=None)[source]

Bases: exceptions.Exception

Represents an error occurred validating a value.

exception networkapi.exception.NetworkActiveError(cause=None, message=None)[source]

Bases: networkapi.exception.CustomException

Exception returned when network is active and someone is trying to remove it

DEFAULT_MESSAGE = "Can't remove network because it is active"
exception networkapi.exception.NetworkInactiveError(cause=u'Unable to remove the network because it is inactive.', message=None)[source]

Bases: networkapi.exception.CustomException

Returns exception when trying to disable a network disabled

exception networkapi.exception.OptionPoolEnvironmentDuplicatedError(cause, message=None)[source]

Bases: networkapi.exception.OptionPoolEnvironmentError

returns exception if OptionPool is already associated with EnvironmentVip.

exception networkapi.exception.OptionPoolEnvironmentError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred during access to tables related to OptionPoolEnvironmentVip.

exception networkapi.exception.OptionPoolEnvironmentNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.OptionPoolEnvironmentError

returns exception to OptionPoolEnvironmentVip research by primary key.

exception networkapi.exception.OptionPoolError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred during access to tables related to Option Pool.

exception networkapi.exception.OptionPoolNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.OptionPoolError

returns exception to Option pool research by primary key.

exception networkapi.exception.OptionPoolServiceDownNoneError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

returns exception if OptionPool service-down-action “none” option does not exists.

exception networkapi.exception.OptionVipEnvironmentVipDuplicatedError(cause, message=None)[source]

Bases: networkapi.exception.OptionVipEnvironmentVipError

returns exception if OptionVip is already associated with EnvironmentVip.

exception networkapi.exception.OptionVipEnvironmentVipError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred during access to tables related to OptionVipEnvironmentVip.

exception networkapi.exception.OptionVipEnvironmentVipNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.OptionVipEnvironmentVipError

returns exception to OptionVipEnvironmentVip research by primary key.

exception networkapi.exception.OptionVipError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred during access to tables related to Option VIP.

exception networkapi.exception.OptionVipNotFoundError(cause, message=None)[source]

Bases: networkapi.exception.OptionVipError

returns exception to Option vip research by primary key.

exception networkapi.exception.RequestVipsNotBeenCreatedError(cause, message=None)[source]

Bases: networkapi.exception.CustomException

Represents an error occurred when attempting to change a VIP that has not been created.

networkapi.log module

class networkapi.log.CommonAdminEmailHandler(include_html=False)[source]

Bases: django.utils.log.AdminEmailHandler

An exception log handler that e-mails log entries to site admins. If the request is passed as the first argument to the log record, request data will be provided in the

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class networkapi.log.Log(module_name)[source]

Bases: object

Classe responsável por encapsular a API de logging. Encapsula as funcionalidades da API de logging de forma a adicionar o nome do módulo nas mensagens que forem impressas.

debug(msg, *args)[source]

Imprime uma mensagem de debug no log

error(msg, *args)[source]

Imprime uma mensagem de erro no log

info(msg, *args)[source]

Imprime uma mensagem de informação no log

classmethod init_log(log_file_name='/tmp/networkapi.log', number_of_days_to_log=10, log_level=10, log_format='%(asctime)s %(request_user)-6s %(request_path)-8s %(request_id)-6s %(levelname)-6s - %(message)s', use_stdout=True, max_line_size=2048)[source]
rest(msg, *args)[source]
warning(msg, *args)[source]

Imprime uma mensagem de advertência no log

class networkapi.log.MultiprocessTimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False)[source]

Bases: logging.handlers.TimedRotatingFileHandler

doRollover()[source]

do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix.

class networkapi.log.NetworkAPILogFormatter(fmt=None, datefmt=None)[source]

Bases: logging.Formatter

formatException(ei)[source]

Format and return the specified exception information as a string.

This default implementation just uses traceback.print_exception()

networkapi.log.convert_to_utf8(object)[source]

Converte o object informado para uma representação em utf-8

networkapi.log.get_lock()[source]

Obtém lock para evitar que várias mensagens sejam sobrepostas no log

networkapi.log.release_lock()[source]

Obtém lock para evitar que várias mensagens sejam sobrepostas no log

networkapi.processExceptionMiddleware module

class networkapi.processExceptionMiddleware.LoggingMiddleware[source]

Bases: object

process_exception(request, exception)[source]

HIDE PASSWORD VALUES

networkapi.rest module

networkapi.settings module

networkapi.settings.local_files(path)[source]

networkapi.sitecustomize module

networkapi.teste module

networkapi.urls module

networkapi.util module

class networkapi.util.IP_VERSION[source]
IPv4 = (u'v4', u'IPv4')
IPv6 = (u'v6', u'IPv6')
List = ((u'v4', u'IPv4'), (u'v6', u'IPv6'))
networkapi.util.cache_function(length, equipment=False)[source]

Cache the result of function

@param length: time in seconds to stay in cache

networkapi.util.clear_newline_chr(string)[source]
networkapi.util.clone(obj)[source]

Clone the object

@param obj: object to be cloned

@return object cloned.

networkapi.util.convert_boolean_to_int(param)[source]

Convert the parameter of boolean to int.

@param param: parameter to be converted.

@return Parameter converted.

networkapi.util.convert_string_or_int_to_boolean(param, force=None)[source]

Convert the parameter of string or int to boolean. @param param: parameter to be converted. @return Parameter converted.

networkapi.util.destroy_cache_function(key_list, equipment=False)[source]
networkapi.util.get_environment_map(environment)[source]
networkapi.util.get_vlan_map(vlan, network_ipv4, network_ipv6)[source]
networkapi.util.is_healthcheck_valid(healthcheck)[source]
networkapi.util.is_valid_boolean_param(param, required=True)[source]

Checks if the parameter is a valid boolean.

@param param: Value to be validated.

@return True if the parameter has a valid boolean value, or False otherwise.

networkapi.util.is_valid_email(param)[source]

Checks if the parameter is a valid e-mail.

@param param: Value to be validated.

@return True if the parameter has a valid e-mail value, or False otherwise.

networkapi.util.is_valid_healthcheck_destination(param)[source]

Checks if the parameter is a valid healthcheck_destination.

@param param: Value to be validated.

@return True if the parameter has a valid healthcheck_destination value, or False otherwise.

networkapi.util.is_valid_int_greater_equal_zero_param(param)[source]

Checks if the parameter is a valid integer value and greater and equal than zero.

@param param: Value to be validated.

@return True if the parameter has a valid integer value, or False otherwise.

networkapi.util.is_valid_int_greater_zero_param(param, required=True)[source]

Checks if the parameter is a valid integer value and greater than zero.

@param param: Value to be validated.

@return True if the parameter has a valid integer value, or False otherwise.

networkapi.util.is_valid_int_param(param, required=True)[source]

Checks if the parameter is a valid integer value.

@param param: Value to be validated.

@return True if the parameter has a valid integer value, or False otherwise.

networkapi.util.is_valid_ip(address)[source]

Verifica se address é um endereço ip válido.

networkapi.util.is_valid_ip_ipaddr(param)[source]

Checks if the parameter is a valid ip is ipv4 or ipv6.

@param param: Value to be validated.

@return True if the parameter has a valid ipv6 or ipv4 value, or False otherwise.

networkapi.util.is_valid_ipv4(param)[source]

Checks if the parameter is a valid ipv4.

@param param: Value to be validated.

@return True if the parameter has a valid ipv4 value, or False otherwise.

networkapi.util.is_valid_ipv6(param)[source]

Checks if the parameter is a valid ipv6.

@param param: Value to be validated.

@return True if the parameter has a valid ipv6 value, or False otherwise.

networkapi.util.is_valid_list_int_greater_zero_param(list_param, required=True)[source]

Checks if the parameter list is a valid integer value and greater than zero.

@param param: Value to be validated.

@raise ValidationError: If there is validation error in the field

networkapi.util.is_valid_option(param)[source]

Checks if the parameter is a valid field text and 0-9 and should follow the format of [A-Za-z] and special characters hyphen, underline and point.

@param param: Value to be validated.

@return True if the parameter has a valid text value, or False otherwise.

networkapi.util.is_valid_pool_identifier_text(param, required=True)[source]

Checks if the parameter is a valid field text and should follow the format of [A-Za-z] and special characters hyphen and underline.

@param param: Value to be validated. @param required: Check if the value can be None

@return True if the parameter has a valid text value, or False otherwise.

networkapi.util.is_valid_regex(string, regex)[source]

Checks if the parameter is a valid value by regex.

Parameters:param – Value to be validated.
Returns:True if the parameter has a valid vakue, or False otherwise.
networkapi.util.is_valid_string_maxsize(param, maxsize=None, required=True)[source]

Checks if the parameter is a valid string and his size is less than maxsize. If the parameter maxsize is None than the size is ignored If the parameter required is True than the string can not be None

@param param: Value to be validated. @param maxsize: Max size of the value to be validated. @param required: Check if the value can be None

@return True if the parameter is valid or False otherwise.

networkapi.util.is_valid_string_minsize(param, minsize=None, required=True)[source]

Checks if the parameter is a valid string and his size is more than minsize. If the parameter minsize is None than the size is ignored If the parameter required is True than the string can not be None

@param param: Value to be validated. @param minsize: Min size of the value to be validated. @param required: Check if the value can be None

@return True if the parameter is valid or False otherwise.

networkapi.util.is_valid_text(param, required=True)[source]

Checks if the parameter is a valid field text and should follow the format of [A-Za-z] and special characters hyphen and underline.

@param param: Value to be validated. @param required: Check if the value can be None

@return True if the parameter has a valid text value, or False otherwise.

networkapi.util.is_valid_uri(param)[source]

Checks if the parameter is a valid uri.

@param param: Value to be validated.

@return True if the parameter has a valid uri value, or False otherwise.

networkapi.util.is_valid_version_ip(param, IP_VERSION)[source]

Checks if the parameter is a valid ip version value.

@param param: Value to be validated.

@return True if the parameter has a valid ip version value, or False otherwise.

networkapi.util.is_valid_yes_no_choice(param)[source]

Checks if the parameter is valid ‘S’ or ‘N’ char.

@param param: valid to be validated.

@return True if the parameter is a valid choice, or False otherwise.

networkapi.util.is_valid_zero_one_param(param, required=True)[source]

Checks if the parameter is a valid zero or one string.

@param param: Value to be validated.

@return True if the parameter has a valid zero or one value, or False otherwise.

networkapi.util.mount_ipv4_string(ip)[source]
networkapi.util.mount_ipv6_string(ip)[source]
networkapi.util.search_hide_password(msg)[source]

Search and hide password

networkapi.util.to_ip(address)[source]

Resolve o endereço IP caso address seja um hostname.

Parameters:address – Hostname ou endereço IP.
Returns:Endereço IP correspondente ao endereço informado.
networkapi.util.valid_expression(operator, value1, value2)[source]
networkapi.util.valid_regex(string, regex)[source]

Module contents