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
3aeae5cb
Commit
3aeae5cb
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
reinstated old method and added possible replacement commented out for discussion
parent
461eb0b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/routes/classifier.py
+26
-25
26 additions, 25 deletions
inventory_provider/routes/classifier.py
with
26 additions
and
25 deletions
inventory_provider/routes/classifier.py
+
26
−
25
View file @
3aeae5cb
...
@@ -54,36 +54,37 @@ def _locations_from_router(router_name):
...
@@ -54,36 +54,37 @@ def _locations_from_router(router_name):
# todo - see if Erik is happy for this to
# todo - see if Erik is happy for this to
# just make a call to _location_from_router
# just make a call to _location_from_router, will need to make sure that
# all equipment is exported and change the name to loaction_from_equipment
def
_location_from_service_dict
(
s
):
def
_location_from_service_dict
(
s
):
loc
=
_locations_from_router
(
s
[
'
equipment
'
])
# loc = _locations_from_router(s['equipment'])
location
=
{
'
a
'
:
_LOCATION
(
equipment
=
loc
[
'
a
'
][
'
equipment
'
],
name
=
loc
[
'
a
'
][
'
pop_name
'
],
abbreviation
=
loc
[
'
a
'
][
'
pop_abbreviation
'
])
}
if
'
other_end_equipment
'
in
s
:
loc
=
_locations_from_router
(
s
[
'
other_end_equipment
'
])
location
[
'
b
'
]
=
_LOCATION
(
equipment
=
loc
[
'
a
'
][
'
equipment
'
],
name
=
loc
[
'
a
'
][
'
pop_name
'
],
abbreviation
=
loc
[
'
a
'
][
'
abbreviation
'
])
# location = {
# location = {
# 'a': _LOCATION(
# 'a': _LOCATION(
# equipment=
s
['equipment'],
# equipment=
loc['a']
['equipment'],
# name=
s
['pop_name'],
# name=
loc['a']
['pop_name'],
# abbreviation=
s
['pop_abbreviation'])
# abbreviation=
loc['a']
['pop_abbreviation'])
# }
# }
#
# if 'other_end_equipment' in s:
# if all(s[n] for n in (
# loc = _locations_from_router(s['other_end_equipment'])
# 'other_end_equipment',
# 'other_end_pop_name',
# 'other_end_pop_abbreviation')):
# location['b'] = _LOCATION(
# location['b'] = _LOCATION(
# equipment=s['other_end_equipment'],
# equipment=loc['a']['equipment'],
# name=s['other_end_pop_name'],
# name=loc['a']['pop_name'],
# abbreviation=s['other_end_pop_abbreviation'])
# abbreviation=loc['a']['abbreviation'])
location
=
{
'
a
'
:
_LOCATION
(
equipment
=
s
[
'
equipment
'
],
name
=
s
[
'
pop_name
'
],
abbreviation
=
s
[
'
pop_abbreviation
'
])
}
if
all
(
s
[
n
]
for
n
in
(
'
other_end_equipment
'
,
'
other_end_pop_name
'
,
'
other_end_pop_abbreviation
'
)):
location
[
'
b
'
]
=
_LOCATION
(
equipment
=
s
[
'
other_end_equipment
'
],
name
=
s
[
'
other_end_pop_name
'
],
abbreviation
=
s
[
'
other_end_pop_abbreviation
'
])
return
location
return
location
...
...
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