# # Autogenerated by Sandesh Compiler (1.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py:new_style # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # from pysandesh.Thrift import TType, TMessageType, TException from pysandesh.transport import TTransport from pysandesh.protocol import TBinaryProtocol, TProtocol try: from pysandesh.protocol import fastbinary except: fastbinary = None import cStringIO import uuid import bottle from pysandesh import sandesh_base from pysandesh.sandesh_http import SandeshHttp from pysandesh.sandesh_uve import SandeshUVETypeMaps from pysandesh.util import UTCTimestampUsec, UTCTimestampUsecToString from pysandesh.gen_py.sandesh.constants import * class UvePhysicalRouterConfig(object): """ Attributes: - name - deleted - ip_address - connected_bgp_router - product_info - auto_conf_enabled - netconf_enabled_status - last_commit_time - last_commit_duration - commit_status_message - total_commits_sent_since_up """ thrift_spec = ( None, # 0 (1, TType.STRING, 'name', None, None, ), # 1 (2, TType.BOOL, 'deleted', None, None, ), # 2 (3, TType.STRING, 'ip_address', None, None, ), # 3 (4, TType.STRING, 'connected_bgp_router', None, None, ), # 4 (5, TType.STRING, 'product_info', None, None, ), # 5 (6, TType.BOOL, 'auto_conf_enabled', None, None, ), # 6 (7, TType.BOOL, 'netconf_enabled_status', None, None, ), # 7 (8, TType.STRING, 'last_commit_time', None, None, ), # 8 (9, TType.STRING, 'last_commit_duration', None, None, ), # 9 (10, TType.STRING, 'commit_status_message', None, None, ), # 10 (11, TType.I32, 'total_commits_sent_since_up', None, None, ), # 11 ) def __init__(self, name=None, deleted=None, ip_address=None, connected_bgp_router=None, product_info=None, auto_conf_enabled=None, netconf_enabled_status=None, last_commit_time=None, last_commit_duration=None, commit_status_message=None, total_commits_sent_since_up=None,): self.name = name self.deleted = deleted self.ip_address = ip_address self.connected_bgp_router = connected_bgp_router self.product_info = product_info self.auto_conf_enabled = auto_conf_enabled self.netconf_enabled_status = netconf_enabled_status self.last_commit_time = last_commit_time self.last_commit_duration = last_commit_duration self.commit_status_message = commit_status_message self.total_commits_sent_since_up = total_commits_sent_since_up self._table = 'ObjectPRouter' def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) return 0 read_cnt = 0 length = iprot.readStructBegin() if length < 0: return -1 read_cnt += length while True: (length, fname, ftype, fid) = iprot.readFieldBegin() if length < 0: return -1 read_cnt += length if ftype == TType.STOP: break if fid == 1: if ftype == TType.STRING: (length, self.name) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 2: if ftype == TType.BOOL: (length, self.deleted) = iprot.readBool(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 3: if ftype == TType.STRING: (length, self.ip_address) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 4: if ftype == TType.STRING: (length, self.connected_bgp_router) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 5: if ftype == TType.STRING: (length, self.product_info) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 6: if ftype == TType.BOOL: (length, self.auto_conf_enabled) = iprot.readBool(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 7: if ftype == TType.BOOL: (length, self.netconf_enabled_status) = iprot.readBool(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 8: if ftype == TType.STRING: (length, self.last_commit_time) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 9: if ftype == TType.STRING: (length, self.last_commit_duration) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 10: if ftype == TType.STRING: (length, self.commit_status_message) = iprot.readString(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) elif fid == 11: if ftype == TType.I32: (length, self.total_commits_sent_since_up) = iprot.readI32(); if length < 0: return -1 read_cnt += length else: iprot.skip(ftype) else: iprot.skip(ftype) length = iprot.readFieldEnd() if length < 0: return -1 read_cnt += length length = iprot.readStructEnd() if length < 0: return -1 read_cnt += length return read_cnt def write(self, oprot): if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return 0 if oprot.writeStructBegin('UvePhysicalRouterConfig') < 0: return -1 if self.name is not None: annotations = {} if self._table is None or self._table is '': return -1 annotations['key'] = self._table if oprot.writeFieldBegin('name', TType.STRING, 1, annotations) < 0: return -1 if oprot.writeString(self.name) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.deleted is not None: annotations = {} if oprot.writeFieldBegin('deleted', TType.BOOL, 2, annotations) < 0: return -1 if oprot.writeBool(self.deleted) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.ip_address is not None: annotations = {} if oprot.writeFieldBegin('ip_address', TType.STRING, 3, annotations) < 0: return -1 if oprot.writeString(self.ip_address) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.connected_bgp_router is not None: annotations = {} if oprot.writeFieldBegin('connected_bgp_router', TType.STRING, 4, annotations) < 0: return -1 if oprot.writeString(self.connected_bgp_router) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.product_info is not None: annotations = {} if oprot.writeFieldBegin('product_info', TType.STRING, 5, annotations) < 0: return -1 if oprot.writeString(self.product_info) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.auto_conf_enabled is not None: annotations = {} if oprot.writeFieldBegin('auto_conf_enabled', TType.BOOL, 6, annotations) < 0: return -1 if oprot.writeBool(self.auto_conf_enabled) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.netconf_enabled_status is not None: annotations = {} if oprot.writeFieldBegin('netconf_enabled_status', TType.BOOL, 7, annotations) < 0: return -1 if oprot.writeBool(self.netconf_enabled_status) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.last_commit_time is not None: annotations = {} if oprot.writeFieldBegin('last_commit_time', TType.STRING, 8, annotations) < 0: return -1 if oprot.writeString(self.last_commit_time) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.last_commit_duration is not None: annotations = {} if oprot.writeFieldBegin('last_commit_duration', TType.STRING, 9, annotations) < 0: return -1 if oprot.writeString(self.last_commit_duration) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.commit_status_message is not None: annotations = {} if oprot.writeFieldBegin('commit_status_message', TType.STRING, 10, annotations) < 0: return -1 if oprot.writeString(self.commit_status_message) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if self.total_commits_sent_since_up is not None: annotations = {} if oprot.writeFieldBegin('total_commits_sent_since_up', TType.I32, 11, annotations) < 0: return -1 if oprot.writeI32(self.total_commits_sent_since_up) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if oprot.writeFieldStop() < 0: return -1 if oprot.writeStructEnd() < 0: return -1 return 0 def validate(self): return def log(self): log_str = cStringIO.StringIO() if self.name is not None: log_str.write('name = ') log_str.write(self.name) log_str.write(' ') if self.deleted is not None: log_str.write('deleted = ') if self.deleted: log_str.write('True') else: log_str.write('False') log_str.write(' ') if self.ip_address is not None: log_str.write('ip_address = ') log_str.write(self.ip_address) log_str.write(' ') if self.connected_bgp_router is not None: log_str.write('connected_bgp_router = ') log_str.write(self.connected_bgp_router) log_str.write(' ') if self.product_info is not None: log_str.write('product_info = ') log_str.write(self.product_info) log_str.write(' ') if self.auto_conf_enabled is not None: log_str.write('auto_conf_enabled = ') if self.auto_conf_enabled: log_str.write('True') else: log_str.write('False') log_str.write(' ') if self.netconf_enabled_status is not None: log_str.write('netconf_enabled_status = ') if self.netconf_enabled_status: log_str.write('True') else: log_str.write('False') log_str.write(' ') if self.last_commit_time is not None: log_str.write('last_commit_time = ') log_str.write(self.last_commit_time) log_str.write(' ') if self.last_commit_duration is not None: log_str.write('last_commit_duration = ') log_str.write(self.last_commit_duration) log_str.write(' ') if self.commit_status_message is not None: log_str.write('commit_status_message = ') log_str.write(self.commit_status_message) log_str.write(' ') if self.total_commits_sent_since_up is not None: log_str.write('total_commits_sent_since_up = ') log_str.write(str(self.total_commits_sent_since_up)) log_str.write(' ') return log_str.getvalue() def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) def __eq__(self, other): return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) class UvePhysicalRouterConfigTrace(sandesh_base.SandeshUVE): thrift_spec = ( None, # 0 (1, TType.STRUCT, 'data', (UvePhysicalRouterConfig, UvePhysicalRouterConfig.thrift_spec), None, ), # 1 ) def __init__(self, data=None, table=None, sandesh=sandesh_base.sandesh_global): sandesh_base.SandeshUVE.__init__(self) self.data = data self._scope = sandesh.scope() self._module = sandesh.module() self._source = sandesh.source_id() self._node_type = sandesh.node_type() self._instance_id = sandesh.instance_id() self._seqnum = 0 self._timestamp = UTCTimestampUsec() self._versionsig = 147236693 self._hints = 0 | SANDESH_KEY_HINT if table is not None: self.data._table = table def update_uve(self, tdata): if self.data.name is not None: tdata.name = self.data.name if self.data.deleted is not None: tdata.deleted = self.data.deleted if self.data.ip_address is not None: tdata.ip_address = self.data.ip_address if self.data.connected_bgp_router is not None: tdata.connected_bgp_router = self.data.connected_bgp_router if self.data.product_info is not None: tdata.product_info = self.data.product_info if self.data.auto_conf_enabled is not None: tdata.auto_conf_enabled = self.data.auto_conf_enabled if self.data.netconf_enabled_status is not None: tdata.netconf_enabled_status = self.data.netconf_enabled_status if self.data.last_commit_time is not None: tdata.last_commit_time = self.data.last_commit_time if self.data.last_commit_duration is not None: tdata.last_commit_duration = self.data.last_commit_duration if self.data.commit_status_message is not None: tdata.commit_status_message = self.data.commit_status_message if self.data.total_commits_sent_since_up is not None: tdata.total_commits_sent_since_up = self.data.total_commits_sent_since_up return tdata def log(self, trace=False): log_str = cStringIO.StringIO() if trace: log_str.write(str(self._timestamp)) log_str.write(' ') log_str.write('UvePhysicalRouterConfigTrace: ') if self.data is not None: log_str.write('data = ') log_str.write('<< ') log_str.write(self.data.log()) log_str.write('>>') log_str.write(' ') return log_str.getvalue() def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) return -1 read_cnt = 0 (length, sandesh_name) = iprot.readSandeshBegin() if length < 0: return -1 read_cnt += length while True: (length, fname, ftype, fid) = iprot.readFieldBegin() if length < 0: return -1 read_cnt += length if ftype == TType.STOP: break if fid == 1: if ftype == TType.STRUCT: self.data = UvePhysicalRouterConfig() read_cnt += self.data.read(iprot) else: iprot.skip(ftype) else: iprot.skip(ftype) length = iprot.readFieldEnd() if length < 0: return -1 read_cnt += length length = iprot.readSandeshEnd() if length < 0: return -1 read_cnt += length return read_cnt def write(self, oprot): if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return 0 if oprot.writeSandeshBegin('UvePhysicalRouterConfigTrace') < 0: return -1 if self.data is not None: annotations = {} if oprot.writeFieldBegin('data', TType.STRUCT, 1, annotations) < 0: return -1 if self.data.write(oprot) < 0: return -1 if oprot.writeFieldEnd() < 0: return -1 if oprot.writeFieldStop() < 0: return -1 if oprot.writeSandeshEnd() < 0: return -1 return 0 def validate(self): return def compare(self, other): if not isinstance(other, self.__class__): return False if self.data != other.data: return False return True def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) def __eq__(self, other): return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) _SANDESH_REQUEST_LIST = [ ] _SANDESH_UVE_LIST = [ 'UvePhysicalRouterConfigTrace', ] _SANDESH_UVE_DATA_LIST = [ 'UvePhysicalRouterConfig', ] _SANDESH_ALARM_LIST = [ ] _SANDESH_ALARM_DATA_LIST = [ ]