mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
lf-atten_mod_test: trying to turn a string 'all' into an integer will always generate an error
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -70,10 +70,12 @@ class ATTENUATORProfile(LFCliBase):
|
||||
raise ValueError('No attenuators in response')
|
||||
|
||||
def create(self):
|
||||
if self.atten_idx == 'all':
|
||||
self.atten_idx = 8
|
||||
if int(self.atten_val) > 955:
|
||||
raise ValueError("Attenuation ddB value must be 955 or less")
|
||||
if int(self.atten_idx) > 7 or self.atten_idx == 'all':
|
||||
raise ValueError("Attenuation ddB value must be 7 or less")
|
||||
if int(self.atten_idx) > 7:
|
||||
raise ValueError("Attenuation idx value must be 7 or less")
|
||||
print("Setting Attenuator...")
|
||||
self.set_command_param("set_attenuator", "serno", self.atten_serno)
|
||||
self.set_command_param("set_attenuator", "atten_idx", self.atten_idx)
|
||||
|
||||
@@ -54,6 +54,7 @@ class CreateAttenuator(Realm):
|
||||
self.attenuator_profile.create()
|
||||
self.attenuator_profile.show()
|
||||
|
||||
|
||||
def main():
|
||||
parser = Realm.create_basic_argparse(
|
||||
prog='lf_atten_mod_test.py',
|
||||
@@ -63,13 +64,13 @@ def main():
|
||||
lf_atten_mod_test.py
|
||||
--------------------
|
||||
set and show Attenuator:
|
||||
python3 lf_atten_mod_test.py -hst 192.168.200.12 -port 8080 -atten_serno all --atten_idx all --atten_val 220
|
||||
python3 lf_atten_mod_test.py -hst 192.168.200.12 -port 8080 -atten_serno all --atten_idx 7 --atten_val 220
|
||||
''')
|
||||
|
||||
parser.add_argument('-hst', '--host', help='host name', default='192.168.200.12')
|
||||
parser.add_argument('-port', '--port', help='port name', default=8080)
|
||||
parser.add_argument('-atten_serno', '--atten_serno', help='Serial number for requested Attenuator, or \'all\'', default=2222)
|
||||
parser.add_argument('-atten_idx', '--atten_idx', help='Attenuator index eg. For module 1 = 0,module 2 = 1', default='all')
|
||||
parser.add_argument('-atten_idx', '--atten_idx', help='Attenuator index eg. For module 1 = 0,module 2 = 1', default=7)
|
||||
parser.add_argument('-atten_val', '--atten_val', help='Requested attenution in 1/10ths of dB (ddB).', default=550)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user