aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--osdf/optimizers/pciopt/configdb.py6
-rw-r--r--osdf/optimizers/pciopt/solver/optimizer.py4
-rw-r--r--osdf/optimizers/pciopt/solver/pci_utils.py2
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell0.json25
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell1.json25
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell2.json25
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell20.json34
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell21.json16
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell22.json16
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell23.json16
-rw-r--r--test/functest/simulators/configdb/response-payloads/getNbrList-cell24.json16
11 files changed, 113 insertions, 72 deletions
diff --git a/osdf/optimizers/pciopt/configdb.py b/osdf/optimizers/pciopt/configdb.py
index 0e76884..8f003c2 100644
--- a/osdf/optimizers/pciopt/configdb.py
+++ b/osdf/optimizers/pciopt/configdb.py
@@ -57,9 +57,13 @@ def request(req_object, osdf_config, flat_policies):
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', [])
diff --git a/osdf/optimizers/pciopt/solver/optimizer.py b/osdf/optimizers/pciopt/solver/optimizer.py
index 9b2e9d9..0a6d5a4 100644
--- a/osdf/optimizers/pciopt/solver/optimizer.py
+++ b/osdf/optimizers/pciopt/solver/optimizer.py
@@ -103,7 +103,7 @@ def get_neighbor_list(network_cell_info):
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))
@@ -121,7 +121,7 @@ def get_second_level_neighbor(network_cell_info):
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))]
diff --git a/osdf/optimizers/pciopt/solver/pci_utils.py b/osdf/optimizers/pciopt/solver/pci_utils.py
index df46d1b..04829cf 100644
--- a/osdf/optimizers/pciopt/solver/pci_utils.py
+++ b/osdf/optimizers/pciopt/solver/pci_utils.py
@@ -35,6 +35,6 @@ def get_pci_value(network_cell_info, id):
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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell0.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell0.json
index e0986d8..ff291fb 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell0.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell0.json
@@ -1,10 +1,15 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell1.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell1.json
index d6ed353..3c487e8 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell1.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell1.json
@@ -1,10 +1,15 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell2.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell2.json
index 1ea80be..20a8c98 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell2.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell2.json
@@ -1,10 +1,15 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell20.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell20.json
index 86c7d2c..d4e754f 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell20.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell20.json
@@ -1,14 +1,20 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell21.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell21.json
index 490c15f..a1d6f55 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell21.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell21.json
@@ -1,6 +1,10 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell22.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell22.json
index 426e13b..9c16aec 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell22.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell22.json
@@ -1,6 +1,10 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell23.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell23.json
index de582eb..ac3bf6f 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell23.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell23.json
@@ -1,6 +1,10 @@
-[
- {
- "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
diff --git a/test/functest/simulators/configdb/response-payloads/getNbrList-cell24.json b/test/functest/simulators/configdb/response-payloads/getNbrList-cell24.json
index 8d8d3fb..f34128e 100644
--- a/test/functest/simulators/configdb/response-payloads/getNbrList-cell24.json
+++ b/test/functest/simulators/configdb/response-payloads/getNbrList-cell24.json
@@ -1,6 +1,10 @@
-[
- {
- "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