def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 if isseq is True: self._seqnum = seqno else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh._logger.error('Failed to update sandesh in cache. ' \ + self.log()) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 if isseq is True: self._seqnum = seqno else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: return -1 self._seqnum = self.next_seqnum() uve_type_map.update_uve(self) self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global, level=SandeshLevel.SYS_NOTICE): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 if self._type == SandeshType.UVE and \ self._level == SandeshLevel.INVALID: self._level = level if isseq is True: self._seqnum = seqno self._hints |= SANDESH_SYNC_HINT else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: sandesh._logger.error('sandesh uve <%s> not registered %s'\ % (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map))) sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh._logger.error('Failed to update sandesh in cache') sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0 or \ self._context.find('https://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: if sandesh.is_sending_all_messages_disabled(): sandesh.drop_tx_sandesh( self, SandeshTxDropReason.SendingDisabled, self.level()) return -1 # SandeshUVE has an implicit send level of SandeshLevel.SYS_UVE # which is irrespective of the level set by the user in the # send. This is needed so that the send queue does not grow # unbounded. Once the send queue's sending level reaches # SandeshLevel.SYS_UVE we will reset the connection to the # collector to initiate resync of the UVE cache if SandeshLevel.SYS_UVE >= sandesh.send_level(): sandesh._client.close_sm_session() sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global, level=SandeshLevel.SYS_NOTICE): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 if self._type == SandeshType.UVE and \ self._level == SandeshLevel.INVALID: self._level = level if isseq is True: self._seqnum = seqno self._hints |= SANDESH_SYNC_HINT else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: sandesh._logger.error('sandesh uve <%s> not registered %s'\ % (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map))) sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh._logger.error('Failed to update sandesh in cache') sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0 or \ self._context.find('https://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: if sandesh.is_sending_all_messages_disabled(): sandesh.drop_tx_sandesh(self, SandeshTxDropReason.SendingDisabled, self.level()) return -1 # SandeshUVE has an implicit send level of SandeshLevel.SYS_UVE # which is irrespective of the level set by the user in the # send. This is needed so that the send queue does not grow # unbounded. Once the send queue's sending level reaches # SandeshLevel.SYS_UVE we will reset the connection to the # collector to initiate resync of the UVE cache if SandeshLevel.SYS_UVE >= sandesh.send_level(): sandesh._client.close_sm_session() sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global, level=SandeshLevel.SYS_NOTICE): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 if self._type == SandeshType.UVE and \ self._level == SandeshLevel.INVALID: self._level = level if isseq is True: self._seqnum = seqno self._hints |= SANDESH_SYNC_HINT else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: sandesh._logger.error('sandesh uve <%s> not registered %s'\ % (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map))) sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh._logger.error('Failed to update sandesh in cache') sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0 or \ self._context.find('https://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: if sandesh.is_sending_all_messages_disabled(): sandesh.drop_tx_sandesh( self, SandeshTxDropReason.SendingDisabled, self.level()) return -1 sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh.msg_stats().update_tx_stats( self.__class__.__name__, 0, SandeshTxDropReason.ValidationFailed) sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 if isseq is True: self._seqnum = seqno self._hints |= SANDESH_SYNC_HINT else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: sandesh._logger.error('sandesh uve <%s> not registered: %s'\ % (self.__class__.__name__, self.log())) sandesh.msg_stats().update_tx_stats( self.__class__.__name__, 0, SandeshTxDropReason.ValidationFailed) return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh.msg_stats().update_tx_stats( self.__class__.__name__, 0, SandeshTxDropReason.ValidationFailed) sandesh._logger.error('Failed to update sandesh in cache. ' + self.log()) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0
def send_trace(self, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0 or \ self._context.find('https://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 sandesh.send_sandesh(self) return 0
def send_trace(self, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 sandesh.send_sandesh(self) return 0
def send_trace(self, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 sandesh.send_sandesh(self) return 0
def send_trace(self, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 sandesh.send_sandesh(self) return 0
def response(self, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh.msg_stats().update_tx_stats( self.__class__.__name__, 0, SandeshTxDropReason.ValidationFailed) sandesh._logger.error('sandesh "%s" validation failed [%s]' % (self.__class__.__name__, e)) return -1 self._context = context self._more = more self._seqnum = self.next_seqnum() if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 sandesh.send_sandesh(self) return 0
def send(self, isseq=False, seqno=0, context='', more=False, sandesh=sandesh_global): try: self.validate() except e: sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 if isseq is True: self._seqnum = seqno self._hints |= SANDESH_SYNC_HINT else: uve_type_map = sandesh._uve_type_maps.get_uve_type_map( self.__class__.__name__) if uve_type_map is None: sandesh._logger.error('sandesh uve <%s> not registered %s'\ % (self.__class__.__name__, str(sandesh._uve_type_maps._uve_global_map))) sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._seqnum = self.next_seqnum() if not uve_type_map.update_uve(self): sandesh._logger.error('Failed to update sandesh in cache') sandesh.drop_tx_sandesh(self, SandeshTxDropReason.ValidationFailed) return -1 self._context = context self._more = more if self._context.find('http://') == 0: SandeshHttp.create_http_response(self, sandesh) else: if self.handle_test(sandesh): return 0 if sandesh._client: sandesh._client.send_uve_sandesh(self) else: sandesh._logger.debug(self.log()) return 0