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
e4a82fa9
Commit
e4a82fa9
authored
4 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
canonify peer addresses
parent
d7e2cc79
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/juniper.py
+2
-1
2 additions, 1 deletion
inventory_provider/juniper.py
test/per_router/test_juniper_data.py
+7
-0
7 additions, 0 deletions
test/per_router/test_juniper_data.py
with
9 additions
and
1 deletion
inventory_provider/juniper.py
+
2
−
1
View file @
e4a82fa9
...
...
@@ -214,7 +214,8 @@ def list_interfaces(netconf_config):
def
all_bgp_peers
(
netconf_config
):
def
_peering_params
(
neighbor_node
):
info
=
{
'
address
'
:
neighbor_node
.
find
(
'
name
'
).
text
}
address
=
neighbor_node
.
find
(
'
name
'
).
text
info
=
{
'
address
'
:
ipaddress
.
ip_address
(
address
).
exploded
}
peer_as
=
neighbor_node
.
find
(
'
peer-as
'
)
if
peer_as
is
not
None
:
# lxml usage warning: can't just test `if peer_as:`
...
...
This diff is collapsed.
Click to expand it.
test/per_router/test_juniper_data.py
+
7
−
0
View file @
e4a82fa9
import
ipaddress
import
jsonschema
from
inventory_provider
import
juniper
...
...
@@ -85,6 +86,12 @@ def test_bgp_peering_data(netconf_doc):
jsonschema
.
validate
(
peerings
,
schema
)
assert
peerings
# there's always at least one
# confirm the addresses are in canonical (exploded) form
for
p
in
peerings
:
canonical_address
=
ipaddress
.
ip_address
(
p
[
'
address
'
]).
exploded
assert
p
[
'
address
'
]
==
canonical_address
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