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

added test for get_port_details

parent e9f629da
Branches
Tags
No related merge requests found
[
{
"adminstatus": 1,
"bridgedomains": null,
"card": null,
"cardid": null,
"childinternalports": null,
"circuit": null,
"circuitalist": null,
"circuitblist": null,
"circuitid": 658684,
"comments": "LAG INFRASTRUCTURE LAN | MX AE30",
"condbase": "",
"directionid": 0,
"domain": null,
"domainid": null,
"errors": null,
"haserrors": false,
"id": 222451,
"internalporttemplate": null,
"internalporttemplateid": 5010,
"ipaddresses": null,
"iprelates": null,
"linestatus": 1,
"macaddress": "D4:04:FF:C6:5E:F0",
"mtu": 9192,
"name": "AE0",
"node": {
"acpowerconsumption": null,
"alarms": null,
"angle": null,
"batterybackuphoursordered": null,
"bridgedomains": null,
"builddate": "2020-02-11T21:28:45",
"cards": null,
"configuration": "",
"createuser": null,
"createuserid": 6727,
"customer": null,
"customerid": 57640,
"dcpowerconsumption": null,
"directionangle": null,
"domain": null,
"domainid": 2686,
"equipmentdefinition": {
"_height": 0,
"_width": 0,
"acpowerconsumption": null,
"cardcodedefinitions": null,
"carddefinitions": null,
"childequipmentdefinitionrelations": null,
"commandsgroup": null,
"commandsgroupid": null,
"contractid": null,
"dcpowerconsumption": null,
"defaultangle": null,
"defaultcustomer": null,
"defaultcustomerid": null,
"defaultdomain": null,
"defaultdomainid": null,
"defaultlayer": "",
"defaultmanagementsystem": null,
"defaultmanagementsystemid": null,
"defaultplatformname": "",
"defaultrange": null,
"defphysspeeds": "1GBE|10GBE|40GBE|10G",
"depreciationperiod": null,
"depth": 0,
"description": "",
"endoflive": null,
"endofmaincontract": null,
"endofsale": null,
"eqdefvariant": "",
"equipmentdefinitioncounts": null,
"equipmentkind": "ROUTER",
"equipmentpicture": "",
"errors": null,
"extrainfo": "",
"haserrors": false,
"hasswport": null,
"heatemission": null,
"heatproduction": null,
"height": 0,
"id": 6937,
"internalporttemplates": null,
"isiptype": null,
"isvirtual": 0,
"klm": null,
"materialtypes": null,
"name": "JUNIPER VIRTUAL CHASSIS",
"nodenametemplate": "",
"nodes": [],
"nodetemplates": null,
"numberofunits": 0.0,
"ownerrules": null,
"parentequipmentdefinitionrelations": null,
"partofmaintcontract": "",
"porttemplates": null,
"powerconsume": null,
"rateacpower": null,
"ratedcpower": null,
"ratevolume": 1,
"reconcileequipmentdefinitions": null,
"redundanttype": "",
"rowversion": "2020-02-11T17:56:48",
"shape": "RECTANGLE",
"shapecolor": "BLUE",
"shapetext": "JNR VS",
"shelfdefinitions": null,
"slotdefinitions": null,
"templates": null,
"vendor": {
"cabletypes": null,
"cardcodes": null,
"carddefinitions": null,
"color": "",
"contract": null,
"description": "",
"equipmentdefinitions": [],
"errors": null,
"escalationdescription": "",
"esimprofiles": null,
"esims": null,
"eumid": "",
"haserrors": false,
"id": 2702,
"internetaddress": "",
"issuercodeesim": null,
"managementsystems": null,
"masteraccount": "",
"mnocode": "",
"name": "JUNIPER",
"operatorcompanynumbers": null,
"orders": null,
"purchaseorders": null,
"rowversion": "2020-02-11T17:03:18",
"sites": null,
"sladescription": "",
"slalink": "",
"slamaintimetorepair": null,
"slamaintimetorepairid": null,
"slaonsite": null,
"slaonsiteid": null,
"spareowner": "",
"stockcontact": "",
"stockitems": null,
"stocklocation": "",
"type": null,
"typeid": 1,
"vendormaterialtypes": null,
"vendorrelatedcontacts": null
},
"vendorequipmentdefinitionname": "VIRTUAL CHASSIS",
"vendorid": 2702,
"weight": 0,
"width": 0
},
"equipmentdefinitionid": 6937,
"errors": null,
"extrainfo": "",
"extrainfoimportant": 0,
"fuseconsumption": null,
"hardwarebuildnumber": null,
"hardwarerevision": "REV 06",
"haserrors": false,
"heatemission": null,
"heightinrack": null,
"id": 129058,
"inservicedate": "2020-02-20T20:21:17",
"internalports": [],
"inventorystatusid": 3,
"ipaddress": "",
"iprelates": null,
"leftinrack": 0,
"managementsystem": {
"customer": null,
"customerid": null,
"errors": null,
"haserrors": false,
"id": 2356,
"name": "JUNIPER_MPLS",
"networkaddress": "",
"nodes": [],
"reconcileschemaname": "IF_JUNIPER_MPLS",
"rowversion": "2020-02-11T16:01:10",
"vendor": null,
"vendorid": null
},
"managementsystemid": 2356,
"mplsprot": "",
"name": "QFX.FRA.DE",
"networkaddress": "",
"networkmapnodeobject": null,
"networkrole": "",
"nodealiases": null,
"nodeattachments": null,
"nodecounts": null,
"numberrangenoderelations": null,
"order": null,
"orderid": null,
"outofservicedate": null,
"parentnode": null,
"parentnodeid": null,
"plmidate": null,
"ploosdate": null,
"ports": null,
"powerconsume": 0,
"rack": null,
"rackframe": null,
"rackframeid": null,
"rackid": 113129,
"rackside": null,
"range": null,
"ratebatterybackup": null,
"ratedieselgeneratorbackup": null,
"ratevolume": null,
"reconcilenodes": null,
"relatedorders": null,
"requestor": "",
"ring": null,
"ringid": 4230,
"rowversion": "2020-05-20T13:52:08",
"sectors": null,
"serialnumber": "",
"servicecontract": "",
"shelves": null,
"shouldnotberatedacpower": null,
"shouldnotberateddcpower": null,
"shouldnotberateddiesel": null,
"shouldnotberatedvolume": null,
"site": null,
"siteid": 445254,
"sla": "",
"softwareversion": "17.3R3-S3.3",
"stockitem": null,
"stockitemid": null,
"subnodelist": null,
"systemaccountnoderelations": null,
"ups": null,
"upsinfo": "",
"variant": "",
"vminternalportrelatelist": null,
"vmportrelatelist": null
},
"nodeid": 129058,
"parentinternalport": null,
"parentinternalportid": null,
"portstatus": "",
"projectnumber": "",
"projectstatus": 1,
"recidcondbase": null,
"reconcilecircuitinternalports": null,
"reservedby": "",
"reserveddate": null,
"reservednumber": "",
"rowversion": "2021-01-12T09:21:30",
"sequencenumber": 2,
"shelf": null,
"shelfid": null,
"site": null,
"siteid": 445254,
"tobeceasedrelatedinternalportid": null,
"txrx": null,
"virtualswitchid": null,
"vminternalportrelatelist": null
},
{
"adminstatus": 1,
"bridgedomains": null,
"card": null,
"cardid": null,
"childinternalports": null,
"circuit": null,
"circuitalist": null,
"circuitblist": null,
"circuitid": 658529,
"comments": "LAG INFRASTRUCTURE LAN | 730XD-1 ESXI TRAFFIC LAG",
"condbase": "",
"directionid": 0,
"domain": null,
"domainid": null,
"errors": null,
"haserrors": false,
"id": 222452,
"internalporttemplate": null,
"internalporttemplateid": 5011,
"ipaddresses": null,
"iprelates": null,
"linestatus": 1,
"macaddress": "D4:04:FF:C6:5E:F1",
"mtu": 9216,
"name": "AE1",
"node": {
"acpowerconsumption": null,
"alarms": null,
"angle": null,
"batterybackuphoursordered": null,
"bridgedomains": null,
"builddate": "2020-02-11T21:28:45",
"cards": null,
"configuration": "",
"createuser": null,
"createuserid": 6727,
"customer": null,
"customerid": 57640,
"dcpowerconsumption": null,
"directionangle": null,
"domain": null,
"domainid": 2686,
"equipmentdefinition": {
"_height": 0,
"_width": 0,
"acpowerconsumption": null,
"cardcodedefinitions": null,
"carddefinitions": null,
"childequipmentdefinitionrelations": null,
"commandsgroup": null,
"commandsgroupid": null,
"contractid": null,
"dcpowerconsumption": null,
"defaultangle": null,
"defaultcustomer": null,
"defaultcustomerid": null,
"defaultdomain": null,
"defaultdomainid": null,
"defaultlayer": "",
"defaultmanagementsystem": null,
"defaultmanagementsystemid": null,
"defaultplatformname": "",
"defaultrange": null,
"defphysspeeds": "1GBE|10GBE|40GBE|10G",
"depreciationperiod": null,
"depth": 0,
"description": "",
"endoflive": null,
"endofmaincontract": null,
"endofsale": null,
"eqdefvariant": "",
"equipmentdefinitioncounts": null,
"equipmentkind": "ROUTER",
"equipmentpicture": "",
"errors": null,
"extrainfo": "",
"haserrors": false,
"hasswport": null,
"heatemission": null,
"heatproduction": null,
"height": 0,
"id": 6937,
"internalporttemplates": null,
"isiptype": null,
"isvirtual": 0,
"klm": null,
"materialtypes": null,
"name": "JUNIPER VIRTUAL CHASSIS",
"nodenametemplate": "",
"nodes": [],
"nodetemplates": null,
"numberofunits": 0.0,
"ownerrules": null,
"parentequipmentdefinitionrelations": null,
"partofmaintcontract": "",
"porttemplates": null,
"powerconsume": null,
"rateacpower": null,
"ratedcpower": null,
"ratevolume": 1,
"reconcileequipmentdefinitions": null,
"redundanttype": "",
"rowversion": "2020-02-11T17:56:48",
"shape": "RECTANGLE",
"shapecolor": "BLUE",
"shapetext": "JNR VS",
"shelfdefinitions": null,
"slotdefinitions": null,
"templates": null,
"vendor": {
"cabletypes": null,
"cardcodes": null,
"carddefinitions": null,
"color": "",
"contract": null,
"description": "",
"equipmentdefinitions": [],
"errors": null,
"escalationdescription": "",
"esimprofiles": null,
"esims": null,
"eumid": "",
"haserrors": false,
"id": 2702,
"internetaddress": "",
"issuercodeesim": null,
"managementsystems": null,
"masteraccount": "",
"mnocode": "",
"name": "JUNIPER",
"operatorcompanynumbers": null,
"orders": null,
"purchaseorders": null,
"rowversion": "2020-02-11T17:03:18",
"sites": null,
"sladescription": "",
"slalink": "",
"slamaintimetorepair": null,
"slamaintimetorepairid": null,
"slaonsite": null,
"slaonsiteid": null,
"spareowner": "",
"stockcontact": "",
"stockitems": null,
"stocklocation": "",
"type": null,
"typeid": 1,
"vendormaterialtypes": null,
"vendorrelatedcontacts": null
},
"vendorequipmentdefinitionname": "VIRTUAL CHASSIS",
"vendorid": 2702,
"weight": 0,
"width": 0
},
"equipmentdefinitionid": 6937,
"errors": null,
"extrainfo": "",
"extrainfoimportant": 0,
"fuseconsumption": null,
"hardwarebuildnumber": null,
"hardwarerevision": "REV 06",
"haserrors": false,
"heatemission": null,
"heightinrack": null,
"id": 129058,
"inservicedate": "2020-02-20T20:21:17",
"internalports": [],
"inventorystatusid": 3,
"ipaddress": "",
"iprelates": null,
"leftinrack": 0,
"managementsystem": {
"customer": null,
"customerid": null,
"errors": null,
"haserrors": false,
"id": 2356,
"name": "JUNIPER_MPLS",
"networkaddress": "",
"nodes": [],
"reconcileschemaname": "IF_JUNIPER_MPLS",
"rowversion": "2020-02-11T16:01:10",
"vendor": null,
"vendorid": null
},
"managementsystemid": 2356,
"mplsprot": "",
"name": "QFX.FRA.DE",
"networkaddress": "",
"networkmapnodeobject": null,
"networkrole": "",
"nodealiases": null,
"nodeattachments": null,
"nodecounts": null,
"numberrangenoderelations": null,
"order": null,
"orderid": null,
"outofservicedate": null,
"parentnode": null,
"parentnodeid": null,
"plmidate": null,
"ploosdate": null,
"ports": null,
"powerconsume": 0,
"rack": null,
"rackframe": null,
"rackframeid": null,
"rackid": 113129,
"rackside": null,
"range": null,
"ratebatterybackup": null,
"ratedieselgeneratorbackup": null,
"ratevolume": null,
"reconcilenodes": null,
"relatedorders": null,
"requestor": "",
"ring": null,
"ringid": 4230,
"rowversion": "2020-05-20T13:52:08",
"sectors": null,
"serialnumber": "",
"servicecontract": "",
"shelves": null,
"shouldnotberatedacpower": null,
"shouldnotberateddcpower": null,
"shouldnotberateddiesel": null,
"shouldnotberatedvolume": null,
"site": null,
"siteid": 445254,
"sla": "",
"softwareversion": "17.3R3-S3.3",
"stockitem": null,
"stockitemid": null,
"subnodelist": null,
"systemaccountnoderelations": null,
"ups": null,
"upsinfo": "",
"variant": "",
"vminternalportrelatelist": null,
"vmportrelatelist": null
},
"nodeid": 129058,
"parentinternalport": null,
"parentinternalportid": null,
"portstatus": "",
"projectnumber": "",
"projectstatus": 1,
"recidcondbase": null,
"reconcilecircuitinternalports": null,
"reservedby": "",
"reserveddate": null,
"reservednumber": "",
"rowversion": "2020-05-20T13:52:13",
"sequencenumber": 2,
"shelf": null,
"shelfid": null,
"site": null,
"siteid": 445254,
"tobeceasedrelatedinternalportid": null,
"txrx": null,
"virtualswitchid": null,
"vminternalportrelatelist": null
},
{
"adminstatus": 1,
"bridgedomains": null,
"card": null,
"cardid": null,
"childinternalports": null,
"circuit": null,
"circuitalist": null,
"circuitblist": null,
"circuitid": 702127,
"comments": "SRV_GLOBAL INFRASTRUCTURE ACCESS #DCN_MANAGEMENT_MAD_ES | DCN MANAGEMENT",
"condbase": "",
"directionid": 0,
"domain": null,
"domainid": 2686,
"errors": null,
"haserrors": false,
"id": 225742,
"internalporttemplate": null,
"internalporttemplateid": null,
"ipaddresses": null,
"iprelates": null,
"linestatus": 1,
"macaddress": "",
"mtu": null,
"name": "AE3.103",
"node": {
"acpowerconsumption": null,
"alarms": null,
"angle": null,
"batterybackuphoursordered": null,
"bridgedomains": null,
"builddate": "2020-02-12T09:06:06",
"cards": null,
"configuration": "",
"createuser": null,
"createuserid": 6727,
"customer": null,
"customerid": 57640,
"dcpowerconsumption": null,
"directionangle": null,
"domain": null,
"domainid": 2686,
"equipmentdefinition": {
"_height": 705,
"_width": 441,
"acpowerconsumption": null,
"cardcodedefinitions": null,
"carddefinitions": null,
"childequipmentdefinitionrelations": null,
"commandsgroup": null,
"commandsgroupid": null,
"contractid": null,
"dcpowerconsumption": null,
"defaultangle": null,
"defaultcustomer": null,
"defaultcustomerid": null,
"defaultdomain": null,
"defaultdomainid": 2686,
"defaultlayer": "",
"defaultmanagementsystem": null,
"defaultmanagementsystemid": null,
"defaultplatformname": "",
"defaultrange": null,
"defphysspeeds": "10GBE|40GBE|1GBE|100GBE",
"depreciationperiod": null,
"depth": 584,
"description": "",
"endoflive": null,
"endofmaincontract": null,
"endofsale": null,
"eqdefvariant": "",
"equipmentdefinitioncounts": null,
"equipmentkind": "ROUTER",
"equipmentpicture": "",
"errors": null,
"extrainfo": "",
"haserrors": false,
"hasswport": 0,
"heatemission": null,
"heatproduction": null,
"height": 705,
"id": 6959,
"internalporttemplates": null,
"isiptype": 1,
"isvirtual": 0,
"klm": 0,
"materialtypes": null,
"name": "JUNIPER MX960",
"nodenametemplate": "",
"nodes": [],
"nodetemplates": null,
"numberofunits": 11.53,
"ownerrules": 0,
"parentequipmentdefinitionrelations": null,
"partofmaintcontract": "",
"porttemplates": null,
"powerconsume": null,
"rateacpower": null,
"ratedcpower": null,
"ratevolume": 12,
"reconcileequipmentdefinitions": null,
"redundanttype": "",
"rowversion": "2020-02-11T19:22:49",
"shape": "ROUTER",
"shapecolor": "GREEN",
"shapetext": "MX96",
"shelfdefinitions": null,
"slotdefinitions": null,
"templates": null,
"vendor": {
"cabletypes": null,
"cardcodes": null,
"carddefinitions": null,
"color": "",
"contract": null,
"description": "",
"equipmentdefinitions": [],
"errors": null,
"escalationdescription": "",
"esimprofiles": null,
"esims": null,
"eumid": "",
"haserrors": false,
"id": 2702,
"internetaddress": "",
"issuercodeesim": null,
"managementsystems": null,
"masteraccount": "",
"mnocode": "",
"name": "JUNIPER",
"operatorcompanynumbers": null,
"orders": null,
"purchaseorders": null,
"rowversion": "2020-02-11T17:03:18",
"sites": null,
"sladescription": "",
"slalink": "",
"slamaintimetorepair": null,
"slamaintimetorepairid": null,
"slaonsite": null,
"slaonsiteid": null,
"spareowner": "",
"stockcontact": "",
"stockitems": null,
"stocklocation": "",
"type": null,
"typeid": 1,
"vendormaterialtypes": null,
"vendorrelatedcontacts": null
},
"vendorequipmentdefinitionname": "MX960",
"vendorid": 2702,
"weight": 0,
"width": 441
},
"equipmentdefinitionid": 6959,
"errors": null,
"extrainfo": "",
"extrainfoimportant": 0,
"fuseconsumption": null,
"hardwarebuildnumber": null,
"hardwarerevision": "REV 01",
"haserrors": false,
"heatemission": null,
"heightinrack": null,
"id": 129069,
"inservicedate": "2020-02-20T20:16:03",
"internalports": [],
"inventorystatusid": 3,
"ipaddress": "",
"iprelates": null,
"leftinrack": 0,
"managementsystem": {
"customer": null,
"customerid": null,
"errors": null,
"haserrors": false,
"id": 2356,
"name": "JUNIPER_MPLS",
"networkaddress": "",
"nodes": [],
"reconcileschemaname": "IF_JUNIPER_MPLS",
"rowversion": "2020-02-11T16:01:10",
"vendor": null,
"vendorid": null
},
"managementsystemid": 2356,
"mplsprot": "",
"name": "MX1.MAD.ES",
"networkaddress": "",
"networkmapnodeobject": null,
"networkrole": "",
"nodealiases": null,
"nodeattachments": null,
"nodecounts": null,
"numberrangenoderelations": null,
"order": null,
"orderid": null,
"outofservicedate": null,
"parentnode": null,
"parentnodeid": null,
"plmidate": null,
"ploosdate": null,
"ports": null,
"powerconsume": 0,
"rack": null,
"rackframe": null,
"rackframeid": null,
"rackid": 113116,
"rackside": null,
"range": null,
"ratebatterybackup": null,
"ratedieselgeneratorbackup": null,
"ratevolume": null,
"reconcilenodes": null,
"relatedorders": null,
"requestor": "",
"ring": null,
"ringid": 4230,
"rowversion": "2020-11-02T19:38:46",
"sectors": null,
"serialnumber": "JN12038B7AFA",
"servicecontract": "",
"shelves": null,
"shouldnotberatedacpower": null,
"shouldnotberateddcpower": null,
"shouldnotberateddiesel": null,
"shouldnotberatedvolume": null,
"site": null,
"siteid": 445082,
"sla": "",
"softwareversion": "18.4R3-S4.2",
"stockitem": null,
"stockitemid": null,
"subnodelist": null,
"systemaccountnoderelations": null,
"ups": null,
"upsinfo": "",
"variant": "",
"vminternalportrelatelist": null,
"vmportrelatelist": null
},
"nodeid": 129069,
"parentinternalport": null,
"parentinternalportid": 223274,
"portstatus": "",
"projectnumber": "",
"projectstatus": 1,
"recidcondbase": null,
"reconcilecircuitinternalports": null,
"reservedby": "",
"reserveddate": null,
"reservednumber": "",
"rowversion": "2020-11-27T01:38:15",
"sequencenumber": 1,
"shelf": {
"antennas": null,
"cards": null,
"comments": "",
"createdate": "2020-02-12T09:26:56",
"errors": null,
"hardwarebuildnumber": null,
"hardwarerevision": "",
"haserrors": false,
"heightinrack": 0,
"id": 185808,
"inservicedate": "2020-02-20T20:16:04",
"internalports": [],
"inventorystatusid": 3,
"leftinrack": 0,
"name": "FRONT",
"node": null,
"nodeid": 129069,
"order": null,
"orderid": null,
"outofservicedate": null,
"partnumber": "",
"ports": null,
"rack": null,
"rackframe": null,
"rackframeid": null,
"rackid": null,
"rackside": 0,
"reconcileshelves": null,
"relatedorders": null,
"revision": "",
"rowversion": "2020-02-20T20:16:04",
"sequencenumber": 1,
"serialnumber": "",
"shelfdefinition": null,
"shelfdefinitionid": 3495,
"site": null,
"siteid": 445082,
"softwareversion": "",
"stockitem": null,
"stockitemid": null
},
"shelfid": 185808,
"site": null,
"siteid": 445082,
"tobeceasedrelatedinternalportid": null,
"txrx": null,
"virtualswitchid": null,
"vminternalportrelatelist": null
}
]
\ No newline at end of file
This diff is collapsed.
......@@ -5,7 +5,60 @@ from inventory_provider.db.ims import InventoryStatus
from inventory_provider.db.ims_data import lookup_lg_routers, \
otrs_get_customer_company_rows, \
otrs_get_customer_users_rows, get_node_locations, IMS_OPSDB_STATUS_MAP, \
get_fibre_info, get_port_id_services
get_fibre_info, get_port_id_services, get_port_details
def test_get_port_details(mocker):
def _se(entity, y, step_count):
with open(f'test/data/ims_{entity}_details_data.json') as data:
return json.load(data)
mocker.patch.object(
inventory_provider.db.ims.IMS,
'get_all_entities',
side_effect=_se
)
ds = inventory_provider.db.ims.IMS(
'dummy_base', 'dummy_username', 'dummy_password')
res = list(get_port_details(ds))
assert ds.get_all_entities.call_count == 2
predicted = [
{
'port_id': 6417059,
'equipment_name': 'RT1.TAL.EE',
'interface_name': 'XE-0/1/7'
},
{
'port_id': 6417563,
'equipment_name': 'SW1.CH.OFFICE.GEANT.NET',
'interface_name': 'XE-0/2/0'
},
{
'port_id': 6420287,
'equipment_name': 'GEN01-DTNX10-1',
'interface_name': '1-A-1-L1'
},
{
'port_id': 222451,
'equipment_name': 'QFX.FRA.DE',
'interface_name': 'AE0'
},
{
'port_id': 222452,
'equipment_name': 'QFX.FRA.DE',
'interface_name': 'AE1'
},
{
'port_id': 225742,
'equipment_name': 'MX1.MAD.ES',
'interface_name': 'AE3.103'
}
]
assert res == predicted
def test_get_port_id_services(mocker):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment