Beispiel #1
0
def get_port_stats(controller, network_id, port_id):
    if isinstance(controller, aicq.blue.Blue):
        blue = controller
    if not blue.check_network_existance(network_id):
        LOG.error("Network not found, Error")
        raise exception.NetworkNotFound(net_id=network_id)
    try:
        stats = blue.get_port_stats(network_id, port_id)
    except aiclib.nvp.ResourceNotFound as e:
        LOG.error("Port not found, Error: %s" % str(e))
        raise exception.PortNotFound(port_id=port_id, net_id=network_id)
    LOG.debug('Returning stats for port "%s" on "%s": %s' % (port_id, network_id, stats))
    return stats
Beispiel #2
0
def get_port_status(controller, lswitch_id, port_id):
    if isinstance(controller, aicq.blue.Blue):
        blue = controller
    try:
        if not blue.check_network_existance(lswitch_id):
            LOG.error("Network not found, Error")
            raise exception.NetworkNotFound(net_id=lswitch_id)
    except aiclib.nvp.NVPException:
        raise exception.QuantumException
    try:
        status = blue.get_port_link_status(lswitch_id, port_id)
    except aiclib.nvp.ResourceNotFound as e:
        LOG.error("Port not found, Error: %s" % str(e))
        raise exception.PortNotFound(port_id=port_id, net_id=lswitch_id)
    except aiclib.nvp.NVPException:
        raise exception.QuantumException()
    return status