From 499218f2e3286add5afda3a2d6e67209bef42337 Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Thu, 5 Aug 2021 18:25:57 -0700 Subject: [PATCH] lf_json_autogen.py: adds logic to look for get parameters 'all' and 'list', processing still WIP Signed-off-by: Jed Reynolds --- py-json/LANforge/lf_json_autogen.py | 354 +++++++++++++++++++++++++--- 1 file changed, 326 insertions(+), 28 deletions(-) diff --git a/py-json/LANforge/lf_json_autogen.py b/py-json/LANforge/lf_json_autogen.py index b08f9e35..a202b2b5 100644 --- a/py-json/LANforge/lf_json_autogen.py +++ b/py-json/LANforge/lf_json_autogen.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- - Generated by LANforge JsonApiPythonGenerator, Thu Aug 05 16:38:51 PDT 2021 + Generated by LANforge JsonApiPythonGenerator, Thu Aug 05 18:19:37 PDT 2021 - - WORK IN PROGRESS - - The API this library provides is actively being changed. This file expects to live in py-json/LANforge directory. ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----""" import keyword import pprint +import time from enum import Enum from enum import IntFlag from . import LFRequest @@ -95,6 +96,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/attenuator" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -105,14 +107,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -176,6 +188,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/chamber" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -186,14 +199,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -231,6 +254,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/control" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -241,14 +265,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -305,6 +339,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/cx" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -315,14 +350,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -407,6 +452,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/dut" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -417,14 +463,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -528,6 +584,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/endp" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -538,14 +595,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -598,6 +665,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/events" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -608,14 +676,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -684,6 +762,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/fileio" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -694,14 +773,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -761,6 +850,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/generic" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -771,14 +861,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -816,6 +916,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/gui-cli" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -826,14 +927,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -923,6 +1034,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/layer4" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -933,14 +1045,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1071,6 +1193,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/port" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1081,14 +1204,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1126,6 +1259,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/quit" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1136,14 +1270,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1212,6 +1356,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/radiostatus" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1222,14 +1367,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1299,6 +1454,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/resource" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1309,14 +1465,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1362,6 +1528,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/scan" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1372,14 +1539,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1436,6 +1613,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/stations" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1446,14 +1624,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1497,6 +1685,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/status-msg" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1507,14 +1696,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1560,6 +1759,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/test-group" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1570,14 +1770,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1622,6 +1832,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/text" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1632,14 +1843,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1706,6 +1927,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/voip" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1716,14 +1938,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1803,6 +2035,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/voip-endp" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1813,14 +2046,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1903,6 +2146,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/vr" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1913,14 +2157,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -1980,6 +2234,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/vrcx" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -1990,14 +2245,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -2058,6 +2323,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/wl" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -2068,14 +2334,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -2153,6 +2429,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/wl-endp" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -2163,14 +2440,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None @@ -2209,6 +2496,7 @@ class LFJsonGet(LFCliBase): debug_=False): debug_ |= self.debug url = "/ws-msg" + found_all = 0 if (eid_list is None) or (len(eid_list) < 1): raise ValueError("no entity id in request") if (requested_col_names is None) or (len(requested_col_names) < 1): @@ -2219,14 +2507,24 @@ class LFJsonGet(LFCliBase): raise ValueError("column name cannot be blank") trimmed_fields.append(requested_col_names.strip()) if (isinstance(requested_col_names, list)): + all_found=0 for field in requested_col_names: if not field.strip(): raise ValueError("column names cannot be blank") field = field.strip() if field.find(" ") > -1 : raise ValueError("field should be URL encoded: [%s]" % (field)) + if (field == 'all') or (field == 'list'): + found_all = 1 trimmed_fields.append(field) - url += "?requested_col_names=%s" % (",".join(trimmed_fields)) + if isinstance(eid_list, list): + url += "/1/%s" % (",".join(eid_list)) + else: + url += "/1/%s" % eid_list + + if (found_all != 0) and (len(trimmed_fields) > 0): + url += "?fields=%s" % (",".join(trimmed_fields)) + response = self.json_get(url, debug_=debug_) if response is None: return None