Created on 03-09-2021 10:47 PM - edited 03-09-2021 11:16 PM
============================
Sample Input
============================
{
"device": {
"sneID": "336 A6",
"dnsName": "dv-mse-bb",
"managementIP": "5/nokia",
"manufacturer": "Nokia",
"isMSE": "Yes",
"os": "15.0.R15-1",
"shelves": [
{
"shelfID": "1",
"fabricSpeed": "A",
"cpm": "cpm5",
"isPhaseEnabled": "No",
"slots": [
{
"slotID": "1",
"isSubSlot": "false",
"cards": {
"cardID": "1",
"cardType": "iom3-xp",
"adminStatus": "no shutdown",
"subSlots": [
{
"slotID": "mda-1",
"isSubSlot": "true",
"cards": {
"cardID": "1/1",
"cardType": "m10-1gb-hs-sfp-b",
"adminStatus": "no shutdown",
"ports": [
{
"portID": "1/1/1",
"adminStatus": "up",
"operationStatus": "up",
"speed": "1000",
"sfpType": "1000BASE-SX",
"isServicePresent": true
},
{
"portID": "1/1/2",
"adminStatus": "up",
"operationStatus": "up",
"speed": "1000",
"sfpType": "1000BASE-SX",
"isServicePresent": true
}
]
}
},
{
"slotID": "mda-2",
"isSubSlot": "true",
"cards": {
"cardID": "1/2",
"cardType": "m10-1gb-xp-sfp",
"adminStatus": "no shutdown",
"ports": [
{
"portID": "1/2/1",
"adminStatus": "up",
"operationStatus": "down",
"speed": "1000",
"sfpType": "1000BASE-SX",
"isServicePresent": true
},
{
"portID": "1/2/2",
"adminStatus": "up",
"operationStatus": "down",
"speed": "1000",
"sfpType": "1000BASE-SX",
"isServicePresent": true
}
]
}
}
]
}
},
{
"slotID": "2",
"isSubSlot": "false",
"cards": {
"cardID": "2",
"cardType": "iom4-e-hs",
"adminStatus": "no shutdown",
"subSlots": [
{
"slotID": "mda-1",
"isSubSlot": "true",
"cards": {
"cardID": "2/1",
"cardType": "me10-10gb-sfp+",
"adminStatus": "no shutdown",
"ports": [
{
"portID": "2/1/1",
"adminStatus": "down",
"operationStatus": "down",
"speed": "10000",
"sfpType": "",
"isServicePresent": false
},
{
"portID": "2/1/2",
"adminStatus": "down",
"operationStatus": "down",
"speed": "10000",
"sfpType": "",
"isServicePresent": false
}
]
}
},
{
"slotID": "mda-2",
"isSubSlot": "true",
"cards": {
"cardID": "2/2",
"cardType": "me10-10gb-sfp+",
"adminStatus": "no shutdown",
"ports": [
{
"portID": "2/2/1",
"adminStatus": "down",
"operationStatus": "down",
"speed": "10000",
"sfpType": "",
"isServicePresent": false
},
{
"portID": "2/2/2",
"adminStatus": "down",
"operationStatus": "down",
"speed": "10000",
"sfpType": "",
"isServicePresent": false
}
]
}
}
]
}
},
{
"slotID": "11",
"isSubSlot": "false",
"cards": {
"cardID": "11",
"cardType": "iom3-xp",
"adminStatus": "no shutdown",
"ports": [
{
"portID": "11/1/1",
"adminStatus": "up",
"operationStatus": "up",
"speed": "1000",
"sfpType": "1000BASE-LX",
"isServicePresent": false
},
{
"portID": "11/1/2",
"adminStatus": "up",
"operationStatus": "down",
"speed": "1000",
"sfpType": "",
"isServicePresent": true
}
]
}
}
]
},
{
"shelfID": "esat-1",
"ports": [
{
"portID": "esat-1/1/1",
"adminStatus": "down",
"operationStatus": "down",
"speed": "1000",
"sfpType": "",
"isServicePresent": false
},
{
"portID": "esat-1/1/2",
"adminStatus": "up",
"operationStatus": "notPresent",
"speed": "1000",
"sfpType": "",
"isServicePresent": false
}
]
}
]
}
}
============================
Expected Output
============================
{
"resourceName": "90011",
"specType": "device",
"source": "network",
"locationRef": {
"location": "L/TEM"
},
"resourceSpecificationRef": {
"id": "Edge Rt:7750 SR-12:Multi Service Edge:(N/A)",
"alias": "PE232-TEM",
"vendor": "NGWM",
"name": "7750 SR-12",
"subType": "device",
"isMSE": "No",
"fabricSpeed": "Yes"
},
"ipAddress": {
"ip": "192.168.1.12",
"dns": "dns.host.edgrt.com"
},
"resourceRelationship": [
{
"resourceName": "Chassis:Alcatel 7750SR CORE",
"specType": "chassis",
"source": "network",
"parentInfo": "90011",
"locationRef": {
"location_TRSArea": "L/FAR/E",
"locality": "L/FAR"
},
"ipAddress": {
"ip": "192.168.0.1",
"dns": "dns.host.edgrt.com"
},
"resourceSpecificationRef": {
"id": "90011:/shelf=1:CORE SHELF",
"specName": "Alcatel 7750SR CORE",
"name": "CORE",
"subType": "Shelf",
"operational_status": "Operational",
"inventory_status": "Available",
"manufacturer": "CNA",
"model": "7750",
"partNumber": "231263",
"versionNumber": "1.0",
"rackId": "Rack1",
"equipmentNumber": "90011"
},
"resourceRelationship": [
{
"resourceName": "1-1",
"specType": "slot",
"parentInfo": "Chassis:Alcatel 7750SR CORE",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=1",
"specName": "CNA - CN-32SLOT",
"name": "Slot",
"operational_status": "Active",
"inventory_status": "active"
},
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=1/sub_slot=1",
"parentInfo": "1",
"specType": "card",
"source": "network",
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=1/port=1-F-1-Ch45",
"parentInfo": "/shelf=1/slot=1",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=1/port=1-F-1-Ch45",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
}
]
}
]
},
{
"resourceName": "2",
"specType": "slot",
"parentInfo": "Chassis:Alcatel 7750SR CORE",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=2",
"specName": "CNA - CN-32SLOT",
"name": "Slot",
"operational_status": "Active",
"inventory_status": "active"
},
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=2",
"parentInfo": "2",
"specType": "card",
"source": "network",
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=2/port=1-F-1-Ch46",
"parentInfo": "/shelf=1/slot=2",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=2/port=1-F-1-Ch46",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
}
]
}
]
},
{
"resourceName": "3",
"specType": "slot",
"parentInfo": "Chassis:Alcatel 7750SR CORE",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3",
"specName": "CNA - CN-2SLOT",
"name": "Slot",
"operational_status": "Active",
"inventory_status": "active"
},
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=3",
"parentInfo": "3",
"specType": "card",
"source": "network",
"resourceRelationship": [
{
"resourceName": "3/1",
"specType": "subSlot",
"parentInfo": "/shelf=1/slot=3",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=1",
"specName": "CNA - CN-32SLOT",
"name": "subSlot",
"operational_status": "Active",
"inventory_status": "active"
},
"resourceRelationship": [
{
"resourceName": "kanhaiya",
"parentInfo": "3/1",
"specType": "card",
"source": "network",
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=3/subSlot=1/port=1",
"parentInfo": "/shelf=1/slot=3/subSlot=1",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=1/port=1",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
},
{
"resourceName": "/shelf=1/slot=3/subSlot=1/port=2",
"parentInfo": "/shelf=1/slot=3/subSlot=1",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=1/port=2",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
},
{
"resourceName": "/shelf=1/slot=3/subSlot=1/port=3",
"parentInfo": "/shelf=1/slot=3/subSlot=1",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=1/port=3",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
}
]
}
]
},
{
"resourceName": "3/2",
"specType": "subSlot",
"parentInfo": "/shelf=1/slot=3",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=2",
"specName": "CNA - CN-32SLOT",
"name": "subSlot",
"operational_status": "Active",
"inventory_status": "active"
},
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=3/subSlot=2",
"parentInfo": "3/2",
"specType": "card",
"source": "network",
"resourceRelationship": [
{
"resourceName": "/shelf=1/slot=3/subSlot=2/port=1",
"parentInfo": "/shelf=1/slot=3/subSlot=2",
"specType": "port",
"resourceSpecificationRef": {
"id": "90011:/shelf=1/slot=3/subSlot=2/port=1",
"name": "10GigE LP:10GigE",
"type": "OTS-1",
"subType": "",
"aliasName": "1",
"status": "INSTALLED",
"installationDate": "2020-23-12"
},
"resourceRelationship": []
}
]
}
]
}
]
}
]
}
]
}
]
}
Created 03-09-2021 11:27 PM
Please help.. Output expected in hierarchy atleast as mentioned expected out(Like resourceRelationship)