From a962e9a472105ff8b37c40ca05c2bb2e4a91a188 Mon Sep 17 00:00:00 2001 From: Toshiki Tsuboi Date: Sun, 28 Dec 2014 06:17:56 +0900 Subject: [PATCH] bgp: bug fix of timestamps of BMPRouteMonitoring in bmp.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It looks “timestamps” of BMPRouteMonitoring incorrect, in case of using ryu.app.bmpstation.py. (1) BMPPeerUpNotification -> timestamp=1419540815.870563 (Fri Dec 26 05:53:35 2014) (2) BMPRouteMonitoring -> timestamp=1419573216.0 (Fri Dec 26 14:53:36 2014) ryu_bmp.log ----------------- 2014 Dec 26 06:44:51 | 192.168.0.101 | BMPInitiation(info=[{'type': 0, 'value': u'This is Ryu BGP BMP message', 'len': 27}],len=37,type=4,version=3) 2014 Dec 26 06:44:51 | 192.168.0.101 | BMPPeerUpNotification(is_post_policy=False,len=162,local_address='192.168.201.101',local_port=58925,peer_address='192.168.201.1',peer_as=65001,peer_bgp_id='10.0.0.1',peer_distinguisher=0,peer_type=0,received_open_message=BGPOpen(bgp_identifier='10.0.0.1',hold_time=180,len=53,my_as=65001,opt_param=[BGPOptParamCapabilityMultiprotocol(afi=1,cap_code=1,cap_length=4,length=6,reserved=0,safi=1,type=2), BGPOptParamCapabilityCiscoRouteRefresh(cap_code=128,cap_length=0,length=2,type=2), BGPOptParamCapabilityRouteRefresh(cap_code=2,cap_length=0,length=2,type=2), BGPOptParamCapabilityFourOctetAsNumber(as_number=65001,cap_code=65,cap_length=4,length=6,type=2)],opt_param_len=24,type=1,version=4),remote_port=179,sent_open_message=BGPOpen(bgp_identifier='10.0.1.1',hold_time=40,len=41,my_as=65002,opt_param=[BGPOptParamCapabilityMultiprotocol(afi=1,cap_code=1,cap_length=4,length=6,reserved=0,safi=1,type=2), BGPOptParamCapabilityRouteRefresh(cap_code=2,cap_length=0,length=2,type=2)],opt_param_len=12,type=1,version=4),timestamp=1419540815.870563,type=3,version=3) 2014 Dec 26 06:44:51 | 192.168.0.101 | BMPRouteMonitoring(bgp_update=BGPUpdate(len=54,nlri=[BGPNLRI(addr='192.168.0.0',length=24)],path_attributes=[BGPPathAttributeNextHop(flags=64,length=4,type=3,value='192.168.201.101'), BGPPathAttributeOrigin(flags=64,length=1,type=1,value=2), BGPPathAttributeAsPath(flags=64,length=6,type=2,value=[[65002, 65001]]), BGPPathAttributeMultiExitDisc(flags=128,length=4,type=4,value=100)],total_path_attribute_len=27,type=2,withdrawn_routes=[],withdrawn_routes_len=0),is_post_policy=True,len=102,peer_address='192.168.201.1',peer_as=65001,peer_bgp_id='10.0.0.1',peer_distinguisher=0,peer_type=0,timestamp=1419573216.0,type=0,version=3) Signed-off-by: Toshiki Tsuboi Signed-off-by: FUJITA Tomonori --- ryu/services/protocols/bgp/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ryu/services/protocols/bgp/model.py b/ryu/services/protocols/bgp/model.py index 86af6f49..0781ee1b 100644 --- a/ryu/services/protocols/bgp/model.py +++ b/ryu/services/protocols/bgp/model.py @@ -19,7 +19,7 @@ sessions. """ import logging -from time import localtime +from time import gmtime LOG = logging.getLogger('bgpspeaker.model') @@ -144,7 +144,7 @@ class SentRoute(object): if timestamp: self.timestamp = timestamp else: - self.timestamp = localtime() + self.timestamp = gmtime() # Automatically generated. # @@ -174,7 +174,7 @@ class ReceivedRoute(object): if timestamp: self.timestamp = timestamp else: - self.timestamp = localtime() + self.timestamp = gmtime() @property def received_peer(self):