예제 #1
0
 def computeCurrentValue(self, strValue):
     if strValue != None:
         if self.format == Format.ASCII:
             strCurrentValue = str(strValue)
             binCurrentValue = TypeConvertor.string2bin(strValue, 'big')
         elif self.format == Format.HEX:
             hexVal = TypeConvertor.ipToNetzobRaw(strValue)
             if hexVal != None:
                 strCurrentValue = str(strValue)
                 binCurrentValue = TypeConvertor.netzobRawToBitArray(hexVal)
             else:
                 strCurrentValue = str("None:Error")
                 binCurrentValue = None
         self.currentValue = (binCurrentValue, strCurrentValue)
     else:
         self.currentValue = None
예제 #2
0
    def computeCurrentValue(self, strValue):
        """computeCurrentValue:
                Compute a couple of binary and string values for the current variable.

                @type strValue: string
                @param strValue: a string value proposed as default value for this variable, must be a "real" ip address declared in ASCII like : "192.168.0.10".
        """
        if strValue is not None:
            if self.format == Format.ASCII:
                strCurrentValue = str(strValue)
                binCurrentValue = TypeConvertor.string2bin(strValue, 'big')
            elif self.format == Format.HEX:
                hexVal = TypeConvertor.ipToNetzobRaw(strValue)
                if hexVal is not None:
                    strCurrentValue = str(strValue)
                    binCurrentValue = TypeConvertor.netzobRawToBitArray(hexVal)
                else:
                    strCurrentValue = str("None:Error")
                    binCurrentValue = None
            self.currentValue = (binCurrentValue, strCurrentValue)
        else:
            self.currentValue = None
예제 #3
0
    def computeCurrentValue(self, strValue):
        """computeCurrentValue:
                Compute a couple of binary and string values for the current variable.

                @type strValue: string
                @param strValue: a string value proposed as default value for this variable, must be a "real" ip address declared in ASCII like : "192.168.0.10".
        """
        if strValue is not None:
            if self.format == Format.ASCII:
                strCurrentValue = str(strValue)
                binCurrentValue = TypeConvertor.string2bin(strValue, "big")
            elif self.format == Format.HEX:
                hexVal = TypeConvertor.ipToNetzobRaw(strValue)
                if hexVal is not None:
                    strCurrentValue = str(strValue)
                    binCurrentValue = TypeConvertor.netzobRawToBitArray(hexVal)
                else:
                    strCurrentValue = str("None:Error")
                    binCurrentValue = None
            self.currentValue = (binCurrentValue, strCurrentValue)
        else:
            self.currentValue = None