Ejemplo n.º 1
0
 def self_verify(self):
     om_output("verifying the tile %s"%self._short())
     settings.exam_stack_push(self)
     for f in self.facets:
         if not f.self_verify():
             om_err_output("fail to verify %s"%self._short())
             return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 2
0
 def self_verify(self):
     om_output("verify view name %s"%self.name)
     settings.exam_stack_push(self)
     for t in self.tiles:
         if not t.self_verify():
             om_err_output("fail to verify %s"%self._short())
             #return False
     settings.exam_stack_pop()
     om_output("complete verifying view %s"%self.name)
     return True
Ejemplo n.º 3
0
 def self_verify(self):
     om_output("verify view name %s" % self.name)
     settings.exam_stack_push(self)
     for t in self.tiles:
         if not t.self_verify():
             om_err_output("fail to verify %s" % self._short())
             #return False
     settings.exam_stack_pop()
     om_output("complete verifying view %s" % self.name)
     return True
Ejemplo n.º 4
0
 def self_verify_basic(self):
     om_output("Basic verify view name %s"%self.name)
     settings.exam_stack_push(self)
     has_false = False
     for t in self.tiles:
         if not t.self_verify_basic():
             om_err_output("fail to basic verify %s"%self._short())
             has_false = True
             #return False
     settings.exam_stack_pop()
     om_output("complete basic verified view %s"%self.name)
     
     return not has_false
Ejemplo n.º 5
0
    def self_verify_basic(self):
        om_output("Basic verify view name %s" % self.name)
        settings.exam_stack_push(self)
        has_false = False
        for t in self.tiles:
            if not t.self_verify_basic():
                om_err_output("fail to basic verify %s" % self._short())
                has_false = True
                #return False
        settings.exam_stack_pop()
        om_output("complete basic verified view %s" % self.name)

        return not has_false
Ejemplo n.º 6
0
 def self_verify(self):
     om_output("verify the tile %s"%self._short())
     settings.exam_stack_push(self)
     for f in self.facets:
         if not f.self_verify():
             om_err_output("fail to verify %s"%self._short())
             # note currently there is only on facet in one tile
             # and we can return when we found an error,
             # if you want to check all the facet, and return together
             # just do not return here
             settings.exam_stack_pop()
             return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 7
0
 def self_verify(self):
     om_output("verify the tile %s" % self._short())
     settings.exam_stack_push(self)
     for f in self.facets:
         if not f.self_verify():
             om_err_output("fail to verify %s" % self._short())
             # note currently there is only on facet in one tile
             # and we can return when we found an error,
             # if you want to check all the facet, and return together
             # just do not return here
             settings.exam_stack_pop()
             return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 8
0
    def self_verify_basic(self):
        om_output("Basic verify the Facet %s" % self._short())
        settings.exam_stack_push(self)
        if not self.pic_verify():
            settings.exam_stack_pop()
            return False
        api = api_module.api_mapping[self.typecode]
        if self.typecode not in api_module.module_mapping:
            om_err_output(
                "Facet::self_verify_basic() no api module defined for "
                "typecode %s" % self.typecode)
            settings.exam_stack_pop()
            return False
        # get class type related to the typecode
        cl = api_module.module_mapping[self.typecode]
        m = cl(self.id)
        if not m.valid():
            om_err_output("apimodule is not valid for typecode %s" %
                          self.typecode)
            settings.exam_stack_pop()
            return False
        if not m.verify_basic():
            for ecode, emsgs in m.last_err.items():
                om_err_output("fail to basic verify %s" % (self._short()))
                alarm_msg = ""
                for m in emsgs:
                    om_err_output("meet error %s, %s" % (ecode, m))
                    alarm_msg += m + "\n"
                alm = None
                # check every error code for the api module, and send related
                # alarm according to the severity level
                alarm_msg += "\nlocation:\n%s" % settings.show_exam_stack()
                if ecode == ErrCode.RESOURCE_CANT_ACCESS:
                    alarm(ALARM_LEVEL.CRITICAL, ALM_NETWORK_ISSUE, alarm_msg)
                elif ecode == ErrCode.RESOURCE_OFFLINE:
                    alarm(ALARM_LEVEL.CRITICAL, ALM_MEDIA_OFFLINE, alarm_msg)
                elif ecode == ErrCode.DATA_INVALID:
                    alarm(ALARM_LEVEL.HIGH, ALM_MEDIA_DATA_INVALID, alarm_msg)
                elif ecode == ErrCode.BAD_LIST_VIEW_MEDIA or \
                         ecode == ErrCode.BAD_LIST_VIEW_IMAGE:
                    alarm(ALARM_LEVEL.HIGH, ALM_CATEGORY_HAS_BAD_MEDIAS,
                          alarm_msg)
                else:
                    alarm(ALARM_LEVEL.NORMAL, ALM_BASIC, alarm_msg)

            settings.exam_stack_pop()
            return False
        settings.exam_stack_pop()
        return True
Ejemplo n.º 9
0
 def self_verify_basic(self):
     om_output("Basic verify the Facet %s"%self._short())
     settings.exam_stack_push(self)
     if not self.pic_verify():
         settings.exam_stack_pop()
         return False
     api = api_module.api_mapping[self.typecode]
     if self.typecode not in api_module.module_mapping:
         om_err_output("Facet::self_verify_basic() no api module defined for "
                       "typecode %s"%self.typecode)
         settings.exam_stack_pop()
         #return False
         # currently the not support api module need not return fail
         return True
     # get class type related to the typecode
     cl = api_module.module_mapping[self.typecode]
     m = cl(self.id)
     if not m.valid():
         om_err_output("apimodule is not valid for typecode %s"%self.typecode)
         settings.exam_stack_pop()
         return False
     if not m.verify_basic():
         for ecode, emsgs in m.last_err.items():
             om_err_output("fail to basic verify %s"%(self._short()))
             alarm_msg = ""
             for m in emsgs:
                 om_err_output("meet error %s, %s"%(ecode, m))
                 alarm_msg += m + "\n"
             alm = None
             # check every error code for the api module, and send related
             # alarm according to the severity level
             alarm_msg += "\nlocation:\n%s"%settings.show_exam_stack()
             if ecode == ErrCode.RESOURCE_CANT_ACCESS:
                 alarm(ALARM_LEVEL.CRITICAL, ALM_NETWORK_ISSUE, alarm_msg)
             elif ecode == ErrCode.RESOURCE_OFFLINE:
                 alarm(ALARM_LEVEL.CRITICAL, ALM_MEDIA_OFFLINE, alarm_msg)
             elif ecode == ErrCode.DATA_INVALID:
                 alarm(ALARM_LEVEL.HIGH, ALM_MEDIA_DATA_INVALID, alarm_msg)
             elif ecode == ErrCode.BAD_LIST_VIEW_MEDIA or \
                      ecode == ErrCode.BAD_LIST_VIEW_IMAGE:
                 alarm(ALARM_LEVEL.HIGH, ALM_CATEGORY_HAS_BAD_MEDIAS, alarm_msg)
             else:
                 alarm(ALARM_LEVEL.NORMAL, ALM_BASIC, alarm_msg)
                 
         settings.exam_stack_pop()
         return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 10
0
 def self_verify_basic(self):
     """ quickly verify the basic information, return False if found
     any problem """
     om_output("Basic verify the tile %s"%self._short())
     settings.exam_stack_push(self)
     for f in self.facets:
         if not f.self_verify_basic():
             om_err_output("fail to verify %s"%self._short())
             settings.exam_stack_pop()
             # note currently there is only on facet in one tile
             # and we can return when we found an error,
             # if you want to check all the facet, and return together
             # just do not return here
             return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 11
0
 def self_verify_basic(self):
     """ quickly verify the basic information, return False if found
     any problem """
     om_output("Basic verify the tile %s" % self._short())
     settings.exam_stack_push(self)
     for f in self.facets:
         if not f.self_verify_basic():
             om_err_output("fail to verify %s" % self._short())
             settings.exam_stack_pop()
             # note currently there is only on facet in one tile
             # and we can return when we found an error,
             # if you want to check all the facet, and return together
             # just do not return here
             return False
     settings.exam_stack_pop()
     return True
Ejemplo n.º 12
0
 def self_verify(self):
     om_output("verifying the Facet %s"%self._short())
     settings.exam_stack_push(self)
     if not self.pic_verify():
         return False
     api = api_module.api_mapping[self.typecode]
     if self.typecode not in api_module.module_mapping:
         om_err_output("Facet::self_verify() no api module defined for typecode %s"%
                       self.typecode)
         return False
     
     cl = api_module.module_mapping[self.typecode]
     m = cl(self.id)
     if not m.valid():
         om_err_output("apimodule is not valid for typecode %s"%self.typecode)
         return False
     if not m.verify():
         om_err_output("fail to verify %s"%(self._short()))
         return False
     settings.exam_stack_pop()
     return True