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
339417dc
Commit
339417dc
authored
1 year ago
by
Saket Agrahari
Browse files
Options
Downloads
Patches
Plain Diff
[DBOARD3-676]: Adding testing for mic
parent
b2382b11
No related branches found
No related tags found
1 merge request
!26
Adding testing for mic
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/db/ims_data.py
+30
-33
30 additions, 33 deletions
inventory_provider/db/ims_data.py
with
30 additions
and
33 deletions
inventory_provider/db/ims_data.py
+
30
−
33
View file @
339417dc
...
@@ -60,13 +60,12 @@ NODE_LOCATION_SCHEMA = {
...
@@ -60,13 +60,12 @@ NODE_LOCATION_SCHEMA = {
'
properties
'
:
{
'
properties
'
:
{
'
equipment-name
'
:
{
'
type
'
:
'
string
'
},
'
equipment-name
'
:
{
'
type
'
:
'
string
'
},
'
status
'
:
{
'
type
'
:
'
string
'
},
'
status
'
:
{
'
type
'
:
'
string
'
},
'
pop
'
:
{
'
$ref
'
:
'
#/definitions/pop-location
'
}
'
pop
'
:
{
'
$ref
'
:
'
#/definitions/pop-location
'
}
},
},
'
required
'
:
[
'
equipment-name
'
,
'
status
'
,
'
pop
'
],
'
required
'
:
[
'
equipment-name
'
,
'
status
'
,
'
pop
'
],
'
additionalProperties
'
:
False
'
additionalProperties
'
:
False
}
}
SITE_LOCATION_SCHEMA
=
{
SITE_LOCATION_SCHEMA
=
{
'
$schema
'
:
'
https://json-schema.org/draft-07/schema#
'
,
'
$schema
'
:
'
https://json-schema.org/draft-07/schema#
'
,
**
_POP_LOCATION_SCHEMA_STRUCT
**
_POP_LOCATION_SCHEMA_STRUCT
...
@@ -117,12 +116,13 @@ def get_monitored_circuit_ids(ds: IMS):
...
@@ -117,12 +116,13 @@ def get_monitored_circuit_ids(ds: IMS):
@log_entry_and_exit
@log_entry_and_exit
def
get_ids_and_sids
(
ds
:
IMS
):
def
get_ids_and_sids
(
ds
:
IMS
):
for
sid_circuit
in
ds
.
get_filtered_entities
(
for
sid_circuit
in
ds
.
get_filtered_entities
(
'
ExtraFieldValue
'
,
'
ExtraFieldValue
'
,
'
extrafieldid == 3209 | value <>
""'
,
'
extrafieldid == 3209 | value <>
""'
,
step_count
=
10000
step_count
=
10000
):
):
yield
sid_circuit
[
'
objectid
'
],
sid_circuit
[
'
value
'
]
yield
sid_circuit
[
'
objectid
'
],
sid_circuit
[
'
value
'
]
@log_entry_and_exit
@log_entry_and_exit
def
get_ids_and_third_party_ids
(
ds
:
IMS
):
def
get_ids_and_third_party_ids
(
ds
:
IMS
):
for
circuit
in
ds
.
get_filtered_entities
(
for
circuit
in
ds
.
get_filtered_entities
(
...
@@ -132,6 +132,7 @@ def get_ids_and_third_party_ids(ds: IMS):
...
@@ -132,6 +132,7 @@ def get_ids_and_third_party_ids(ds: IMS):
):
):
yield
circuit
[
'
objectid
'
],
circuit
[
'
value
'
]
yield
circuit
[
'
objectid
'
],
circuit
[
'
value
'
]
@log_entry_and_exit
@log_entry_and_exit
def
get_service_types
(
ds
:
IMS
):
def
get_service_types
(
ds
:
IMS
):
for
d
in
ds
.
get_filtered_entities
(
for
d
in
ds
.
get_filtered_entities
(
...
@@ -142,13 +143,12 @@ def get_service_types(ds: IMS):
...
@@ -142,13 +143,12 @@ def get_service_types(ds: IMS):
@log_entry_and_exit
@log_entry_and_exit
def
get_customer_tts_contacts
(
ds
:
IMS
):
def
get_customer_tts_contacts
(
ds
:
IMS
):
customer_contacts
=
defaultdict
(
set
)
customer_contacts
=
defaultdict
(
set
)
for
x
in
ds
.
get_filtered_entities
(
for
x
in
ds
.
get_filtered_entities
(
'
customerrelatedcontact
'
,
'
customerrelatedcontact
'
,
"
contact.troubleticketMail !=
''"
,
"
contact.troubleticketMail !=
''"
,
CUSTOMER_RELATED_CONTACT_PROPERTIES
[
'
Contact
'
]
CUSTOMER_RELATED_CONTACT_PROPERTIES
[
'
Contact
'
]
):
):
customer_contacts
[
x
[
'
customerid
'
]].
add
(
customer_contacts
[
x
[
'
customerid
'
]].
add
(
x
[
'
contact
'
][
'
troubleticketmail
'
])
x
[
'
contact
'
][
'
troubleticketmail
'
])
...
@@ -158,13 +158,12 @@ def get_customer_tts_contacts(ds: IMS):
...
@@ -158,13 +158,12 @@ def get_customer_tts_contacts(ds: IMS):
@log_entry_and_exit
@log_entry_and_exit
def
get_customer_planned_work_contacts
(
ds
:
IMS
):
def
get_customer_planned_work_contacts
(
ds
:
IMS
):
customer_contacts
=
defaultdict
(
set
)
customer_contacts
=
defaultdict
(
set
)
for
x
in
ds
.
get_filtered_entities
(
for
x
in
ds
.
get_filtered_entities
(
'
customerrelatedcontact
'
,
'
customerrelatedcontact
'
,
"
contact.PlannedworkMail !=
''"
,
"
contact.PlannedworkMail !=
''"
,
CUSTOMER_RELATED_CONTACT_PROPERTIES
[
'
Contact
'
]
CUSTOMER_RELATED_CONTACT_PROPERTIES
[
'
Contact
'
]
):
):
customer_contacts
[
x
[
'
customerid
'
]].
add
(
customer_contacts
[
x
[
'
customerid
'
]].
add
(
x
[
'
contact
'
][
'
plannedworkmail
'
])
x
[
'
contact
'
][
'
plannedworkmail
'
])
...
@@ -174,11 +173,10 @@ def get_customer_planned_work_contacts(ds: IMS):
...
@@ -174,11 +173,10 @@ def get_customer_planned_work_contacts(ds: IMS):
@log_entry_and_exit
@log_entry_and_exit
def
get_circuit_related_customers
(
ds
:
IMS
):
def
get_circuit_related_customers
(
ds
:
IMS
):
return_value
=
defaultdict
(
list
)
return_value
=
defaultdict
(
list
)
for
ccr
in
ds
.
get_filtered_entities
(
for
ccr
in
ds
.
get_filtered_entities
(
'
CircuitCustomerRelation
'
,
'
CircuitCustomerRelation
'
,
'
circuit.inventoryStatusId== 3
'
,
'
circuit.inventoryStatusId== 3
'
,
ims
.
CIRCUIT_CUSTOMER_RELATION
[
'
Customer
'
]):
ims
.
CIRCUIT_CUSTOMER_RELATION
[
'
Customer
'
]):
return_value
[
ccr
[
'
circuitid
'
]].
append
(
return_value
[
ccr
[
'
circuitid
'
]].
append
(
{
{
...
@@ -481,13 +479,13 @@ def get_site_locations(ds: IMS):
...
@@ -481,13 +479,13 @@ def get_site_locations(ds: IMS):
has_geo_data
=
bool
(
site
.
get
(
'
longitude
'
)
and
site
.
get
(
'
latitude
'
))
has_geo_data
=
bool
(
site
.
get
(
'
longitude
'
)
and
site
.
get
(
'
latitude
'
))
if
abbreviation
and
has_geo_data
:
if
abbreviation
and
has_geo_data
:
yield
site
[
'
name
'
],
{
yield
site
[
'
name
'
],
{
'
name
'
:
site
[
'
name
'
],
'
name
'
:
site
[
'
name
'
],
'
city
'
:
city
[
'
name
'
],
'
city
'
:
city
[
'
name
'
],
'
country
'
:
city
[
'
country
'
][
'
name
'
],
'
country
'
:
city
[
'
country
'
][
'
name
'
],
'
abbreviation
'
:
abbreviation
,
'
abbreviation
'
:
abbreviation
,
'
longitude
'
:
site
[
'
longitude
'
],
'
longitude
'
:
site
[
'
longitude
'
],
'
latitude
'
:
site
[
'
latitude
'
],
'
latitude
'
:
site
[
'
latitude
'
],
}
}
@log_entry_and_exit
@log_entry_and_exit
...
@@ -616,14 +614,14 @@ def lookup_lg_routers(ds: IMS):
...
@@ -616,14 +614,14 @@ def lookup_lg_routers(ds: IMS):
'
INTERNAL
'
'
INTERNAL
'
if
site
[
'
name
'
]
in
INTERNAL_POP_NAMES
if
site
[
'
name
'
]
in
INTERNAL_POP_NAMES
else
'
CORE
'
,
else
'
CORE
'
,
'
pop
'
:
{
'
pop
'
:
{
'
name
'
:
site
[
'
name
'
],
'
name
'
:
site
[
'
name
'
],
'
city
'
:
city
[
'
name
'
],
'
city
'
:
city
[
'
name
'
],
'
country
'
:
city
[
'
country
'
][
'
name
'
],
'
country
'
:
city
[
'
country
'
][
'
name
'
],
'
country code
'
:
city
[
'
country
'
][
'
abbreviation
'
],
'
country code
'
:
city
[
'
country
'
][
'
abbreviation
'
],
'
abbreviation
'
:
abbreviation
,
'
abbreviation
'
:
abbreviation
,
'
longitude
'
:
site
[
'
longitude
'
],
'
longitude
'
:
site
[
'
longitude
'
],
'
latitude
'
:
site
[
'
latitude
'
],
'
latitude
'
:
site
[
'
latitude
'
],
}
}
}
}
yield
eq
yield
eq
...
@@ -631,8 +629,7 @@ def lookup_lg_routers(ds: IMS):
...
@@ -631,8 +629,7 @@ def lookup_lg_routers(ds: IMS):
@log_entry_and_exit
@log_entry_and_exit
def
lookup_geant_nodes
(
ds
:
IMS
):
def
lookup_geant_nodes
(
ds
:
IMS
):
return
(
n
[
"
name
"
]
for
n
in
ds
.
get_filtered_entities
(
return
(
n
[
"
name
"
]
for
n
in
ds
.
get_filtered_entities
(
'
Node
'
,
'
Node
'
,
'
customer.Name ==
"
GEANT
"'
,
'
customer.Name ==
"
GEANT
"'
,
ims
.
EQUIP_DEF_PROPERTIES
[
'
Nodes
'
]))
ims
.
EQUIP_DEF_PROPERTIES
[
'
Nodes
'
]))
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