Skip to content
Snippets Groups Projects
Commit 435b524f authored by Pelle Koster's avatar Pelle Koster
Browse files

[POL1-801] get-interface-stats does not filter on admin/oper status

parent ae803b41
No related branches found
No related tags found
No related merge requests found
......@@ -176,7 +176,7 @@ def process_juniper_router(
)
)
_log_interface_points_sorted(points, point_kind='error')
_log_interface_points_sorted(points, point_kind="error")
write_points(points, influx_params=influx_params)
......@@ -184,10 +184,8 @@ def _log_interface_points_sorted(points: Sequence[dict], point_kind=""):
N_COLUMNS = 5
num_points = len(points)
point_kind = point_kind + " " if point_kind else ""
semicolon = ':' if num_points else ''
logger.info(
f"Found {point_kind}points for {num_points} interfaces{semicolon}"
)
semicolon = ":" if num_points else ""
logger.info(f"Found {point_kind}points for {num_points} interfaces{semicolon}")
if not points:
return
......
......@@ -138,8 +138,8 @@ def _physical_interface_counters(ifc_doc):
' or name[(starts-with(normalize-space(), "ae"))]'
' or name[(starts-with(normalize-space(), "irb"))]'
' or name[(starts-with(normalize-space(), "gr"))])'
' and normalize-space(admin-status)="up"'
' and normalize-space(oper-status)="up"'
# ' and normalize-space(admin-status)="up"'
# ' and normalize-space(oper-status)="up"'
"]"
):
result = parse_interface_xml(phy, PHYSICAL_INTERFACE_COUNTERS)
......@@ -156,8 +156,8 @@ def _logical_interface_counters(ifc_doc):
' or name[(starts-with(normalize-space(), "ae"))]'
' or name[(starts-with(normalize-space(), "irb"))]'
' or name[(starts-with(normalize-space(), "gr"))])'
' and normalize-space(admin-status)="up"'
' and normalize-space(oper-status)="up"'
# ' and normalize-space(admin-status)="up"'
# ' and normalize-space(oper-status)="up"'
"]/logical-interface"
):
result = parse_interface_xml(logical, LOGICAL_INTERFACE_COUNTERS)
......
......@@ -43,6 +43,7 @@ def test_verify_all_interfaces_present(single_router_fqdn, polled_interfaces):
over all test data sets ... the point of the test
is a sanity check of our test data
"""
def _is_enabled(ifc_name, ifc_doc):
m = re.match(r"^([^\.]+)\.?.*", ifc_name)
assert m # sanity: should never fail
......@@ -386,8 +387,8 @@ def test_main_for_all_juniper_routers(write_points, all_juniper_routers):
@pelle: this is not a maintainable pattern (e.g. POL1-799 or similar things)
... please do something nicer (actually > a few calls/points is enough)
"""
assert calls == 104
assert total_points == 6819
assert calls > 0
assert total_points > 0
class TestGetJuniperNetConnf:
......@@ -400,9 +401,7 @@ class TestGetJuniperNetConnf:
@pytest.fixture(autouse=True)
def mocked_rpc(self, data_dir):
raw_response = data_dir.joinpath(self.RAW_RESPONSE_FILE).read_text()
with patch.object(
juniper, "_rpc", return_value=RPCReply(raw_response)
) as mock:
with patch.object(juniper, "_rpc", return_value=RPCReply(raw_response)) as mock:
yield mock
def test_calls_rpc_with_params(self, mocked_rpc):
......@@ -522,8 +521,7 @@ def test_prepare_influx_params(input_params, expected):
@pytest.mark.parametrize(
"hostname",
['rt0.lon.uk.lab.office.geant.net', 'rt0.ams.nl.lab.office.geant.net']
"hostname", ["rt0.lon.uk.lab.office.geant.net", "rt0.ams.nl.lab.office.geant.net"]
)
def test_nokia_counters(hostname):
"""
......
......@@ -3,6 +3,7 @@ envlist = py36
[flake8]
max-line-length = 120
extend-ignore = E203,E701,W605
[testenv]
passenv = USE_COMPOSE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment