Skip to content

Commit

Permalink
Merge pull request #951 from netenglabs/lib-upd8s-23
Browse files Browse the repository at this point in the history
update libs for 0.23 release
  • Loading branch information
ddutt authored May 26, 2024
2 parents 27cd71d + 5b41426 commit bbb35ca
Show file tree
Hide file tree
Showing 14 changed files with 2,302 additions and 326 deletions.
2,160 changes: 2,002 additions & 158 deletions build/requirements.txt

Large diffs are not rendered by default.

392 changes: 254 additions & 138 deletions poetry.lock

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ classifiers = [

[tool.poetry.dependencies]
python = ">3.8.1, < 3.10"
aiohttp = "==3.7.4"
asyncssh = "~2.11"
aiohttp = ">3.8, <4.0"
asyncssh = "~2.14"
textfsm = "*"
async-timeout = "<4.0"
async-timeout = ">4.0, <5.0"
aiofiles = "*"
prompt-toolkit = ">2"
pyarrow = "~11.0"
pandas = "~1.5"
PyYAML = "*"
python-nubia = "0.2b5"
uvloop = "*"
networkx = "^2.4"
matplotlib = "^3.2.2"
faker = "^4.1.1"
netconan = "^0.11.2"
jsonpath-ng = "^1.5.1"
fastapi = "~0.95"
networkx = "~2.4"
matplotlib = "~3.7"
faker = "~4.18"
netconan = "~0.11.2"
jsonpath-ng = "~1.6"
fastapi = "~0.95.2"
uvicorn = "^0.14.0"
tabulate = "^0.8.7"
streamlit = "1.11.1"
Expand All @@ -43,15 +43,17 @@ natsort = "^8.0.0"
colorama = "^0.4.4"
tzlocal = "< 3.0"
pyparsing = ">=2.2.0, <3.0"
xmltodict = "^0.12.0"
streamlit-aggrid = "^0.2.2"
ciscoconfparse = "^1.6.21"
xmltodict = "~0.12.0"
streamlit-aggrid = "~0.2.2"
ciscoconfparse = "~1.6.21"
notebook = "6.4.12"
urllib3 = "^1.26.12"
packaging = "^21.3"
psutil = "^5.9.4"
urllib3 = "~1.26.12"
packaging = "~21.3"
psutil = "~5.9.4"
jellyfish = "~0.10"
altair = '>3.2, <5.0'
pydantic = '< 2.0'
numpy = '~1.20'

[tool.poetry.dev-dependencies]
pylint = "*"
Expand Down
16 changes: 8 additions & 8 deletions suzieq/db/parquet/parquetdb.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import re
from time import time
from typing import List, Optional
from typing import Any, Callable, List, Optional
import logging
from pathlib import Path
from datetime import datetime, timedelta, timezone
Expand Down Expand Up @@ -130,8 +130,7 @@ def read(self, table_name: str, data_format: str,
continue
if need_sqvers:
vers = float(str(elem).split('=')[-1])
if vers > max_vers:
max_vers = vers
max_vers = max(vers, max_vers)

dataset = ds.dataset(elem, format='parquet',
partitioning='hive')
Expand Down Expand Up @@ -226,6 +225,9 @@ def write(self, table_name: str, data_format: str,
df = pd.DataFrame.from_dict(data["records"])
table = pa.Table.from_pandas(df, schema=schema,
preserve_index=False)
else:
raise ValueError('Unknown format of data provided:'
f'{type(data)}')

pq.write_to_dataset(table,
root_path=folder,
Expand Down Expand Up @@ -539,8 +541,7 @@ def _get_cp_dataset(self, table_name: str, need_sqvers: bool,
continue
if need_sqvers:
vers = float(str(elem).split('=')[-1])
if vers > max_vers:
max_vers = vers
max_vers = max(vers, max_vers)

dataset = ds.dataset(elem, format='parquet', partitioning='hive')

Expand Down Expand Up @@ -618,7 +619,7 @@ def _get_filtered_fileset(self, dataset: ds, namespaces: list) -> ds:
ds: pyarrow dataset of only the files that match filter
"""
def check_ns_conds(ns_to_test: str, filter_list: List[str],
op: operator.or_) -> bool:
op: Callable[[Any, Any], Any]) -> bool:
"""Concat the expressions with the provided (AND or OR) operator
and return the result of the resulting expression tested on the
provided namespace.
Expand All @@ -631,11 +632,10 @@ def check_ns_conds(ns_to_test: str, filter_list: List[str],
Returns:
bool: the result of the expression
"""
# pylint: disable=comparison-with-callable
# We would like to init the result to False if we concat the
# expressions with OR, while with True if we use AND.
res = False
if operator.and_ == op:
if operator.and_ is op:
res = True
for filter_val in filter_list:
ns_to_test = ns_to_test.split('namespace=')[-1]
Expand Down
1 change: 0 additions & 1 deletion suzieq/engines/pandas/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _cons_addnl_fields(self, columns: List[str], addnl_fields: List[str],

return addnl_fields

# pylint: disable=too-many-statements
def get(self, **kwargs):
'''Return the routes table for the given filters'''

Expand Down
8 changes: 8 additions & 0 deletions suzieq/gui/stlit/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ def _get_path(self, forward_dir: bool = True) -> Tuple[pd.DataFrame,
vrf=self._state.vrf)

summ_df = self._path_summarize(df)
else:
df = self._pathobj.get(namespace=[self._state.namespace],
src=self._state.dest,
dest=self._state.source,
vrf=self._state.vrf)

summ_df = self._path_summarize(df)

return df, summ_df

def _get_failed_data(self, namespace: str, pgbar) -> None:
Expand Down
3 changes: 1 addition & 2 deletions suzieq/gui/stlit/xplore.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ def _draw_aggrid_df(self, df) -> AgGrid:

start_row = self._state.start_row
end_row = self._state.end_row
if end_row > df.shape[0]:
end_row = df.shape[0]
end_row = min(end_row, df.shape[0])

if end_row - start_row > MAX_ROW_WARN:
st.warning('Printing too many rows can fail or be very slow')
Expand Down
5 changes: 5 additions & 0 deletions suzieq/poller/controller/source/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AnsibleSourceModel(SourceModel):
def validate_and_set(cls, path: str):
"""checks if the path is valid
"""
inventory = None
if isinstance(path, str):
if not Path(path).is_file():
raise ValueError(
Expand All @@ -38,6 +39,10 @@ def validate_and_set(cls, path: str):

elif isinstance(path, Dict):
inventory = path

if not inventory:
raise ValueError('Unknown inventory format: expect path or dict')

if '_meta' not in inventory \
or 'hostvars' not in inventory['_meta']:
if isinstance(inventory, list) and 'namespace' in inventory[0]:
Expand Down
1 change: 1 addition & 0 deletions suzieq/poller/worker/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ async def _post_result(self, service_callback: asyncio.coroutine,
async def _parse_device_type_hostname(self, output, _) -> None:
devtype = ""
hostname = None
version_str = '0.0.0' # default that's possibly never used

if output[0]["status"] == 0:
# don't keep trying if we're connected to an unsupported dev
Expand Down
2 changes: 1 addition & 1 deletion suzieq/poller/worker/services/evpnVni.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _clean_junos_data(self, processed_data, _):
'vrf': vrf,
'os': 'junos'
}
newntries[vni] = vni_entry
newntries[vni] = vni_entry
continue
elif entry['_entryType'] == 'l3':
vni = int(entry.get('vni', '0'))
Expand Down
1 change: 1 addition & 0 deletions suzieq/poller/worker/services/ospfIf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _clean_eos_data(self, processed_data, _):
def _clean_junos_data(self, processed_data, _):

drop_indices = []
routerId = ''

for i, entry in enumerate(processed_data):
if entry['_entryType'] == 'overview':
Expand Down
1 change: 1 addition & 0 deletions suzieq/poller/worker/services/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def _clean_junos_data(self, processed_data, raw_data):
if entry.get('protocol', '') == 'direct':
entry['protocol'] = 'connected'
vrf = entry.pop("vrf")[0]['data']
vers = 0
if vrf == "inet.0":
vrf = "default"
vers = 4
Expand Down
5 changes: 2 additions & 3 deletions suzieq/poller/worker/services/service_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ async def init_services(self) -> List[Service]:
svc_classes = Service.get_plugins()

schemas = Schema(self.schema_dir)
if schemas:
poller_schema = schemas.get_arrow_schema('sqPoller')
poller_schema_version = SchemaForTable('sqPoller', schemas).version
poller_schema = schemas.get_arrow_schema('sqPoller')
poller_schema_version = SchemaForTable('sqPoller', schemas).version

db_access = self._get_db_access(self.cfg)

Expand Down
1 change: 1 addition & 0 deletions suzieq/poller/worker/services/svcparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def cons_recs_from_json_template(tmplt_str, in_data):
# Process default value processing of the form <key>?|<def_val> or
# <key>?<expected_val>|<def_val>
op = None # pylint: disable=redefined-outer-name
exp_val = None
if "?" in rval:
rval, op = rval.split("?")
exp_val, def_val = op.split("|")
Expand Down

0 comments on commit bbb35ca

Please sign in to comment.