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
ac346fd5
Commit
ac346fd5
authored
3 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
corrected paramter checking
parent
7aaaf557
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
inventory_provider/routes/testing.py
+8
-3
8 additions, 3 deletions
inventory_provider/routes/testing.py
with
8 additions
and
3 deletions
inventory_provider/routes/testing.py
+
8
−
3
View file @
ac346fd5
import
json
import
json
import
logging
import
os
import
os
from
distutils.util
import
strtobool
from
operator
import
itemgetter
from
operator
import
itemgetter
from
flask
import
Blueprint
,
Response
,
jsonify
,
current_app
,
request
from
flask
import
Blueprint
,
Response
,
jsonify
,
current_app
,
request
...
@@ -13,6 +15,7 @@ from inventory_provider.tasks import common as worker_common
...
@@ -13,6 +15,7 @@ from inventory_provider.tasks import common as worker_common
routes
=
Blueprint
(
"
inventory-data-testing-support-routes
"
,
__name__
)
routes
=
Blueprint
(
"
inventory-data-testing-support-routes
"
,
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
@routes.route
(
"
flushdb
"
,
methods
=
[
'
GET
'
,
'
POST
'
])
@routes.route
(
"
flushdb
"
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
flushdb
():
def
flushdb
():
...
@@ -115,8 +118,10 @@ def latch_db():
...
@@ -115,8 +118,10 @@ def latch_db():
@routes.route
(
"
/circuit-tree/<path:root_identifier>
"
,
@routes.route
(
"
/circuit-tree/<path:root_identifier>
"
,
methods
=
[
'
GET
'
,
'
POST
'
])
methods
=
[
'
GET
'
,
'
POST
'
])
def
circuit_tree
(
root_identifier
:
str
):
def
circuit_tree
(
root_identifier
:
str
):
carriers
=
request
.
args
.
get
(
'
carriers
'
,
default
=
'
false
'
,
type
=
str
)
carriers
=
\
interface_
=
request
.
args
.
get
(
'
interface
'
,
default
=
'
false
'
,
type
=
str
)
strtobool
(
request
.
args
.
get
(
'
carriers
'
,
default
=
'
false
'
,
type
=
str
))
interface_
=
\
strtobool
(
request
.
args
.
get
(
'
interface
'
,
default
=
'
false
'
,
type
=
str
))
if
carriers
:
if
carriers
:
children_prop
=
'
carrier-circuits
'
children_prop
=
'
carrier-circuits
'
...
@@ -154,6 +159,7 @@ def circuit_tree(root_identifier: str):
...
@@ -154,6 +159,7 @@ def circuit_tree(root_identifier: str):
if_services
=
r
.
get
(
f
'
ims:interface_services:
{
root_identifier
}
'
)
if_services
=
r
.
get
(
f
'
ims:interface_services:
{
root_identifier
}
'
)
if
if_services
:
if
if_services
:
logger
.
debug
(
'
1
'
)
root_identifiers
=
[
s
[
'
id
'
]
for
s
in
json
.
loads
(
if_services
)]
root_identifiers
=
[
s
[
'
id
'
]
for
s
in
json
.
loads
(
if_services
)]
children
=
[]
children
=
[]
for
id_
in
root_identifiers
:
for
id_
in
root_identifiers
:
...
@@ -176,5 +182,4 @@ def circuit_tree(root_identifier: str):
...
@@ -176,5 +182,4 @@ def circuit_tree(root_identifier: str):
return
f
'
No circuit found for:
{
root_identifier
}
'
return
f
'
No circuit found for:
{
root_identifier
}
'
tree
=
_get_childcircuit_tree_local
(
root_identifier
)
tree
=
_get_childcircuit_tree_local
(
root_identifier
)
return
f
'
<pre>
{
format_tree
(
tree
,
format_node
=
itemgetter
(
0
),
get_children
=
itemgetter
(
1
))
}
</pre>
'
return
f
'
<pre>
{
format_tree
(
tree
,
format_node
=
itemgetter
(
0
),
get_children
=
itemgetter
(
1
))
}
</pre>
'
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