~ubuntu-branches/ubuntu/raring/exabgp/raring

« back to all changes in this revision

Viewing changes to lib/exabgp/bgp/message/nlri/eor.py

  • Committer: Package Import Robot
  • Author(s): Henry-Nicolas Tourneur
  • Date: 2013-01-02 11:42:00 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130102114200-heowva4yrqiiukc5
Tags: 3.1.1-1

* New upstream release
* Closes: #687134 debconf abuse, notice of software behavior take places under
  NEWS.Debian, not in a debconf screen, information moved accordingly.
* Closes: #693338 Japanese translation removed since debconf template is out.
* Closes: #697178 Russian translation removed since debconf template is out.
* Closes: #689533 UCF-based conf added. 
  No more manual changes to exabgp.env, thanks to Federico Ceratto.
          

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# encoding: utf-8
3
 
"""
4
 
route.py
5
 
 
6
 
Created by Thomas Mangin on 2012-07-20.
7
 
Copyright (c) 2012 Exa Networks. All rights reserved.
8
 
"""
9
 
 
10
 
from struct import unpack
11
 
 
12
 
from exabgp.protocol.ip.address import Address
13
 
 
14
 
class RouteEOR (object):
15
 
        PREFIX = '\x00\x00\x00\x07\x90\x0f\x00\x03'
16
 
 
17
 
        def __init__ (self,afi,safi,action):
18
 
                self.nlri = Address(afi,safi)
19
 
                self.action = action
20
 
 
21
 
        def pack (self):
22
 
                return self.PREFIX + self.nlri.afi.pack() + self.nlri.safi.pack()
23
 
 
24
 
        def __str__ (self):
25
 
                return '%s eor %d/%d (%s %s)' % (self.action,self.nlri.afi,self.nlri.safi,self.nlri.afi,self.nlri.safi)
26
 
 
27
 
def announcedRouteEOR (data):
28
 
        return RouteEOR(unpack('!H',data[-4:-2])[0],unpack('!H',data[-2:])[0],'announced')