Ejemplo n.º 1
0
def fake_fixed_ip_get_by_address(context, address, columns_to_join=None):
    if address == 'inv.ali.d.ip':
        msg = "Invalid fixed IP Address %s in request" % address
        raise exception.FixedIpInvalid(msg)
    for fixed_ip in fake_fixed_ips:
        if fixed_ip['address'] == address and not fixed_ip['deleted']:
            return fixed_ip
    raise exception.FixedIpNotFoundForAddress(address=address)
Ejemplo n.º 2
0
    def validate_networks(self, context, networks):
        """check if the networks exists and host
        is set to each network.
        """
        LOG.debug('Validate networks')
        if networks is None or len(networks) == 0:
            return

        network_uuids = [uuid for (uuid, fixed_ip) in networks]

        self._get_networks_by_uuids(context, network_uuids)

        for network_uuid, address in networks:
            if address is not None:
                if not netutils.is_valid_ip(address):
                    raise exception.FixedIpInvalid(address=address)