Skip to content
Snippets Groups Projects
Commit 63957527 authored by Robert Latta's avatar Robert Latta
Browse files

Updated to get other end of circuit connection information

parent 993250bd
No related branches found
No related tags found
No related merge requests found
......@@ -50,26 +50,40 @@ retrieve_services_query = """SELECT *
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
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,
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
'', pp.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
INNER JOIN equipment e
ON e.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
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
LEFT JOIN port_plugin pp_b
ON pp_b.PTR_card = cc.PTR_card_b
AND pp_b.port = cc.port_b
WHERE c.status != 'terminated' AND is_circuit = 1
UNION
SELECT
......@@ -80,91 +94,41 @@ retrieve_services_query = """SELECT *
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
e.name AS equipment,
e_b.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
'', pp.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
INNER JOIN equipment e
ON e.absid = cc.PTR_equip_b
LEFT JOIN equipment e_b
ON e_b.absid = cc.PTR_equip_a
LEFT JOIN events
ON events.absid = cc.PTR_project
INNER JOIN equipment_card ec
ON ec.absid = cc.PTR_card_b
LEFT JOIN equipment_card ec_b
ON ec_b.absid = cc.PTR_card_a
LEFT JOIN organisation o
ON o.absid = ec.manufacturer
LEFT JOIN port_plugin pp
ON pp.PTR_card = cc.PTR_card_b AND pp.port = cc.port_b
WHERE c.status != 'terminated' AND is_circuit = 1
UNION
SELECT
c.absid AS id,
c.name,
LOWER(c.status) AS status,
LOWER(c.circuit_type) AS circuit_type,
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
e.name AS equipment,
cc.port_a_OUT AS port,
cc.int_LU_a AS logical_unit,
LOWER(o.name) AS manufacturer,
LOWER(ec.card_id) AS card_id,
LOWER(
IF(pp.interface_name IS NULL,
'', pp.interface_name)) AS interface_name
FROM circuit c
INNER JOIN circuit_connections cc
ON cc.circ_absid = c.absid
INNER JOIN equipment e
ON e.absid = cc.PTR_equip_a
LEFT JOIN events
ON events.absid = cc.PTR_project
INNER JOIN equipment_card ec
ON ec.absid = cc.PTR_card_a_OUT
LEFT JOIN organisation o
ON o.absid = ec.manufacturer
LEFT JOIN port_plugin pp
ON pp.PTR_card = cc.PTR_card_a_OUT
AND pp.port = cc.port_a_OUT
WHERE c.status != 'terminated' AND is_circuit = 1
UNION
SELECT
c.absid AS id,
c.name,
LOWER(c.status) AS status,
LOWER(c.circuit_type) AS circuit_type,
LOWER(c.service_type) AS service_type,
events.short_descr AS project,
e.name AS equipment,
cc.port_b_OUT AS port,
cc.int_LU_b AS logical_unit,
LOWER(o.name) AS manufacturer,
LOWER(ec.card_id) AS card_id,
LOWER(
IF(pp.interface_name IS NULL,
'', pp.interface_name)) AS interface_name
FROM circuit c
INNER JOIN circuit_connections cc
ON cc.circ_absid = c.absid
INNER JOIN equipment e
ON e.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_b_OUT
LEFT JOIN organisation o
ON o.absid = ec.manufacturer
LEFT JOIN port_plugin pp
ON pp.PTR_card = cc.PTR_card_b_OUT
AND pp.port = cc.port_b_OUT
WHERE
c.status != 'terminated'
AND is_circuit = 1)
LEFT JOIN port_plugin pp_b
ON pp_b.PTR_card = cc.PTR_card_a
AND pp_b.port = cc.port_a
WHERE c.status != 'terminated' AND is_circuit = 1)
AS inner_query
WHERE circuit_type IN ('path', 'service', 'l2circuit')
ORDER BY
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment