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
07cc5ad9
Commit
07cc5ad9
authored
5 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
Updated SQL to get correct information for each end of services
parent
9093917f
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/db/opsdb.py
+43
-40
43 additions, 40 deletions
inventory_provider/db/opsdb.py
with
43 additions
and
40 deletions
inventory_provider/db/opsdb.py
+
43
−
40
View file @
07cc5ad9
...
...
@@ -30,46 +30,47 @@ retrieve_services_query = """SELECT *
LOWER(c.circuit_type) AS circuit_type,
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
pop.name as pop_name,
pop.abbreviation as pop_abbreviation,
pop
_a
.name as pop_name,
pop
_a
.abbreviation as pop_abbreviation,
pop_b.name as other_end_pop_name,
pop_b.abbreviation as other_end_pop_abbreviation,
e.name AS equipment,
e
_a
.name AS equipment,
e_b.name AS other_end_equipment,
cc.port_a AS port,
cc.port_b AS other_end_port,
cc.int_LU_a AS logical_unit,
cc.int_LU_b AS other_end_logical_unit,
LOWER(o.name) AS manufacturer,
LOWER(ec.card_id) AS card_id,
LOWER(ec
_a
.card_id) AS card_id,
LOWER(ec_b.card_id) AS other_end_card_id,
LOWER(
IF(pp.interface_name IS NULL,
''
, pp.interface_name)) AS interface_name,
IF(pp
_a
.interface_name IS NULL,
''
, pp
_a
.interface_name)) AS interface_name,
LOWER(
IF(pp_b.interface_name IS NULL,
''
, pp_b.interface_name)) AS other_end_interface_name
FROM circuit c
INNER JOIN circuit_connections cc
ON cc.circ_absid = c.absid
LEFT JOIN pop pop
ON pop.absid = cc.PTR_pop_a
LEFT JOIN pop pop
_a
ON pop
_a
.absid = cc.PTR_pop_a
LEFT JOIN pop pop_b
ON pop_b.absid = cc.PTR_pop_b
INNER JOIN equipment e
ON e.absid = cc.PTR_equip_a
INNER JOIN equipment e
_a
ON e
_a
.absid = cc.PTR_equip_a
LEFT JOIN equipment e_b
ON e_b.absid = cc.PTR_equip_b
LEFT JOIN events
ON events.absid = cc.PTR_project
INNER JOIN equipment_card ec
ON ec.absid = cc.PTR_card_a
INNER JOIN equipment_card ec
_a
ON ec
_a
.absid = cc.PTR_card_a
LEFT JOIN equipment_card ec_b
ON ec_b.absid = cc.PTR_card_b
LEFT JOIN organisation o
ON o.absid = ec.manufacturer
LEFT JOIN port_plugin pp
ON pp.PTR_card = cc.PTR_card_a AND pp.port = cc.port_a
ON o.absid = ec_a.manufacturer
LEFT JOIN port_plugin pp_a
ON pp_a.PTR_card = cc.PTR_card_a
AND pp_a.port = cc.port_a
LEFT JOIN port_plugin pp_b
ON pp_b.PTR_card = cc.PTR_card_b
AND pp_b.port = cc.port_b
...
...
@@ -82,46 +83,47 @@ retrieve_services_query = """SELECT *
LOWER(c.circuit_type) AS circuit_type,
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
pop.name as pop_name,
pop.abbreviation as pop_abbreviation,
pop_
b
.name as other_end_pop_name,
pop_
b
.abbreviation as other_end_pop_abbreviation,
e.name AS equipment,
e_
b
.name AS other_end_equipment,
cc.port_
a
AS port,
cc.port_
b
AS other_end_port,
cc.int_LU_
a
AS logical_unit,
cc.int_LU_
b
AS other_end_logical_unit,
pop
_b
.name as pop_name,
pop
_b
.abbreviation as pop_abbreviation,
pop_
a
.name as other_end_pop_name,
pop_
a
.abbreviation as other_end_pop_abbreviation,
e
_b
.name AS equipment,
e_
a
.name AS other_end_equipment,
cc.port_
b
AS port,
cc.port_
a
AS other_end_port,
cc.int_LU_
b
AS logical_unit,
cc.int_LU_
a
AS other_end_logical_unit,
LOWER(o.name) AS manufacturer,
LOWER(ec.card_id) AS card_id,
LOWER(ec_b.card_id) AS other_end_card_id,
LOWER(
IF(pp.interface_name IS NULL,
''
, pp.interface_name)) AS interface_name,
LOWER(ec_b.card_id) AS card_id,
LOWER(ec_a.card_id) AS other_end_card_id,
LOWER(
IF(pp_b.interface_name IS NULL,
''
, pp_b.interface_name)) AS other_end_interface_name
''
, pp_b.interface_name)) AS interface_name,
LOWER(
IF(pp_a.interface_name IS NULL,
''
, pp_a.interface_name)) AS other_end_interface_name
FROM circuit c
INNER JOIN circuit_connections cc
ON cc.circ_absid = c.absid
LEFT JOIN pop pop
ON pop.absid = cc.PTR_pop_a
LEFT JOIN pop pop
_a
ON pop
_a
.absid = cc.PTR_pop_a
LEFT JOIN pop pop_b
ON pop_b.absid = cc.PTR_pop_b
INNER JOIN equipment e
ON e.absid = cc.PTR_equip_a
INNER JOIN equipment e
_a
ON e
_a
.absid = cc.PTR_equip_a
LEFT JOIN equipment e_b
ON e_b.absid = cc.PTR_equip_b
LEFT JOIN events
ON events.absid = cc.PTR_project
INNER JOIN equipment_card ec
ON ec.absid = cc.PTR_card_a
INNER JOIN equipment_card ec
_a
ON ec
_a
.absid = cc.PTR_card_a
LEFT JOIN equipment_card ec_b
ON ec_b.absid = cc.PTR_card_b
LEFT JOIN organisation o
ON o.absid = ec.manufacturer
LEFT JOIN port_plugin pp
ON pp.PTR_card = cc.PTR_card_a AND pp.port = cc.port_a
ON o.absid = ec_a.manufacturer
LEFT JOIN port_plugin pp_a
ON pp_a.PTR_card = cc.PTR_card_a
AND pp_a.port = cc.port_a
LEFT JOIN port_plugin pp_b
ON pp_b.PTR_card = cc.PTR_card_b
AND pp_b.port = cc.port_b
...
...
@@ -129,6 +131,7 @@ retrieve_services_query = """SELECT *
AS inner_query
WHERE circuit_type IN (
'
path
'
,
'
service
'
,
'
l2circuit
'
)
ORDER BY
name,
FIELD(status,
'
spare
'
,
'
planned
'
,
...
...
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