Exemple #1
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
         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:
             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
Exemple #2
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