Esempio n. 1
0
def withdraw(flow, match, then):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    Disables the flow and set its status to INACTIVE.
    """
    try:
        bgpspeaker.update_flow(match, then, withdraw=True)
        flow.status = Route.INACTIVE
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)
Esempio n. 2
0
def announce(flow):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends announce route command via a socket.
    Update status of the flow to ACTIVE if there are no error
    """
    try:
        bgpspeaker.update_flow(flow.match(), flow.then())
        flow.status = Route.ACTIVE
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)
Esempio n. 3
0
def withdraw(flow, match, then):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    Disables the flow and set its status to INACTIVE.
    """
    try:
        bgpspeaker.update_flow(match, then, withdraw=True)
        flow.status = Route.INACTIVE
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)
Esempio n. 4
0
def announce(flow):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends announce route command via a socket.
    Update status of the flow to ACTIVE if there are no error
    """
    try:
        bgpspeaker.update_flow(flow.match(), flow.then())
        flow.status = Route.ACTIVE
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)
Esempio n. 5
0
def delete(flow, match, then):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    This function doesn't update status fields, compared to withdraw task,
    because the flow is removed from the db.
    """
    try:
        bgpspeaker.update_flow(match, then, withdraw=True)
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        flow.save()
        raise announce.retry(exc=e, countdown=10)
Esempio n. 6
0
def delete(flow, match, then):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    This function doesn't update status fields, compared to withdraw task,
    because the flow is removed from the db.
    """
    try:
        bgpspeaker.update_flow(match, then, withdraw=True)
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        flow.save()
        raise announce.retry(exc=e, countdown=10)
Esempio n. 7
0
def expire(flow):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    This function set status field to EXPIRED.
    """
    if not flow.has_expired():
        return
    try:
        bgpspeaker.update_flow(flow.match(), flow.then(), withdraw=True)
        flow.status = Route.EXPIRED
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)
Esempio n. 8
0
def expire(flow):
    """
    Asynchronous task. It transmit information to the bgpspeaker
    who sends withdraw route command via a socket.
    This function set status field to EXPIRED.
    """
    if not flow.has_expired():
        return
    try:
        bgpspeaker.update_flow(flow.match(), flow.then(), withdraw=True)
        flow.status = Route.EXPIRED
    except ValueError, e:
        logger.error('Error ' + e)
        flow.status = Route.ERROR
        raise announce.retry(exc=e, countdown=10)