@ -1950,7 +1950,7 @@ def bgpConfig(
elif ( bgpArg1 == " log-neighbor-changes " ) :
# debugOutput(bgpArg1)
command = command + bgpArg1 f
command = command + bgpArg1
elif ( bgpArg1 == " maxas-limit " ) :
# debugOutput(bgpArg1)
@ -3257,8 +3257,7 @@ def checkSanityofVariable(deviceType, variableId, variableValue):
def getRuleStringForVariable ( deviceType , ruleFile , variableId ) :
retVal = " "
try :
# with open(ruleFile, 'r') as f:
f = open ( errorFile , ' r ' )
with open ( ruleFile , ' r ' ) as f :
for line in f :
# debugOutput(line)
if ( ' : ' in line ) :
@ -3342,7 +3341,7 @@ def validateValueAgainstRule(ruleString, variableValue):
return " Error-115 "
elif ( variableType == " LONG " ) :
result = check Long ( variableValue )
result = check Integer ( variableValue )
if ( result is True ) :
return " ok "
else :
@ -3350,11 +3349,11 @@ def validateValueAgainstRule(ruleString, variableValue):
elif ( variableType == " LONG_VALUE " ) :
long_range = varRange . split ( ' - ' )
r = range ( long ( long_range [ 0 ] . strip ( ) ) , long ( long_range [ 1 ] . strip ( ) ) )
if ( check Long ( variableValue ) is not True ) :
r = range ( int ( long_range [ 0 ] . strip ( ) ) , int ( long_range [ 1 ] . strip ( ) ) )
if ( check Integer ( variableValue ) is not True ) :
# debugOutput(variableValue)
return " Error-116 "
result = long ( variableValue ) in r
result = int ( variableValue ) in r
if ( result is True ) :
return " ok "
else :
@ -3362,10 +3361,10 @@ def validateValueAgainstRule(ruleString, variableValue):
elif ( variableType == " LONG_VALUE_RANGE " ) :
long_range = varRange . split ( ' - ' )
r = range ( long ( long_range [ 0 ] . strip ( ) ) , long ( long_range [ 1 ] . strip ( ) ) )
r = range ( int ( long_range [ 0 ] . strip ( ) ) , int ( long_range [ 1 ] . strip ( ) ) )
val_range = variableValue . split ( ' - ' )
if ( ( check Long ( val_range [ 0 ] ) is not True ) or
( check Long ( val_range [ 1 ] ) is not True ) ) :
if ( ( check Integer ( val_range [ 0 ] ) is not True ) or
( check Integer ( val_range [ 1 ] ) is not True ) ) :
return " Error-117 "
result = ( val_range [ 0 ] in r ) and (
val_range [ 1 ] in r ) and ( val_range [ 0 ] < val_range [ 1 ] )
@ -3375,7 +3374,7 @@ def validateValueAgainstRule(ruleString, variableValue):
return " Error-113 "
elif ( variableType == " LONG_OPTIONS " ) :
long_options = varRange . split ( ' , ' )
if ( check Long ( variableValue ) is not True ) :
if ( check Integer ( variableValue ) is not True ) :
return " Error-116 "
for opt in long_options :
if ( opt . strip ( ) == variableValue ) :
@ -3531,14 +3530,6 @@ def checkFloat(s):
# EOM
def checkLong ( s ) :
try :
long ( s )
return True
except ValueError :
return False
def debugOutput ( command ) :
f = open ( ' debugOuput.txt ' , ' a ' )
f . write ( str ( command ) ) # python will convert \n to os.linesep