當前位置: 首頁>>代碼示例>>Python>>正文


Python SandeshHttp.create_http_response方法代碼示例

本文整理匯總了Python中sandesh_http.SandeshHttp.create_http_response方法的典型用法代碼示例。如果您正苦於以下問題:Python SandeshHttp.create_http_response方法的具體用法?Python SandeshHttp.create_http_response怎麽用?Python SandeshHttp.create_http_response使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sandesh_http.SandeshHttp的用法示例。


在下文中一共展示了SandeshHttp.create_http_response方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: send

# 需要導入模塊: from sandesh_http import SandeshHttp [as 別名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 別名]
 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
開發者ID:nischalsheth,項目名稱:contrail-sandesh,代碼行數:31,代碼來源:sandesh_base.py

示例2: send

# 需要導入模塊: from sandesh_http import SandeshHttp [as 別名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 別名]
 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
開發者ID:Juniper,項目名稱:contrail-sandesh,代碼行數:56,代碼來源:sandesh_base.py

示例3: send_trace

# 需要導入模塊: from sandesh_http import SandeshHttp [as 別名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 別名]
 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
開發者ID:th3architect,項目名稱:contrail-sandesh,代碼行數:18,代碼來源:sandesh_base.py

示例4: send_trace

# 需要導入模塊: from sandesh_http import SandeshHttp [as 別名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 別名]
 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
開發者ID:nischalsheth,項目名稱:contrail-sandesh,代碼行數:19,代碼來源:sandesh_base.py

示例5: send

# 需要導入模塊: from sandesh_http import SandeshHttp [as 別名]
# 或者: from sandesh_http.SandeshHttp import create_http_response [as 別名]
 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
開發者ID:th3architect,項目名稱:contrail-sandesh,代碼行數:39,代碼來源:sandesh_base.py


注:本文中的sandesh_http.SandeshHttp.create_http_response方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。