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 @@ ...@@ -25,62 +25,7 @@
"createuserid": 6727, "createuserid": 6727,
"csc": null, "csc": null,
"cscid": null, "cscid": null,
"customer": { "customer": null,
"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": ""
},
"customerid": 57658, "customerid": 57658,
"ddfodfports": null, "ddfodfports": null,
"ddfodfpositionfromto": null, "ddfodfpositionfromto": null,
...@@ -115,7 +60,7 @@ ...@@ -115,7 +60,7 @@
"circuitalist": null, "circuitalist": null,
"circuitblist": null, "circuitblist": null,
"circuitid": 663060, "circuitid": 663060,
"comments": "SRV_GLOBAL CUSTOMER RENATER #RENATER_AP2 | ASN2200 |", "comments": "SRV_GLOBAL CUSTOMER ORG_A #ORG_A_AP2 | ASN2200 |",
"condbase": "", "condbase": "",
"directionid": 0, "directionid": 0,
"domain": null, "domain": null,
...@@ -256,7 +201,7 @@ ...@@ -256,7 +201,7 @@
"migrationdate": "2020-12-03T20:07:56", "migrationdate": "2020-12-03T20:07:56",
"mspprotections": null, "mspprotections": null,
"mspworkers": null, "mspworkers": null,
"name": "RENATER_AP2", "name": "ORG_A_AP2",
"nodea": null, "nodea": null,
"nodeaid": 129531, "nodeaid": 129531,
"nodeb": null, "nodeb": null,
...@@ -276,29 +221,7 @@ ...@@ -276,29 +221,7 @@
"portchannelrelations": null, "portchannelrelations": null,
"portreservations": null, "portreservations": null,
"ports": [], "ports": [],
"product": { "product": null,
"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
},
"productid": 3804, "productid": 3804,
"projectnumber": "", "projectnumber": "",
"projectstatus": null, "projectstatus": null,
...@@ -425,62 +348,7 @@ ...@@ -425,62 +348,7 @@
"createuserid": 6727, "createuserid": 6727,
"csc": null, "csc": null,
"cscid": null, "cscid": null,
"customer": { "customer": null,
"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": ""
},
"customerid": 57664, "customerid": 57664,
"ddfodfports": null, "ddfodfports": null,
"ddfodfpositionfromto": null, "ddfodfpositionfromto": null,
...@@ -515,7 +383,7 @@ ...@@ -515,7 +383,7 @@
"circuitalist": null, "circuitalist": null,
"circuitblist": null, "circuitblist": null,
"circuitid": 663104, "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": "", "condbase": "",
"directionid": 0, "directionid": 0,
"domain": null, "domain": null,
...@@ -656,7 +524,7 @@ ...@@ -656,7 +524,7 @@
"migrationdate": "2020-10-07T17:49:04", "migrationdate": "2020-10-07T17:49:04",
"mspprotections": null, "mspprotections": null,
"mspworkers": null, "mspworkers": null,
"name": "ULAKBIM_AP2_IAS", "name": "ORG_B_AP2_IAS",
"nodea": null, "nodea": null,
"nodeaid": 129526, "nodeaid": 129526,
"nodeb": null, "nodeb": null,
...@@ -676,29 +544,7 @@ ...@@ -676,29 +544,7 @@
"portchannelrelations": null, "portchannelrelations": null,
"portreservations": null, "portreservations": null,
"ports": [], "ports": [],
"product": { "product": null,
"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
},
"productid": 3810, "productid": 3810,
"projectnumber": "", "projectnumber": "",
"projectstatus": null, "projectstatus": null,
...@@ -825,62 +671,7 @@ ...@@ -825,62 +671,7 @@
"createuserid": 8338, "createuserid": 8338,
"csc": null, "csc": null,
"cscid": null, "cscid": null,
"customer": { "customer": null,
"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": ""
},
"customerid": 57744, "customerid": 57744,
"ddfodfports": null, "ddfodfports": null,
"ddfodfpositionfromto": null, "ddfodfpositionfromto": null,
...@@ -1406,29 +1197,7 @@ ...@@ -1406,29 +1197,7 @@
"vmportrelatelist": null "vmportrelatelist": null
} }
], ],
"product": { "product": null,
"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
},
"productid": 3677, "productid": 3677,
"projectnumber": "", "projectnumber": "",
"projectstatus": null, "projectstatus": null,
...@@ -1529,4 +1298,4 @@ ...@@ -1529,4 +1298,4 @@
"wtoptunnelprotections": null, "wtoptunnelprotections": null,
"wtoptunnelworkers": null "wtoptunnelworkers": null
} }
] ]
\ No newline at end of file
...@@ -12,7 +12,7 @@ from inventory_provider.db.ims_data import lookup_lg_routers, \ ...@@ -12,7 +12,7 @@ from inventory_provider.db.ims_data import lookup_lg_routers, \
def test_get_circuit_hierarchy(mocker): def test_get_circuit_hierarchy(mocker):
ds = inventory_provider.db.ims.IMS( 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: with open('test/data/ims_circuit_hierarchy_data.json') as data:
se_data = json.load(data) se_data = json.load(data)
...@@ -20,6 +20,13 @@ def test_get_circuit_hierarchy(mocker): ...@@ -20,6 +20,13 @@ def test_get_circuit_hierarchy(mocker):
inventory_provider.db.ims.IMS, inventory_provider.db.ims.IMS,
'get_all_entities' '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 mocked_get.return_value = se_data
res = list(get_circuit_hierarchy(ds)) res = list(get_circuit_hierarchy(ds))
assert ds.get_all_entities.call_count == 1 assert ds.get_all_entities.call_count == 1
...@@ -31,6 +38,7 @@ def test_get_circuit_hierarchy(mocker): ...@@ -31,6 +38,7 @@ def test_get_circuit_hierarchy(mocker):
'product': 'IP PEERING - R&E', 'product': 'IP PEERING - R&E',
'speed': 'ETHS', 'speed': 'ETHS',
'project': 'ORIENTPLUS', 'project': 'ORIENTPLUS',
'circuit-type': 'service',
'sub-circuits': [], 'sub-circuits': [],
'carrier-circuits': [660461] 'carrier-circuits': [660461]
}, },
...@@ -41,6 +49,7 @@ def test_get_circuit_hierarchy(mocker): ...@@ -41,6 +49,7 @@ def test_get_circuit_hierarchy(mocker):
'product': 'ETHERNET', 'product': 'ETHERNET',
'speed': 'V-LAN', 'speed': 'V-LAN',
'project': 'ORIENTPLUS', 'project': 'ORIENTPLUS',
'circuit-type': 'circuit',
'sub-circuits': [661591], 'sub-circuits': [661591],
'carrier-circuits': [668866] 'carrier-circuits': [668866]
} }
...@@ -104,37 +113,59 @@ def test_get_port_id_services(mocker): ...@@ -104,37 +113,59 @@ def test_get_port_id_services(mocker):
with open('test/data/ims_port_id_services_data.json') as data: with open('test/data/ims_port_id_services_data.json') as data:
d = json.load(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( mocker.patch.object(
inventory_provider.db.ims.IMS, inventory_provider.db.ims.IMS,
'get_all_entities', '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( 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)) res = list(get_port_id_services(ds))
# this is the number of different product types that are considered service # 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 speed types that that cover circuit types that have relevant circuits
# and ethernet product type as other relevant circuits also need tracking # 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 = [ predicted = [
{ {
'id': 663060, 'id': 663060,
'name': 'RENATER_AP2', 'name': 'ORG_A_AP2',
'status': 'operational', 'status': 'operational',
'circuit_type': 'service', 'circuit_type': 'service',
'service_type': 'GEANT IP', 'service_type': 'GEANT IP',
'project': 'RENATER', 'project': 'ORG A',
'port_a_id': 224507, 'port_a_id': 224507,
}, },
{ {
'id': 663104, 'id': 663104,
'name': 'ULAKBIM_AP2_IAS', 'name': 'ORG_B_AP2_IAS',
'status': 'operational', 'status': 'operational',
'circuit_type': 'service', 'circuit_type': 'service',
'service_type': 'GEANT PEERING', 'service_type': 'GEANT PEERING',
'project': 'ULAKBIM', 'project': 'ORG B',
'port_a_id': 224464, 'port_a_id': 224464,
}, },
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment