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
16a74fb4
Commit
16a74fb4
authored
4 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
verify that unmanaged interfaces in imported
parent
ff0a984e
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/test_worker_utils.py
+21
-1
21 additions, 1 deletion
test/test_worker_utils.py
with
21 additions
and
1 deletion
test/test_worker_utils.py
+
21
−
1
View file @
16a74fb4
...
...
@@ -11,6 +11,7 @@ import jsonschema
from
inventory_provider.tasks
import
worker
from
inventory_provider.tasks
import
common
from
inventory_provider.routes
import
msr
from
inventory_provider
import
config
def
backend_db
():
...
...
@@ -23,7 +24,7 @@ def backend_db():
}).
db
def
test_build_subnet_db
(
mocked_worker_module
):
def
test_build_subnet_db
(
mocked_worker_module
,
data_config_filename
):
"""
Verify that valid reverse subnet objects are created.
...
...
@@ -52,6 +53,16 @@ def test_build_subnet_db(mocked_worker_module):
'
items
'
:
{
"
$ref
"
:
"
#/definitions/interface
"
},
}
all_subnet_interfaces
=
set
()
unmanaged_interfaces
=
set
()
with
open
(
data_config_filename
)
as
f
:
params
=
config
.
load
(
f
)
for
ifc
in
params
.
get
(
'
unmanaged-interfaces
'
,
[]):
ifc_key
=
(
f
'
{
ifc
[
"
router
"
].
lower
()
}
'
f
'
:
{
ifc
[
"
interface
"
].
lower
()
}
'
f
'
:
{
ifc
[
"
network
"
]
}
'
)
unmanaged_interfaces
.
add
(
ifc_key
)
db
=
backend_db
()
# also forces initialization
def
_x
(
k
):
...
...
@@ -80,8 +91,17 @@ def test_build_subnet_db(mocked_worker_module):
for
ifc
in
value
:
assert
ifc
[
'
interface address
'
]
==
address
ifc_key
=
(
f
'
{
ifc
[
"
router
"
]
}
'
f
'
:
{
ifc
[
"
interface name
"
]
}
'
f
'
:
{
ifc
[
"
interface address
"
]
}
'
)
all_subnet_interfaces
.
add
(
ifc_key
)
assert
found_record
assert
unmanaged_interfaces
<=
all_subnet_interfaces
def
test_build_juniper_peering_db
(
mocked_worker_module
):
"""
...
...
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