cell_info = {'cell_id': cell_id, 'id': count}
nbr_list_url = '{}/{}/{}/{}'.format(config['configDbUrl'], config['configDbGetNbrListUrl'], cell_id, ts)
nbr_list_raw = rc.request(url=nbr_list_url, raw_response=True)
- cell_info['nbr_list'] = nbr_list_raw.json()
+ cell_info['nbr_list'] = get_neighbor_list(nbr_list_raw.json())
cell_list.append(cell_info)
count += 1
cell_list_response['cell_list'] = cell_list
return cell_resp, cell_list_response
+
+
+def get_neighbor_list(nbr_list_response):
+ return nbr_list_response.get('nbrList', [])
def add_to_neighbor_list(network_cell_info, cell, neighbor_list):
for nbr in cell.get('nbr_list', []):
host_id = cell['id']
- nbr_id = get_id(network_cell_info, nbr['cellId'])
+ nbr_id = get_id(network_cell_info, nbr['targetCellId'])
if nbr_id and host_id != nbr_id:
neighbor_list.add((host_id, nbr_id))
def build_second_level_list(network_cell_info, cell):
second_nbr_list = []
for nbr in cell.get('nbr_list', []):
- second_nbr_list.append(get_id(network_cell_info, nbr['cellId']))
+ second_nbr_list.append(get_id(network_cell_info, nbr['targetCellId']))
return [list(elem) for elem in list(itertools.combinations(second_nbr_list, 2))]
cell_id = get_cell_id(network_cell_info, id)
for i in network_cell_info['cell_list']:
for j in i['nbr_list']:
- if cell_id == j['cellId']:
+ if cell_id == j['targetCellId']:
return j['pciValue']
return None
-[
- {
- "cellId": "cell1",
- "pciValue": 1
- },
- {
- "cellId": "cell2",
- "pciValue": 2
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell0",
+ "nbrList": [
+ {
+ "targetCellId": "cell1",
+ "pciValue": 1,
+ "ho": true
+ },
+ {
+ "targetCellId": "cell2",
+ "pciValue": 2,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell0",
- "pciValue": 0
- },
- {
- "cellId": "cell2",
- "pciValue": 2
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell1",
+ "nbrList": [
+ {
+ "targetCellId": "cell0",
+ "pciValue": 0,
+ "ho": true
+ },
+ {
+ "targetCellId": "cell2",
+ "pciValue": 2,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell0",
- "pciValue": 0
- },
- {
- "cellId": "cell1",
- "pciValue": 1
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell2",
+ "nbrList": [
+ {
+ "targetCellId": "cell0",
+ "pciValue": 0,
+ "ho": true
+ },
+ {
+ "targetCellId": "cell1",
+ "pciValue": 1,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell21",
- "pciValue": 0
- },
- {
- "cellId": "cell22",
- "pciValue": 1
- },
- {
- "cellId": "cell23",
- "pciValue": 2
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell20",
+ "nbrList": [
+ {
+ "targetCellId": "cell21",
+ "pciValue": 0,
+ "ho": true
+ },
+ {
+ "targetCellId": "cell22",
+ "pciValue": 1,
+ "ho": true
+ },
+ {
+ "targetCellId": "cell23",
+ "pciValue": 2,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell20",
- "pciValue":0
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell21",
+ "nbrList": [
+ {
+ "targetCellId": "cell20",
+ "pciValue": 0,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell20",
- "pciValue": 0
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell22",
+ "nbrList": [
+ {
+ "targetCellId": "cell20",
+ "pciValue": 0,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell24",
- "pciValue": 0
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell23",
+ "nbrList": [
+ {
+ "targetCellId": "cell24",
+ "pciValue": 0,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file
-[
- {
- "cellId": "cell23",
- "pciValue": 2
- }
-]
\ No newline at end of file
+{
+ "cellId": "cell24",
+ "nbrList": [
+ {
+ "targetCellId": "cell23",
+ "pciValue": 2,
+ "ho": true
+ }
+ ]
+}
\ No newline at end of file