# Path: os_vif/exception.py
# class ExceptionBase(Exception):
# class LibraryNotInitialized(ExceptionBase):
# class NoMatchingPlugin(ExceptionBase):
# class NoMatchingPortProfileClass(ExceptionBase):
# class NoSupportedPortProfileVersion(ExceptionBase):
# class NoMatchingVIFClass(ExceptionBase):
# class NoSupportedVIFVersion(ExceptionBase):
# class PlugException(ExceptionBase):
# class UnplugException(ExceptionBase):
# class NetworkMissingPhysicalNetwork(ExceptionBase):
# class NetworkInterfaceNotFound(ExceptionBase):
# class NetworkInterfaceTypeNotDefined(ExceptionBase):
# class ExternalImport(ExceptionBase):
# class NotImplementedForOS(ExceptionBase):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# 
# Path: os_vif/objects/base.py
# class VersionedObject(ovo_base.VersionedObject):
# class VersionedObjectPrintableMixin(object):
#     OBJ_PROJECT_NAMESPACE = 'os_vif'
#     def __str__(self):


from oslo_utils import versionutils
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from os_vif import exception
from os_vif.objects import base as osv_base
#    under the License.




def _get_common_version(object_name, max_version, min_version, exc_notmatch,
                        exc_notsupported):
    """Returns the accepted version from the loaded OVO registry"""
    reg = base.VersionedObjectRegistry.obj_classes()

    if object_name not in reg:
        raise exc_notmatch(name=object_name)

    gotvers = []
    for regobj in reg[object_name]:
        gotvers.append(regobj.VERSION)
        got = versionutils.convert_version_to_tuple(regobj.VERSION)
        minwant = versionutils.convert_version_to_tuple(min_version)
        maxwant = versionutils.convert_version_to_tuple(max_version)

        if minwant <= got <= maxwant:
            return regobj.VERSION

    raise exc_notsupported(name=object_name,
                           got_versions=",".join(gotvers),
                           min_version=min_version,
                           max_version=max_version)


@base.VersionedObjectRegistry.register

# Path: os_vif/exception.py
# class ExceptionBase(Exception):
# class LibraryNotInitialized(ExceptionBase):
# class NoMatchingPlugin(ExceptionBase):
# class NoMatchingPortProfileClass(ExceptionBase):
# class NoSupportedPortProfileVersion(ExceptionBase):
# class NoMatchingVIFClass(ExceptionBase):
# class NoSupportedVIFVersion(ExceptionBase):
# class PlugException(ExceptionBase):
# class UnplugException(ExceptionBase):
# class NetworkMissingPhysicalNetwork(ExceptionBase):
# class NetworkInterfaceNotFound(ExceptionBase):
# class NetworkInterfaceTypeNotDefined(ExceptionBase):
# class ExternalImport(ExceptionBase):
# class NotImplementedForOS(ExceptionBase):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# 
# Path: os_vif/objects/base.py
# class VersionedObject(ovo_base.VersionedObject):
# class VersionedObjectPrintableMixin(object):
#     OBJ_PROJECT_NAMESPACE = 'os_vif'
#     def __str__(self):


# Path: os_vif/objects/host_info.py
from oslo_utils import versionutils
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from os_vif import exception
from os_vif.objects import base as osv_base

#    under the License.




def _get_common_version(object_name, max_version, min_version, exc_notmatch,
                        exc_notsupported):
    """Returns the accepted version from the loaded OVO registry"""
    reg = base.VersionedObjectRegistry.obj_classes()

    if object_name not in reg:
        raise exc_notmatch(name=object_name)

    gotvers = []
    for regobj in reg[object_name]:
        gotvers.append(regobj.VERSION)
        got = versionutils.convert_version_to_tuple(regobj.VERSION)
        minwant = versionutils.convert_version_to_tuple(min_version)
        maxwant = versionutils.convert_version_to_tuple(max_version)

        if minwant <= got <= maxwant:
            return regobj.VERSION

    raise exc_notsupported(name=object_name,
                           got_versions=",".join(gotvers),
                           min_version=min_version,
                           max_version=max_version)


@base.VersionedObjectRegistry.register

class HostPortProfileInfo(osv_base.VersionedObject,