<commit_before>package device

import (
	"github.com/lxc/lxd/shared"
)

// nicValidationRules returns config validation rules for nic devices.
func nicValidationRules(requiredFields []string, optionalFields []string) map[string]func(value string) error {
	// Define a set of default validators for each field name.
	defaultValidators := map[string]func(value string) error{
		"name":                    shared.IsAny,
		"parent":                  shared.IsAny,
		"network":                 shared.IsAny,
		"mtu":                     shared.IsAny,
		"vlan":                    networkValidVLAN,
		"hwaddr":                  networkValidMAC,
		"host_name":               shared.IsAny,
		"limits.ingress":          shared.IsAny,
		"limits.egress":           shared.IsAny,
		"limits.max":              shared.IsAny,
		"security.mac_filtering":  shared.IsAny,
		"security.ipv4_filtering": shared.IsAny,
		"security.ipv6_filtering": shared.IsAny,
		"maas.subnet.ipv4":        shared.IsAny,
		"maas.subnet.ipv6":        shared.IsAny,
		"ipv4.address":            shared.IsNetworkAddressV4,
		"ipv6.address":            shared.IsNetworkAddressV6,<commit_msg>lxd/device/nic: shared.IsNetworkMAC usage<commit_after>package device

import (
	"github.com/lxc/lxd/shared"
)

// nicValidationRules returns config validation rules for nic devices.
func nicValidationRules(requiredFields []string, optionalFields []string) map[string]func(value string) error {
	// Define a set of default validators for each field name.
	defaultValidators := map[string]func(value string) error{
		"name":                    shared.IsAny,
		"parent":                  shared.IsAny,
		"network":                 shared.IsAny,
		"mtu":                     shared.IsAny,
		"vlan":                    networkValidVLAN,
		"hwaddr":                  shared.IsNetworkMAC,
		"host_name":               shared.IsAny,
		"limits.ingress":          shared.IsAny,
		"limits.egress":           shared.IsAny,
		"limits.max":              shared.IsAny,
		"security.mac_filtering":  shared.IsAny,
		"security.ipv4_filtering": shared.IsAny,
		"security.ipv6_filtering": shared.IsAny,
		"maas.subnet.ipv4":        shared.IsAny,
		"maas.subnet.ipv6":        shared.IsAny,
		"ipv4.address":            shared.IsNetworkAddressV4,
		"ipv6.address":            shared.IsNetworkAddressV6,
{'fraction_non_alphanumeric': 0.11459227467811159, 'fraction_numerical': 0.0068669527896995704, 'mean_word_length': 2.393013100436681, 'pattern_counts': {'":': 34, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5728352', 'n_tokens_mistral': 747, 'n_tokens_neox': 714, 'n_words': 137}