Validate Snmp Configuration.
@param snmpType
767083
private static void setSnmpInfo(SnmpType snmpType) {
        if (snmpType == null || !snmpType.isEnabled()) {
            return;
        }
        //Validate Snmp Configuration.
        if (snmpType.getTarget() == null || snmpType.getTarget().trim().length() == 0) {
            throw new IllegalArgumentException("Target must be specified for SNMP configuration.");
        }
        if (snmpType.getAuthkey() != null && snmpType.getAuthkey().length() < 8) {
            throw new IllegalArgumentException("SNMP Authkey must be > 8 characters.");
        }
        if (snmpType.getPrivacykey() != null && snmpType.getPrivacykey().length() < 8) {
            throw new IllegalArgumentException("SNMP Privacy Key must be > 8 characters.");
        }
    }
691039
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSIPAddress syslog_ip_validator = new MPSIPAddress();
		syslog_ip_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		syslog_ip_validator.validate(operationType, syslog_ip, "\"syslog_ip\"");
		
		MPSInt port_validator = new MPSInt();
		port_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		port_validator.validate(operationType, port, "\"port\"");
		
		MPSIPAddress br_ip_address_arr_validator = new MPSIPAddress();
		br_ip_address_arr_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		if(br_ip_address_arr != null)
		{
			for(int i=0; i<br_ip_address_arr.length; i++)
			{
				br_ip_address_arr_validator.validate(operationType, br_ip_address_arr[i], "br_ip_address_arr["+i+"]");
			}
		}
		
	}
945197
void expectValidTypeofName(Node n, String found) {
    report(JSError.make(n, UNKNOWN_TYPEOF_VALUE, found));
  }
569361
private function validateMessageType()
    {
        if (!in_array($this->config[self::CONFIG_TYPE], self::VALID_TYPES, true)) {
            throw new Exception(self::ERR_INVALID_TYPE);
        }

        if ($this->config[self::CONFIG_TYPE] === self::FILE && !$this->config[self::CONFIG_FILE]) {
            throw new Exception(self::ERR_INVALID_FILE);
        }
    }
931766
void expectString(Node n, JSType type, String msg) {
    if (!type.matchesStringContext()) {
      mismatch(n, msg, type, STRING_TYPE);
    }
  }
887643
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString port_name_validator = new MPSString();
		port_name_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		port_name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		port_name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		port_name_validator.validate(operationType, port_name, "\"port_name\"");
		
		MPSString managed_device_id_validator = new MPSString();
		managed_device_id_validator.validate(operationType, managed_device_id, "\"managed_device_id\"");
		
		MPSIPAddress ip_address_validator = new MPSIPAddress();
		ip_address_validator.validate(operationType, ip_address, "\"ip_address\"");
		
		MPSIPAddress netmask_validator = new MPSIPAddress();
		netmask_validator.validate(operationType, netmask, "\"netmask\"");
		
		MPSIPAddress gateway_validator = new MPSIPAddress();
		gateway_validator.validate(operationType, gateway, "\"gateway\"");
		
		MPSInt vlan_validator = new MPSInt();
		vlan_validator.setConstraintMinValue(MPSConstants.GENERIC_CONSTRAINT, 0);
		vlan_validator.setConstraintMaxValue(MPSConstants.GENERIC_CONSTRAINT, 4095);
		vlan_validator.validate(operationType, vlan, "\"vlan\"");
		
		MPSString name_server_validator = new MPSString();
		name_server_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		name_server_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		name_server_validator.validate(operationType, name_server, "\"name_server\"");
		
		MPSString mac_address_validator = new MPSString();
		mac_address_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 32);
		mac_address_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mac_address_validator.validate(operationType, mac_address, "\"mac_address\"");
		
		MPSBoolean is_mgmt_ifc_validator = new MPSBoolean();
		is_mgmt_ifc_validator.validate(operationType, is_mgmt_ifc, "\"is_mgmt_ifc\"");
		
		MPSString mac_mode_validator = new MPSString();
		mac_mode_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 255);
		mac_mode_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mac_mode_validator.validate(operationType, mac_mode, "\"mac_mode\"");
		
		MPSString device_channel_name_validator = new MPSString();
		device_channel_name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 32);
		device_channel_name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		device_channel_name_validator.validate(operationType, device_channel_name, "\"device_channel_name\"");
		
		MPSBoolean is_member_ifc_validator = new MPSBoolean();
		is_member_ifc_validator.validate(operationType, is_member_ifc, "\"is_member_ifc\"");
		
		MPSString vrid_list_ipv6_validator = new MPSString();
		vrid_list_ipv6_validator.validate(operationType, vrid_list_ipv6, "\"vrid_list_ipv6\"");
		
		MPSString vrid_list_ipv4_validator = new MPSString();
		vrid_list_ipv4_validator.validate(operationType, vrid_list_ipv4, "\"vrid_list_ipv4\"");
		
		MPSString vlan_whitelist_validator = new MPSString();
		vlan_whitelist_validator.validate(operationType, vlan_whitelist, "\"vlan_whitelist\"");
		
		MPSBoolean receiveuntagged_validator = new MPSBoolean();
		receiveuntagged_validator.validate(operationType, receiveuntagged, "\"receiveuntagged\"");
		
		MPSBoolean l2_enabled_validator = new MPSBoolean();
		l2_enabled_validator.validate(operationType, l2_enabled, "\"l2_enabled\"");
		
		MPSInt vf_index_validator = new MPSInt();
		vf_index_validator.validate(operationType, vf_index, "\"vf_index\"");
		
		MPSString vrid_list_ipv4_array_validator = new MPSString();
		if(vrid_list_ipv4_array != null)
		{
			for(int i=0; i<vrid_list_ipv4_array.length; i++)
			{
				vrid_list_ipv4_array_validator.validate(operationType, vrid_list_ipv4_array[i], "vrid_list_ipv4_array["+i+"]");
			}
		}
		
		MPSString vrid_list_ipv6_array_validator = new MPSString();
		if(vrid_list_ipv6_array != null)
		{
			for(int i=0; i<vrid_list_ipv6_array.length; i++)
			{
				vrid_list_ipv6_array_validator.validate(operationType, vrid_list_ipv6_array[i], "vrid_list_ipv6_array["+i+"]");
			}
		}
		
		MPSString vlan_whitelist_array_validator = new MPSString();
		if(vlan_whitelist_array != null)
		{
			for(int i=0; i<vlan_whitelist_array.length; i++)
			{
				vlan_whitelist_array_validator.validate(operationType, vlan_whitelist_array[i], "vlan_whitelist_array["+i+"]");
			}
		}
		
		MPSBoolean is_vlan_applied_validator = new MPSBoolean();
		is_vlan_applied_validator.validate(operationType, is_vlan_applied, "\"is_vlan_applied\"");
		
	}
1245736
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInternetHost ip_address_validator = new MPSInternetHost();
		ip_address_validator.setConstraintIsReq(MPSConstants.DELETE_CONSTRAINT, true);
		ip_address_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		ip_address_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		ip_address_validator.validate(operationType, ip_address, "\"ip_address\"");
		
		MPSString community_validator = new MPSString();
		community_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		community_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		community_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		community_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		community_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		community_validator.validate(operationType, community, "\"community\"");
		
	}
1294476
private void validateNodeType(NodeTypeData nodeType) throws RepositoryException
   {
      if (nodeType == null)
      {
         throw new RepositoryException("NodeType object " + nodeType + " is null");
      }

      if (nodeType.getName() == null)
      {
         throw new RepositoryException("NodeType implementation class " + nodeType.getClass().getName()
            + " is not supported in this method");
      }

      for (InternalQName sname : nodeType.getDeclaredSupertypeNames())
      {
         if (!nodeType.getName().equals(Constants.NT_BASE) && nodeType.getName().equals(sname))
         {
            throw new RepositoryException("Invalid super type name" + sname.getAsString());
         }
      }

      for (PropertyDefinitionData pdef : nodeType.getDeclaredPropertyDefinitions())
      {
         if (!pdef.getDeclaringNodeType().equals(nodeType.getName()))
         {
            throw new RepositoryException("Invalid declared node type in property definitions with name "
               + pdef.getName().getAsString() + " not registred");
         }
         
         // validate default values
         try
         {
            validateValueDefaults(pdef.getRequiredType(), pdef.getDefaultValues());
         }
         catch (ValueFormatException e)
         {
            throw new ValueFormatException("Default value is incompatible with Property type "
               + PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
               + " in nodetype " + nodeType.getName().getAsString(), e);
         }
         
         try
         {
            validateValueConstraints(pdef.getRequiredType(), pdef.getValueConstraints());
         }
         catch (ValueFormatException e)
         {
            throw new ValueFormatException("Constraints is incompatible with Property type "
               + PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
               + " in nodetype " + nodeType.getName().getAsString(), e);
         }
      }

      for (NodeDefinitionData cndef : nodeType.getDeclaredChildNodeDefinitions())
      {
         if (!cndef.getDeclaringNodeType().equals(nodeType.getName()))
         {
            throw new RepositoryException("Invalid declared node type in child node definitions with name "
               + cndef.getName().getAsString() + " not registred");
         }
      }
   }
596859
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInt timeout_validator = new MPSInt();
		timeout_validator.setConstraintMinValue(MPSConstants.GENERIC_CONSTRAINT, 0);
		timeout_validator.setConstraintMaxValue(MPSConstants.GENERIC_CONSTRAINT, 18000);
		timeout_validator.validate(operationType, timeout, "\"timeout\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
1090656
public void setExceptionType(String exceptionType) {
		if (exceptionType != null) {
			NullArgumentException.validateNotEmpty(exceptionType, "Error code");
		}
		this.exceptionType = exceptionType;
	}
585337
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSIPAddress ip_address_validator = new MPSIPAddress();
		ip_address_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		ip_address_validator.validate(operationType, ip_address, "\"ip_address\"");
		
		MPSIPAddress netmask_validator = new MPSIPAddress();
		netmask_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		netmask_validator.validate(operationType, netmask, "\"netmask\"");
		
		MPSIPAddress gateway_validator = new MPSIPAddress();
		gateway_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		gateway_validator.validate(operationType, gateway, "\"gateway\"");
		
	}
222573
@Override
    public void validate() throws ConfigurationException {
        if (host == null || host.length() == 0) {
            this.host = "localhost";
        }
        if (port == null || port.length() == 0) {
            this.port = "12345";
        }
    }
526116
@Override
    protected void onValidation(final String contactNode, final String defaultPort)
    {
        if (contactNode != null)
        {
            // allow configuration as comma-separated list of host:port
            // addresses without the default port
            boolean allAddressesHaveHostAndPort = true;

            for (String node : contactNode.split(Constants.COMMA))
            {
                if (StringUtils.countMatches(node, Constants.COLON) == 1)
                {
                    // node is given with hostname and port
                    // count == 1 is to exclude IPv6 addresses
                    if (StringUtils.isNumeric(node.split(Constants.COLON)[1]))
                    {
                        continue;
                    }
                }

                allAddressesHaveHostAndPort = false;
                break;
            }

            if (allAddressesHaveHostAndPort)
            {
                return;
            }
        }

        // fall back to the generic validation which requires the default port
        // to be set
        super.onValidation(contactNode, defaultPort);
    }
309434
def _validate_configuration_type(self, configuration_type):
        

        if configuration_type.lower() != 'running' and configuration_type.lower() != 'startup':
            raise Exception(self.__class__.__name__, 'Configuration Type is invalid. Should be startup or running')
490621
private void ensureTyped(Node n, JSType type) {
    // Make sure FUNCTION nodes always get function type.
    checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType());
    if (n.getJSType() == null) {
      n.setJSType(type);
    }
  }
205168
protected boolean shouldDetectMimeType(String mimeType) {
		for (String prefix : untrustfulMimeTypes) {
			if (mimeType.startsWith(prefix)) return true;
		}
		return false;
	}
1058164
public void if_tcmpgt(TypeMirror type, String target) throws IOException
    {
        pushType(type);
        if_tcmpgt(target);
        popType();
    }