+my $net_fmt = {
+ macaddr => {
+ type => 'string',
+ pattern => qr/[0-9a-f]{2}(?::[0-9a-f]{2}){5}/i,
+ description => "MAC address",
+ format_description => "XX:XX:XX:XX:XX:XX",
+ optional => 1,
+ },
+ model => { alias => 'macaddr', default_key => 1 },
+ (map { $_ => { group => 'model' } } @$nic_model_list),
+ bridge => {
+ type => 'string',
+ description => 'Bridge to attach the network device to.',
+ format_description => 'bridge',
+ optional => 1,
+ },
+ queues => {
+ type => 'integer',
+ minimum => 0, maximum => 16,
+ description => 'Number of packet queues to be used on the device.',
+ format_description => 'number',
+ optional => 1,
+ },
+ rate => {
+ type => 'number',
+ minimum => 0,
+ description => 'Rate limit in mbps as floating point number.',
+ format_description => 'mbps',
+ optional => 1,
+ },
+ tag => {
+ type => 'integer',
+ minimum => 2, maximum => 4094,
+ description => 'VLAN tag to apply to packets on this interface.',
+ format_description => 'vlanid',
+ optional => 1,
+ },
+ trunks => {
+ type => 'string',
+ pattern => qr/\d+(?:-\d+)?(?:;\d+(?:-\d+)?)*/,
+ description => 'VLAN trunks to pass through this interface.',
+ format_description => 'id;id...',
+ optional => 1,
+ },
+ firewall => {
+ type => 'boolean',
+ description => 'Whether this interface should be protected by the firewall.',
+ format_description => '0|1',
+ optional => 1,
+ },
+ link_down => {
+ type => 'boolean',
+ description => 'Whether this interface should be DISconnected (like pulling the plug).',
+ format_description => '0|1',
+ optional => 1,
+ },
+};