Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
dashboardv3
inventory-provider
Commits
f8dc5360
Commit
f8dc5360
authored
4 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
0a3f6377
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/per_router/test_juniper_data.py
+16
-5
16 additions, 5 deletions
test/per_router/test_juniper_data.py
with
16 additions
and
5 deletions
test/per_router/test_juniper_data.py
+
16
−
5
View file @
f8dc5360
import
ipaddress
import
jsonschema
import
pytest
from
inventory_provider
import
juniper
...
...
@@ -35,7 +36,7 @@ def test_interface_list(netconf_doc):
jsonschema
.
validate
(
interfaces
,
schema
)
assert
interfaces
# at least shouldn't be empty
from
lxml
import
etree
def
test_bgp_peering_data
(
netconf_doc
):
active_peers
=
set
()
...
...
@@ -47,10 +48,15 @@ def test_bgp_peering_data(netconf_doc):
if
inactive
==
'
inactive
'
:
inactive_peers
.
add
(
address
)
else
:
if
address
==
'
62.40.99.50
'
:
print
(
'
here
'
)
active_peers
.
add
(
address
)
# a peering config might be present, but an old
# version could be present but inactive
# (a bit of a testing gap, but definitely not nothing)
inactive_peers
=
inactive_peers
-
active_peers
if
not
active_peers
:
pytest
.
skip
(
'
no peerings configured for this router
'
)
peerings
=
list
(
juniper
.
all_bgp_peers
(
netconf_doc
))
jsonschema
.
validate
(
peerings
,
juniper
.
PEERING_LIST_SCHEMA
)
assert
peerings
# there's always at least one
...
...
@@ -65,10 +71,15 @@ def test_bgp_peering_data(netconf_doc):
missing
=
active_peers
-
returned_addresses
if
missing
:
print
(
'
here
'
)
assert
returned_addresses
==
active_peers
assert
returned_addresses
==
active_peers
,
(
'
these active peerings weren
''
t returned:
'
f
'
{
active_peers
-
returned_addresses
}
'
)
# confirm that none of the inactive peerings were returned
assert
not
inactive_peers
&
returned_addresses
assert
not
inactive_peers
&
returned_addresses
,
(
'
these inactive peerings were returned:
'
f
'
{
inactive_peers
&
returned_addresses
}
'
)
def
test_snmp_community_string
(
mocked_netifaces
,
netconf_doc
):
assert
juniper
.
snmp_community_string
(
netconf_doc
)
==
'
0pBiFbD
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment