<commit_before>package network

import (
	"fmt"
	"net"

	"github.com/lxc/lxd/lxd/network/openvswitch"
)

// OVNInstanceDevicePortAdd adds a logical port to the OVN network's internal switch and returns the logical
// port name for use linking an OVS port on the integration bridge to the logical switch port.
func OVNInstanceDevicePortAdd(network Network, instanceID int, deviceName string, mac net.HardwareAddr, ips []net.IP) (openvswitch.OVNSwitchPort, error) {
	// Check network is of type OVN.
	n, ok := network.(*ovn)
	if !ok {
		return "", fmt.Errorf("Network is not OVN type")
	}

	return n.instanceDevicePortAdd(instanceID, deviceName, mac, ips)
}

// OVNInstanceDevicePortDelete deletes a logical port from the OVN network's internal switch.
func OVNInstanceDevicePortDelete(network Network, instanceID int, deviceName string) error {
	// Check network is of type OVN.
	n, ok := network.(*ovn)
	if !ok {
		return fmt.Errorf("Network is not OVN type")
	}

	return n.instanceDevicePortDelete(instanceID, deviceName)
}<commit_msg>lxd/network/network/utils/ovn: Adds OVNInstanceDeviceMTU function<commit_after>package network

import (
	"fmt"
	"net"

	"github.com/lxc/lxd/lxd/network/openvswitch"
)

// OVNInstanceDevicePortAdd adds a logical port to the OVN network's internal switch and returns the logical
// port name for use linking an OVS port on the integration bridge to the logical switch port.
func OVNInstanceDevicePortAdd(network Network, instanceID int, deviceName string, mac net.HardwareAddr, ips []net.IP) (openvswitch.OVNSwitchPort, error) {
	// Check network is of type OVN.
	n, ok := network.(*ovn)
	if !ok {
		return "", fmt.Errorf("Network is not OVN type")
	}

	return n.instanceDevicePortAdd(instanceID, deviceName, mac, ips)
}

// OVNInstanceDevicePortDelete deletes a logical port from the OVN network's internal switch.
func OVNInstanceDevicePortDelete(network Network, instanceID int, deviceName string) error {
	// Check network is of type OVN.
	n, ok := network.(*ovn)
	if !ok {
		return fmt.Errorf("Network is not OVN type")
	}

	return n.instanceDevicePortDelete(instanceID, deviceName)
}

// OVNInstanceDeviceMTU returns the MTU that should be used for an OVN instance device.
func OVNInstanceDeviceMTU(network Network) (uint32, error) {
	// Check network is of type OVN.
	n, ok := network.(*ovn)
	if !ok {
		return 0, fmt.Errorf("Network is not OVN type")
	}

	return n.getBridgeMTU(), nil
}
{'fraction_non_alphanumeric': 0.09633594071634417, 'fraction_numerical': 0.0012350761630300535, 'mean_word_length': 4.599078341013825, 'pattern_counts': {'":': 0, '<': 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': '4018493', 'n_tokens_mistral': 816, 'n_tokens_neox': 761, 'n_words': 266}