aboutsummaryrefslogtreecommitdiffstats
path: root/vicn
diff options
context:
space:
mode:
authorMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-30 14:31:11 +0200
committerMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-30 14:31:11 +0200
commit41054ff283c90212e3d8280055093ac9f465317d (patch)
tree66e9411fc75f31fd1fe1b36dd9a0385dfa7302ad /vicn
parent97c6a8bb1847febe8bda5f95e19f527cabc060b9 (diff)
Fix for ICN routes to find producer prefixes in a given group
Change-Id: Iaf78c4f6f887635f48263b9b77e7fbdb486bafff Signed-off-by: Marcel Enguehard <mengueha+fdio@cisco.com>
Diffstat (limited to 'vicn')
-rw-r--r--vicn/resource/central.py7
-rw-r--r--vicn/resource/icn/producer.py8
2 files changed, 12 insertions, 3 deletions
diff --git a/vicn/resource/central.py b/vicn/resource/central.py
index 4398ae5a..bf1c8f7a 100644
--- a/vicn/resource/central.py
+++ b/vicn/resource/central.py
@@ -523,11 +523,12 @@ class ICNRoutes(Resource):
def _get_prefix_origins(self):
origins = dict()
for group in self.groups:
- for producer in group.iter_by_type_str('producer'):
- node_uuid = producer.node._state.uuid
+ for node in group.iter_by_type_str('node'):
+ node_uuid = node._state.uuid
if not node_uuid in origins:
origins[node_uuid] = list()
- origins[node_uuid].extend(producer.prefixes)
+ for producer in node.producers:
+ origins[node_uuid].extend(producer.prefixes)
return origins
def _get_icn_routes(self):
diff --git a/vicn/resource/icn/producer.py b/vicn/resource/icn/producer.py
index 23434ebd..131097f2 100644
--- a/vicn/resource/icn/producer.py
+++ b/vicn/resource/icn/producer.py
@@ -19,6 +19,7 @@
from netmodel.model.type import String
from vicn.resource.icn.icn_application import ICNApplication
from vicn.core.attribute import Attribute, Multiplicity
+from vicn.resource.node import Node
class Producer(ICNApplication):
"""
@@ -27,3 +28,10 @@ class Producer(ICNApplication):
prefixes = Attribute(String, description = 'List of served prefixes',
multiplicity = Multiplicity.OneToMany)
+ #Overload to get producer list from node in CentralICN
+ node = Attribute(Node,
+ description = 'Node on which the producer is installed',
+ mandatory = True,
+ multiplicity = Multiplicity.ManyToOne,
+ reverse_name = 'producers',
+ key = True)