# Path: roscraco/helper/validator.py
# WEP_CONSTRAINTS_MAP = {
#     64: {'ascii': 5, 'hex': 10},
#     128: {'ascii': 13, 'hex': 26},
#     152: {'ascii': 16, 'hex': 32}
# }
# def is_valid_mac_address(mac):
# def is_valid_mac_address_normalized(mac):
# def is_valid_ip_address(ip):
# def _is_hex_string(string):
# def is_valid_wpa_psk_password(password):
# def is_valid_wep_password(password, bit_length):
# def is_wep_password_in_hex(password, bit_length):
# def is_valid_ssid(ssid):
# def is_ip_in_range(ip, ip_range_start, ip_range_end):
# 
# Path: roscraco/exception.py
# class RouterSettingsError(RouterError):
#     pass


from roscraco.helper import validator
from roscraco.exception import RouterSettingsError

    def set_internal_param(self, key, value):
        self._internal_params[key] = value

    def get_internal_param(self, key):
        return self._internal_params[key] if key in self._internal_params else None

    def validate(self):
        errors = {}

        if not validator.is_valid_ssid(self.ssid):
            errors['ssid'] = 'Invalid SSID: %s' % self.ssid

        # most routers use channel 0 as the 'Auto' channel
        channel_min = 0 if self.supports_auto_channel else 1
        if not (channel_min <= self.channel <= 13):
            errors['channel'] = 'Invalid channel %d' % self.channel

        if self.security_type not in self._supported_security_types:
            errors['security_type'] = 'Invalid security type: %s' % self.security_type
        else:
            result = self.__validate_password()
            if result is not None:
                errors['password'] = result

        return errors

    def ensure_valid(self):
        errors = self.validate()
        if len(errors) != 0:

# Path: roscraco/helper/validator.py
# WEP_CONSTRAINTS_MAP = {
#     64: {'ascii': 5, 'hex': 10},
#     128: {'ascii': 13, 'hex': 26},
#     152: {'ascii': 16, 'hex': 32}
# }
# def is_valid_mac_address(mac):
# def is_valid_mac_address_normalized(mac):
# def is_valid_ip_address(ip):
# def _is_hex_string(string):
# def is_valid_wpa_psk_password(password):
# def is_valid_wep_password(password, bit_length):
# def is_wep_password_in_hex(password, bit_length):
# def is_valid_ssid(ssid):
# def is_ip_in_range(ip, ip_range_start, ip_range_end):
# 
# Path: roscraco/exception.py
# class RouterSettingsError(RouterError):
#     pass


# Path: roscraco/response/wireless.py
from roscraco.helper import validator
from roscraco.exception import RouterSettingsError


    def set_internal_param(self, key, value):
        self._internal_params[key] = value

    def get_internal_param(self, key):
        return self._internal_params[key] if key in self._internal_params else None

    def validate(self):
        errors = {}

        if not validator.is_valid_ssid(self.ssid):
            errors['ssid'] = 'Invalid SSID: %s' % self.ssid

        # most routers use channel 0 as the 'Auto' channel
        channel_min = 0 if self.supports_auto_channel else 1
        if not (channel_min <= self.channel <= 13):
            errors['channel'] = 'Invalid channel %d' % self.channel

        if self.security_type not in self._supported_security_types:
            errors['security_type'] = 'Invalid security type: %s' % self.security_type
        else:
            result = self.__validate_password()
            if result is not None:
                errors['password'] = result

        return errors

    def ensure_valid(self):
        errors = self.validate()
        if len(errors) != 0:

            raise RouterSettingsError(str(errors))