aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/core/attribute.py
diff options
context:
space:
mode:
authorMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-29 13:13:32 +0200
committerMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-29 13:13:32 +0200
commita836e5c16ea7df38646c46f2e9ffc6163ab05f06 (patch)
treed5cf3b799af7e9a328db245647a5cdce0ba744f4 /vicn/core/attribute.py
parentbe0b435d307173598c30fcacc421b17112137099 (diff)
Misc bug fixes
*IP assignment *Node is a key attribute *Up-to-date packages *Trailing whitespaces ... Change-Id: Id8e2a5f7b2c4506f326b3c4bc991fa65f53fca5c Signed-off-by: Marcel Enguehard <mengueha+fdio@cisco.com>
Diffstat (limited to 'vicn/core/attribute.py')
-rw-r--r--vicn/core/attribute.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/vicn/core/attribute.py b/vicn/core/attribute.py
index 22f44487..3afe0d6e 100644
--- a/vicn/core/attribute.py
+++ b/vicn/core/attribute.py
@@ -267,3 +267,16 @@ class Reference:
def __init__(self, resource, attribute=None):
self._resource = resource
self._attribute = attribute
+
+ def get_proxy(self):
+ if self._resource is Self:
+ resource = getattr(self, self._attribute)
+ else:
+ resource = getattr(self._resource, self._attribute)
+ return resource
+
+ def get(self, attribute_name):
+ return self.get_proxy().get(attribute_name)
+
+ def __iter__(self):
+ return iter(self.get_proxy())