Ejemplo n.º 1
0
    def _doOperation(self, *args, **kargs):

        result = None

        if not self.__retry:
            # Get the database name
            self.__limitsFile = args[0]

            if type(self.__limitsFile) != str:
                raise SyntaxException("Expected a limits file URL")
            if not "://" in self.__limitsFile:
                raise SyntaxException("Limits file name must have URI format")
            idx = self.__limitsFile.find("://")
            self.__prefix = self.__limitsFile[0:idx]
        else:
            self.__retry = False

        idx = self.__limitsFile.find("//")
        toShow = self.__limitsFile[idx + 2:]
        self._notifyValue("Limits File", repr(toShow), NOTIF_STATUS_PR,
                          "Loading")
        self._write("Loading limits file " + repr(toShow))

        result = REGISTRY['TM'].loadLimits(self.__limitsFile,
                                           config=self.getConfig())

        return [False, result, NOTIF_STATUS_OK, ""]
Ejemplo n.º 2
0
 def checkConfig(self, globals, locals):
     for key in self.__config:
         try:
             object = eval(key, globals, locals)
         except:
             raise SyntaxException("Unknown modifier: " + repr(key))
         if type(object) != str:
             raise SyntaxException("Not a modifier: " + repr(key))
Ejemplo n.º 3
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 0 and len(args) != 1:
            raise SyntaxException(
                "This function does not support so many positional arguments")

        # Syntax: CompareMemoryImages( Type=, Image=, Begin=, End=, Source=, others
        # Syntax: CompareMemoryImages( ['Image1', 'Image2'], Type=, Begin=, End=, Source=... )

        if len(args) == 1:
            if type(args[0]) != list or len(args[0]) != 2:
                raise SyntaxException(
                    "Expected a list with two image names as unique positional argument"
                )
            self.__image1 = args[0][0]
            self.__image2 = args[0][1]
        else:
            if not self.hasConfig(Image):
                raise SyntaxException(
                    "Expected an 'Image' modifier or a positional argument indicating the memory image names"
                )
            image = self.getConfig(Image)
            if type(image) != list or len(image) != 2:
                raise SyntaxException(
                    "Expected a list with two image names as the value for the Image modifier"
                )
            self.__image1 = image[0]
            self.__image2 = image[1]

        if type(self.__image1) != str or type(self.__image2) != str:
            raise SyntaxException("Expected strings for the image names")

        if not self.hasConfig(Type):
            raise SyntaxException(
                "Expected a 'Type' modifier indicating the type of reports")
        self.__type = self.getConfig(Type)

        if not self.hasConfig(Source):
            raise SyntaxException(
                "Expected a 'Source' modifier indicating the data source")
        self.__source = self.getConfig(Source)

        if not self.hasConfig(Begin):
            raise SyntaxException(
                "Expected a 'Begin' modifier indicating the memory range start"
            )
        self.__begin = self.getConfig(Begin)

        if not self.hasConfig(End):
            raise SyntaxException(
                "Expected an 'End' modifier indicating the memory range end")
        self.__end = self.getConfig(End)

        if self.hasConfig(ValueFormat):
            format = self.getConfig(ValueFormat)
            if not format in [RAW, ENG]:
                raise SyntaxException("Invalid format specified: '" +
                                      str(format) + "'")
Ejemplo n.º 4
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]

        self.__limits = {}
        if self.hasConfig(Limits):
            llist = self.getConfig(Limits)
            if type(llist) == list:
                if len(llist) == 2:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[0]
                    self.__limits[HiRed] = llist[1]
                    self.__limits[HiYel] = llist[1]
                elif len(llist) == 4:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[1]
                    self.__limits[HiRed] = llist[2]
                    self.__limits[HiYel] = llist[3]
                else:
                    raise SyntaxException("Malformed limit definition")
            elif type(llist) == dict:
                self.__limits = llist
            else:
                raise SyntaxException("Expected list or dictionary")
        else:
            if self.hasConfig(LoRed):
                self.__limits[LoRed] = self.getConfig(LoRed)
            if self.hasConfig(LoYel):
                self.__limits[LoYel] = self.getConfig(LoYel)
            if self.hasConfig(HiRed):
                self.__limits[HiRed] = self.getConfig(HiRed)
            if self.hasConfig(HiYel):
                self.__limits[HiYel] = self.getConfig(HiYel)

            if self.hasConfig(LoBoth):
                self.__limits[LoYel] = self.getConfig(LoBoth)
                self.__limits[LoRed] = self.getConfig(LoBoth)
            if self.hasConfig(HiBoth):
                self.__limits[HiYel] = self.getConfig(HiBoth)
                self.__limits[HiRed] = self.getConfig(HiBoth)
            if self.hasConfig(Expected):
                self.__limits[Expected] = self.getConfig(Expected)
            if self.hasConfig(Nominal):
                self.__limits[Nominal] = self.getConfig(Nominal)
            if self.hasConfig(Warning):
                self.__limits[Warning] = self.getConfig(Warning)
            if self.hasConfig(Error):
                self.__limits[Error] = self.getConfig(Error)
            if self.hasConfig(Ignore):
                self.__limits[Ignore] = self.getConfig(Ignore)

        if len(self.__limits) == 0:
            raise SyntaxException("No limits given")

            # Store information for possible failures
        self.setFailureInfo("TM", self.__limits)
 def _doPreOperation(self, *args, **kargs):
     from spell.lib.adapter.tm_item import TmItemClass
     if len(args) == 0:
         raise SyntaxException("No parameter name given")
     # Get the TM parameter name/item
     self.__parameter = args[0]
     if type(self.__parameter) != str:
         if not isinstance(self.__parameter, TmItemClass):
             raise SyntaxException("Expected a TM item or name")
Ejemplo n.º 6
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 0 and len(args) != 1:
            raise SyntaxException(
                "This function does not support so many positional arguments")

        # Syntax: MemoryLookup( Name=, Source=, Type= others )
        # Syntax: MemoryLookup( 'NAME', Image=, Source=, Type= others )

        if len(args) == 1:
            self.__name = args[0]
        else:
            if not self.hasConfig(Name):
                if not self.hasConfig(Address):
                    raise SyntaxException(
                        "Expected a 'Name/Address' modifier indicating the memory resource name/address"
                    )
                else:
                    self.__address = self.getConfig(Address)
                    if type(self.__address) != int:
                        raise SyntaxException(
                            "Expected an integer for the address")
            else:
                self.__name = self.getConfig(Name)
                if type(self.__name) != str:
                    raise SyntaxException(
                        "Expected a string for the resource name")

        if not self.hasConfig(Type):
            raise SyntaxException(
                "Expected a 'Type' modifier indicating the type of reports")
        self.__type = self.getConfig(Type)

        if self.__type == 'ADA' and self.__name == None:
            raise SyntaxException("Please provide ADA variable name")
        elif (self.__type == 'Logical_Address'
              or self.__type == 'Physical_Address') and self.__address == None:
            raise SyntaxException("Please provide hex address")

        if not self.hasConfig(Image):
            raise SyntaxException(
                "Expected a 'Image' modifier indicating the image reference")
        self.__image = self.getConfig(Image)

        if not self.hasConfig(Source):
            raise SyntaxException(
                "Expected a 'Source' modifier indicating the data source")
        self.__source = self.getConfig(Source)

        if self.hasConfig(ValueFormat):
            format = self.getConfig(ValueFormat)
            if not format in [RAW, ENG]:
                raise SyntaxException("Invalid format specified: '" +
                                      str(format) + "'")
Ejemplo n.º 7
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]
        self.__property = args[1] if (len(args) == 2) else None

        if self.__property not in self.__properties:
            raise SyntaxException("No valid property")

            # Store information for possible failures
        self.setFailureInfo("TM", self.__parameter)
Ejemplo n.º 8
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]

        self.__limits = {}
        if self.hasConfig(Limits):
            llist = self.getConfig(Limits)
            if type(llist) == list:
                if len(llist) == 2:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[0]
                    self.__limits[HiRed] = llist[1]
                    self.__limits[HiYel] = llist[1]
                elif len(llist) == 4:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[1]
                    self.__limits[HiRed] = llist[2]
                    self.__limits[HiYel] = llist[3]
                else:
                    raise SyntaxException("Malformed limit definition")
            elif type(llist) == dict:
                self.__limits = llist
            else:
                raise SyntaxException("Expected list or dictionary")
        else:
            if self.hasConfig(LoRed):
                self.__limits[LoRed] = self.getConfig(LoRed)
            if self.hasConfig(LoYel):
                self.__limits[LoYel] = self.getConfig(LoYel)
            if self.hasConfig(HiRed):
                self.__limits[HiRed] = self.getConfig(HiRed)
            if self.hasConfig(HiYel):
                self.__limits[HiYel] = self.getConfig(HiYel)

            if self.hasConfig(LoBoth):
                self.__limits[LoYel] = self.getConfig(LoBoth)
                self.__limits[LoRed] = self.getConfig(LoBoth)
            if self.hasConfig(HiBoth):
                self.__limits[HiYel] = self.getConfig(HiBoth)
                self.__limits[HiRed] = self.getConfig(HiBoth)

        for prop in ["LIMIT_EN", "LIMIT_EVENT"]:
            if self.hasConfig(prop):
                self.__properties[prop] = self.getConfig(prop)

        if len(self.__limits) > 0:
            self.__properties[Limits] = self.__limits

            # Store information for possible failures
        self.setFailureInfo("TM", self.__parameter)
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")
        # Perform the verification.
        self.__useConfig = {}
        self.__useConfig.update(self._config)

        self.__parameter = args[0]

        self.__limits = {}
        if Limits in self.__useConfig:
            llist = self.__useConfig.get(Limits)
            if type(llist) == list:
                if len(llist) == 2:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[0]
                    self.__limits[HiRed] = llist[1]
                    self.__limits[HiYel] = llist[1]
                elif len(llist) == 4:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[1]
                    self.__limits[HiRed] = llist[2]
                    self.__limits[HiYel] = llist[3]
                else:
                    raise SyntaxException("Malformed limit definition")
            elif type(llist) == dict:
                self.__limits = llist
            else:
                raise SyntaxException("Expected list or dictionary")
        else:
            if LoRed in self.__useConfig:
                self.__limits[LoRed] = self.__useConfig.get(LoRed)
            if LoYel in self.__useConfig:
                self.__limits[LoYel] = self.__useConfig.get(LoYel)
            if HiRed in self.__useConfig:
                self.__limits[HiRed] = self.__useConfig.get(HiRed)
            if HiYel in self.__useConfig:
                self.__limits[HiYel] = self.__useConfig.get(HiYel)
            if LoBoth in self.__useConfig:
                self.__limits[LoYel] = self.__useConfig.get(LoBoth)
                self.__limits[LoRed] = self.__useConfig.get(LoBoth)
            if HiBoth in self.__useConfig:
                self.__limits[HiYel] = self.__useConfig.get(HiBoth)
                self.__limits[HiRed] = self.__useConfig.get(HiBoth)
            if Expected in self.__useConfig:
                self.__limits[Expected] = self.__useConfig.get(Expected)

        if len(self.__limits) == 0:
            raise SyntaxException("No limits given")
Ejemplo n.º 10
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 2:
            raise SyntaxException(
                "Expected a baseband name and a parameter name")

        if type(args[0]) != str:
            raise SyntaxException("Expected a baseband name as first argument")

        if type(args[1]) != str:
            raise SyntaxException(
                "Expected a parameter name as second argument")

        self.__bbe = args[0]
        self.__param = args[1]
Ejemplo n.º 11
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 2:
            raise SyntaxException(
                "Expected a baseband name and an antenna name")

        if type(args[0]) != str:
            raise SyntaxException(
                "Expected a baseband name and an antenna name")
        if type(args[1]) != str:
            raise SyntaxException(
                "Expected a baseband name and an antenna name")

        self.__bbe = args[0]
        self.__antenna = args[1]
Ejemplo n.º 12
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]

        self.__limits = {}
        if self.hasConfig(Limits):
            llist = self.getConfig(Limits)
            if type(llist) == list:
                if len(llist) == 2:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[0]
                    self.__limits[HiRed] = llist[1]
                    self.__limits[HiYel] = llist[1]
                elif len(llist) == 4:
                    self.__limits[LoRed] = llist[0]
                    self.__limits[LoYel] = llist[1]
                    self.__limits[HiRed] = llist[2]
                    self.__limits[HiYel] = llist[3]
                else:
                    raise SyntaxException("Malformed limit definition")
            elif type(llist) == dict:
                self.__limits = llist
            else:
                raise SyntaxException("Expected list or dictionary")
        else:
            if self.hasConfig(LoRed):
                self.__limits[LoRed] = self.getConfig(LoRed)
            if self.hasConfig(LoYel):
                self.__limits[LoYel] = self.getConfig(LoYel)
            if self.hasConfig(HiRed):
                self.__limits[HiRed] = self.getConfig(HiRed)
            if self.hasConfig(HiYel):
                self.__limits[HiYel] = self.getConfig(HiYel)

            if self.hasConfig(LoBoth):
                self.__limits[LoYel] = self.getConfig(LoBoth)
                self.__limits[LoRed] = self.getConfig(LoBoth)
            if self.hasConfig(HiBoth):
                self.__limits[HiYel] = self.getConfig(HiBoth)
                self.__limits[HiRed] = self.getConfig(HiBoth)
            if self.hasConfig(Expected):
                self.__limits[Expected] = self.getConfig(Expected)

        if len(self.__limits) == 0:
            raise SyntaxException("No limits given")
Ejemplo n.º 13
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No limits file URL given")

        self.__limitsFile = args[0]

        # Store information for possible failures
        self.setFailureInfo("TM", self.__limitsFile)
Ejemplo n.º 14
0
    def _doPreOperation(self, *args, **kargs):
        from spell.lib.adapter.tm_item import TmItemClass
        if len(args) == 0:
            raise SyntaxException("No parameter name given")

        # Check correctness
        param = args[0]
        if type(param) != str and not isinstance(param, TmItemClass):
            raise SyntaxException("Expected a TM item or name")

        self.__parameter = param

        # Store the extended flag if any
        self.__extended = (self.getConfig(Extended) == True)

        # Store information for possible failures
        self.setFailureInfo("TM", self.__parameter)
Ejemplo n.º 15
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No limits file URL given")

        self.__useConfig = {}
        self.__useConfig.update(self._config)

        self.__limitsFile = args[0]
Ejemplo n.º 16
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]
        if (len(args) == 2):
            self.__property = args[1]
        else:
            self.__property = "ALL"
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")
        # Perform the verification.
        self.__useConfig = {}
        self.__useConfig.update(self._config)

        self.__parameter = args[0]
        self.__property = args[1]
Ejemplo n.º 18
0
    def _doPreOperation(self, *args, **kargs):
        from spell.lib.adapter.tm_item import TmItemClass
        if len(args) == 0:
            raise SyntaxException("No parameter name given")

        # Check correctness
        param = args[0]
        if type(param) != str:
            if not isinstance(param, TmItemClass):
                raise SyntaxException("Expected a TM item or name")
            # It is a TmItemClass, store it
            self.__parameter = param
        else:
            # Create the parameter and store it
            self.__parameter = REGISTRY['TM'][param]

        # Store the extended flag if any
        self.__extended = (self.getConfig(Extended) == True)
Ejemplo n.º 19
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) == 0:
            raise SyntaxException(
                "Expected at least a baseband and an antenna name (no arguments given)"
            )

        usingStrings = False
        usingLists = False
        if type(args[0]) == str:
            usingStrings = True
            if len(args) != 2:
                raise SyntaxException(
                    "Expected a baseband and an antenna name (" +
                    str(len(args)) + " arguments given)")
        elif type(args[0]) == list:
            usingLists = True
        else:
            raise SyntaxException(
                "Expected a baseband name or a list as first argument")

        count = 0
        for element in args:
            if usingLists and type(element) != list:
                raise SyntaxException("Inconsistent argument type (" +
                                      str(count) + "), expected a list")
            elif usingLists and len(element) != 2:
                raise SyntaxException("Malformed argument (" + str(count) +
                                      "), expected a list of two elements")
            elif usingStrings and type(element) != str:
                raise SyntaxException("Inconsistent argument type (" +
                                      str(count) + "), expected a string")
            count = count + 1

        if usingStrings:
            self.__bbe = args[0]
            self.__antenna = args[1]
        else:
            self.__bbe = []
            self.__antenna = []
            count = 0
            for element in args:
                if type(element[0]) != str:
                    raise SyntaxException(
                        "Expected a string as baseband name in argument list "
                        + str(count))
                if type(element[1]) != str:
                    raise SyntaxException(
                        "Expected a string as antenna name in argument list " +
                        str(count))
                self.__bbe.append(element[0])
                self.__antenna.append(element[1])
                count = count + 1
Ejemplo n.º 20
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No parameters given")

        self.__parameter = args[0]
        if (len(args) == 2):
            self.__property = args[1]
        else:
            self.__property = "ALL"

            # Store information for possible failures
        self.setFailureInfo("TM", self.__parameter)
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No arguments given")
        self.__useConfig = {}
        self.__useConfig.update(self._config)
        self.__useConfig[Retry] = self.__retry

        # Since args is a tuple we have to convert it to a list for TM.verify
        if len(args) != 1:
            # The case of giving a simple step for verification
            self.__vrfDefinition = [item for item in args]
        else:
            # Givin a step or a step list
            self.__vrfDefinition = args[0]
Ejemplo n.º 22
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) == 0:
            raise SyntaxException("No parameters given")

        # Since args is a tuple we have to convert it to a list
        if len(args) != 1:
            # The case of giving a simple inject definition
            self.__toInject = args[0]
            self.__value = args[1]
            # Modifiers will go in useConfig
        else:
            # Givin an inject list
            self.__toInject = args[0]
Ejemplo n.º 23
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 0 and len(args) != 1:
            raise SyntaxException(
                "This function does not support so many positional arguments")

        # Syntax: GenerateMemoryReport( Type=, Image=, Begin=, End=, Source=, others
        # Syntax: GenerateMemoryReport( 'IMAGE', Type=, Begin=, End=, Source=, others
        if len(args) == 1:
            self.__image = args[0]
        else:
            if not self.hasConfig(Image):
                raise SyntaxException(
                    "Expected an 'Image' modifier or a positional argument indicating the memory image name"
                )
            self.__image = self.getConfig(Image)

        if type(self.__image) != str:
            raise SyntaxException("Expected a string for the image name")

        if not self.hasConfig(Type):
            raise SyntaxException(
                "Expected a 'Type' modifier indicating the type of report")
        self.__type = self.getConfig(Type)

        if not self.hasConfig(Source):
            raise SyntaxException(
                "Expected a 'Source' modifier indicating the data source")
        self.__source = self.getConfig(Source)

        if not self.hasConfig(Begin):
            raise SyntaxException(
                "Expected a 'Begin' modifier indicating the memory range start"
            )
        self.__begin = self.getConfig(Begin)

        if not self.hasConfig(End):
            raise SyntaxException(
                "Expected an 'End' modifier indicating the memory range end")
        self.__end = self.getConfig(End)

        if self.hasConfig(ValueFormat):
            format = self.getConfig(ValueFormat)
            if not format in [RAW, ENG]:
                raise SyntaxException("Invalid format specified: '" +
                                      str(format) + "'")
Ejemplo n.º 24
0
    def _doOperation(self, *args, **kargs):

        self._setActionString(
            ACTION_SKIP,
            "Skip the limits load operation and return success (True)")
        self._setActionString(
            ACTION_CANCEL,
            "Skip the limits load operation and return failure (False)")
        self._setActionString(ACTION_REPEAT,
                              "Repeat the limits load operation")

        result = None

        if not self.__retry:
            # Get the database name
            self.__limitsFile = args[0]

            if type(self.__limitsFile) != str:
                raise SyntaxException("Expected a limits file URL")
            if not "://" in self.__limitsFile:
                raise SyntaxException("Limits file name must have URI format")
            idx = self.__limitsFile.find("://")
            self.__prefix = self.__limitsFile[0:idx]
        else:
            self.__retry = False

        idx = self.__limitsFile.find("//")
        toShow = self.__limitsFile[idx + 2:]
        self._notifyValue("Limits File", repr(toShow), NOTIF_STATUS_PR,
                          "Loading")
        self._write("Loading limits file " + repr(toShow))

        result = REGISTRY['TM'].loadLimits(self.__limitsFile,
                                           config=self.getConfig())

        return [False, result, NOTIF_STATUS_OK, ""]
Ejemplo n.º 25
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) == 0:
            raise SyntaxException(
                "Expected a baseband name, a parameter and a value")

        if type(args[0]) != str:
            raise SyntaxException("Expected a baseband name as first argument")

        usingList = False
        if len(args) == 3:
            if type(args[1]) != str:
                raise SyntaxException(
                    "Expected a parameter name as second argument")
        elif len(args) == 2:
            usingList = True
            if type(args[1]) != list:
                raise SyntaxException(
                    "Expected a list of parameter-value pairs as second argument"
                )
        else:
            raise SyntaxException("Wrong number of arguments given")

        self.__bbe = args[0]

        if usingList:
            self.__param = []
            self.__value = []
            for element in args[1]:
                if type(element) != list:
                    raise SyntaxException(
                        "Expected a list of lists as second argument")
                if len(element) != 2:
                    raise SyntaxException("Malformed parameter-value argument")
                self.__param.append(element[0])
                self.__value.append(element[1])
        else:
            self.__param = args[1]
            self.__value = args[2]
Ejemplo n.º 26
0
    def __init__(self, *args):

        if len(args) == 0:
            raise SyntaxException("Expected at least one list as argument")
        self.__expression = args
Ejemplo n.º 27
0
 def _doPreOperation(self, *args, **kargs):
     if len(args)==0:
         raise SyntaxException("Expected a TM verification list")
     self.__verifyList = args[0]
     if type(self.__verifyList)!=list:
         raise SyntaxException("Expected a TM verification list")
Ejemplo n.º 28
0
    def _doPreOperation(self, *args, **kargs):
        if len(args) == 0:
            raise SyntaxException("No limits file URL given")

        self.__limitsFile = args[0]
Ejemplo n.º 29
0
    def _doPreOperation(self, *args, **kargs):

        if len(args) != 0:
            raise SyntaxException("Expected no arguments")