From 41054ff283c90212e3d8280055093ac9f465317d Mon Sep 17 00:00:00 2001 From: Marcel Enguehard Date: Tue, 30 May 2017 14:31:11 +0200 Subject: Fix for ICN routes to find producer prefixes in a given group Change-Id: Iaf78c4f6f887635f48263b9b77e7fbdb486bafff Signed-off-by: Marcel Enguehard --- vicn/resource/central.py | 7 ++++--- vicn/resource/icn/producer.py | 8 ++++++++ 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) -- cgit 1.2.3-korg