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

updated test and data to align with refactor

parent 167955ed
No related branches found
No related tags found
No related merge requests found
......@@ -25,62 +25,7 @@
"createuserid": 6727,
"csc": null,
"cscid": null,
"customer": {
"accountemail": "",
"accountmanager": "",
"address": "",
"channelreservations": null,
"circuits": null,
"code": "",
"contractcustomerrelations": null,
"country": null,
"countryid": null,
"customerrelatedcontacts": null,
"customerrelatedcontracts": null,
"customertype": null,
"customertypeid": 3,
"errors": null,
"esimprofiles": null,
"esims": null,
"faxnumber": "",
"fullname": "RENATER",
"haserrors": false,
"id": 57658,
"innumbers": null,
"ipranges": null,
"managementsystems": null,
"name": "RENATER",
"nodes": null,
"number": null,
"numbermanagementlist": null,
"olocircuits": null,
"orders": null,
"parentcustomer": null,
"parentcustomerid": null,
"phonenumber": "",
"portreservations": null,
"pwcodeblue": 0,
"pwemailsetups": null,
"pwextrainfo": "",
"pwinformatrisk": 1,
"pwinformdown": 1,
"pwinformedlist": null,
"pwinformimpact": 1,
"pwinformnoimpact": 1,
"pwinformprotectionswitch": 1,
"pwlanguage": "",
"racks": null,
"rowversion": "2020-01-31T13:35:10",
"servicecenter": 0,
"servicecentername": "",
"sites": null,
"sla": null,
"slaid": null,
"subcustomers": null,
"telephonenumberranges": null,
"telephonenumbers": null,
"website": ""
},
"customer": null,
"customerid": 57658,
"ddfodfports": null,
"ddfodfpositionfromto": null,
......@@ -115,7 +60,7 @@
"circuitalist": null,
"circuitblist": null,
"circuitid": 663060,
"comments": "SRV_GLOBAL CUSTOMER RENATER #RENATER_AP2 | ASN2200 |",
"comments": "SRV_GLOBAL CUSTOMER ORG_A #ORG_A_AP2 | ASN2200 |",
"condbase": "",
"directionid": 0,
"domain": null,
......@@ -256,7 +201,7 @@
"migrationdate": "2020-12-03T20:07:56",
"mspprotections": null,
"mspworkers": null,
"name": "RENATER_AP2",
"name": "ORG_A_AP2",
"nodea": null,
"nodeaid": 129531,
"nodeb": null,
......@@ -276,29 +221,7 @@
"portchannelrelations": null,
"portreservations": null,
"ports": [],
"product": {
"aliasproduct": "",
"circuits": [],
"contid": "",
"createsubcircuits": "",
"description": "IP ACCESS",
"diameter": null,
"domain": null,
"domainid": null,
"errors": null,
"fiberlosspermeter": null,
"groupid": "",
"haserrors": false,
"id": 3804,
"materialtypes": null,
"name": "GEANT IP",
"productlines": "",
"report": 0,
"rowversion": "2020-07-07T10:59:01",
"speed": null,
"speedid": null,
"thickness": null
},
"product": null,
"productid": 3804,
"projectnumber": "",
"projectstatus": null,
......@@ -425,62 +348,7 @@
"createuserid": 6727,
"csc": null,
"cscid": null,
"customer": {
"accountemail": "",
"accountmanager": "",
"address": "",
"channelreservations": null,
"circuits": null,
"code": "",
"contractcustomerrelations": null,
"country": null,
"countryid": null,
"customerrelatedcontacts": null,
"customerrelatedcontracts": null,
"customertype": null,
"customertypeid": 3,
"errors": null,
"esimprofiles": null,
"esims": null,
"faxnumber": "",
"fullname": "ULAKBIM",
"haserrors": false,
"id": 57664,
"innumbers": null,
"ipranges": null,
"managementsystems": null,
"name": "ULAKBIM",
"nodes": null,
"number": null,
"numbermanagementlist": null,
"olocircuits": null,
"orders": null,
"parentcustomer": null,
"parentcustomerid": null,
"phonenumber": "",
"portreservations": null,
"pwcodeblue": 0,
"pwemailsetups": null,
"pwextrainfo": "",
"pwinformatrisk": 1,
"pwinformdown": 1,
"pwinformedlist": null,
"pwinformimpact": 1,
"pwinformnoimpact": 1,
"pwinformprotectionswitch": 1,
"pwlanguage": "",
"racks": null,
"rowversion": "2020-01-31T13:35:11",
"servicecenter": 0,
"servicecentername": "",
"sites": null,
"sla": null,
"slaid": null,
"subcustomers": null,
"telephonenumberranges": null,
"telephonenumbers": null,
"website": ""
},
"customer": null,
"customerid": 57664,
"ddfodfports": null,
"ddfodfpositionfromto": null,
......@@ -515,7 +383,7 @@
"circuitalist": null,
"circuitblist": null,
"circuitid": 663104,
"comments": "SRV_IAS CUSTOMER ULAKBIM #ULAKBIM_AP2_IAS IASPS | ASN8517",
"comments": "SRV_IAS CUSTOMER ORG_B #ORG_B_AP2_IAS IASPS | ASN8517",
"condbase": "",
"directionid": 0,
"domain": null,
......@@ -656,7 +524,7 @@
"migrationdate": "2020-10-07T17:49:04",
"mspprotections": null,
"mspworkers": null,
"name": "ULAKBIM_AP2_IAS",
"name": "ORG_B_AP2_IAS",
"nodea": null,
"nodeaid": 129526,
"nodeb": null,
......@@ -676,29 +544,7 @@
"portchannelrelations": null,
"portreservations": null,
"ports": [],
"product": {
"aliasproduct": "",
"circuits": [],
"contid": "",
"createsubcircuits": "",
"description": "[NOT IN OPSDB]",
"diameter": null,
"domain": null,
"domainid": null,
"errors": null,
"fiberlosspermeter": null,
"groupid": "",
"haserrors": false,
"id": 3810,
"materialtypes": null,
"name": "GEANT PEERING",
"productlines": "",
"report": 0,
"rowversion": "2020-07-07T10:59:01",
"speed": null,
"speedid": null,
"thickness": null
},
"product": null,
"productid": 3810,
"projectnumber": "",
"projectstatus": null,
......@@ -825,62 +671,7 @@
"createuserid": 8338,
"csc": null,
"cscid": null,
"customer": {
"accountemail": "",
"accountmanager": "",
"address": "",
"channelreservations": null,
"circuits": null,
"code": "",
"contractcustomerrelations": null,
"country": null,
"countryid": null,
"customerrelatedcontacts": null,
"customerrelatedcontracts": null,
"customertype": null,
"customertypeid": null,
"errors": null,
"esimprofiles": null,
"esims": null,
"faxnumber": "",
"fullname": "ETH",
"haserrors": false,
"id": 57744,
"innumbers": null,
"ipranges": null,
"managementsystems": null,
"name": "ETH",
"nodes": null,
"number": null,
"numbermanagementlist": null,
"olocircuits": null,
"orders": null,
"parentcustomer": null,
"parentcustomerid": null,
"phonenumber": "",
"portreservations": null,
"pwcodeblue": 0,
"pwemailsetups": null,
"pwextrainfo": "",
"pwinformatrisk": 0,
"pwinformdown": 0,
"pwinformedlist": null,
"pwinformimpact": 0,
"pwinformnoimpact": 0,
"pwinformprotectionswitch": 0,
"pwlanguage": "",
"racks": null,
"rowversion": "2020-02-07T14:46:15",
"servicecenter": 0,
"servicecentername": "",
"sites": null,
"sla": null,
"slaid": null,
"subcustomers": null,
"telephonenumberranges": null,
"telephonenumbers": null,
"website": ""
},
"customer": null,
"customerid": 57744,
"ddfodfports": null,
"ddfodfpositionfromto": null,
......@@ -1406,29 +1197,7 @@
"vmportrelatelist": null
}
],
"product": {
"aliasproduct": "",
"circuits": [],
"contid": "",
"createsubcircuits": "",
"description": "ETHERNET",
"diameter": null,
"domain": null,
"domainid": null,
"errors": null,
"fiberlosspermeter": null,
"groupid": "",
"haserrors": false,
"id": 3677,
"materialtypes": null,
"name": "ETHERNET",
"productlines": "",
"report": 0,
"rowversion": "2020-04-06T12:28:38",
"speed": null,
"speedid": null,
"thickness": null
},
"product": null,
"productid": 3677,
"projectnumber": "",
"projectstatus": null,
......@@ -1529,4 +1298,4 @@
"wtoptunnelprotections": null,
"wtoptunnelworkers": null
}
]
\ No newline at end of file
]
......@@ -12,7 +12,7 @@ from inventory_provider.db.ims_data import lookup_lg_routers, \
def test_get_circuit_hierarchy(mocker):
ds = inventory_provider.db.ims.IMS(
'dummy_base', 'dummy_username', 'dummy_password')
'http://dummy_base', 'dummy_username', 'dummy_password')
with open('test/data/ims_circuit_hierarchy_data.json') as data:
se_data = json.load(data)
......@@ -20,6 +20,13 @@ def test_get_circuit_hierarchy(mocker):
inventory_provider.db.ims.IMS,
'get_all_entities'
)
mocker.patch.object(
inventory_provider.db.ims.IMS,
'get_filtered_entities',
side_effect=[[
{'selection': 'IP PEERING - R&E'}
]]
)
mocked_get.return_value = se_data
res = list(get_circuit_hierarchy(ds))
assert ds.get_all_entities.call_count == 1
......@@ -31,6 +38,7 @@ def test_get_circuit_hierarchy(mocker):
'product': 'IP PEERING - R&E',
'speed': 'ETHS',
'project': 'ORIENTPLUS',
'circuit-type': 'service',
'sub-circuits': [],
'carrier-circuits': [660461]
},
......@@ -41,6 +49,7 @@ def test_get_circuit_hierarchy(mocker):
'product': 'ETHERNET',
'speed': 'V-LAN',
'project': 'ORIENTPLUS',
'circuit-type': 'circuit',
'sub-circuits': [661591],
'carrier-circuits': [668866]
}
......@@ -104,37 +113,59 @@ def test_get_port_id_services(mocker):
with open('test/data/ims_port_id_services_data.json') as data:
d = json.load(data)
mocker.patch.object(
inventory_provider.db.ims.IMS,
'get_filtered_entities',
side_effect=[[
{'selection': 'GEANT IP'},
{'selection': 'GEANT PEERING'}
]]
)
mocker.patch.object(
inventory_provider.db.ims.IMS,
'get_all_entities',
side_effect=[d]
side_effect=[
[
{'id': 57658, 'name': 'ORG A'},
{'id': 57664, 'name': 'ORG B'},
{'id': 57744, 'name': 'ETH'},
],
[
{'id': 3804, 'name': 'GEANT IP'},
{'id': 3810, 'name': 'GEANT PEERING'},
{'id': 3677, 'name': 'ETHERNET'},
],
d,
[],
[]
]
)
ds = inventory_provider.db.ims.IMS(
'dummy_base', 'dummy_username', 'dummy_password')
'http://dummy_base', 'dummy_username', 'dummy_password')
res = list(get_port_id_services(ds))
# this is the number of different product types that are considered service
# and speed types that that cover circuit types that have relevant circuits
# and ethernet product type as other relevant circuits also need tracking
assert ds.get_all_entities.call_count == 1
assert ds.get_all_entities.call_count == 5
predicted = [
{
'id': 663060,
'name': 'RENATER_AP2',
'name': 'ORG_A_AP2',
'status': 'operational',
'circuit_type': 'service',
'service_type': 'GEANT IP',
'project': 'RENATER',
'project': 'ORG A',
'port_a_id': 224507,
},
{
'id': 663104,
'name': 'ULAKBIM_AP2_IAS',
'name': 'ORG_B_AP2_IAS',
'status': 'operational',
'circuit_type': 'service',
'service_type': 'GEANT PEERING',
'project': 'ULAKBIM',
'project': 'ORG B',
'port_a_id': 224464,
},
{
......
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