From 3d0f1d2206b18678cb7d7c19483d9a268c81fe7a Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 27 Dec 2010 16:30:38 -0500 Subject: [PATCH] added 'urn' field as an attribute for the 'node' element in the rspec --- sfa/plc/network.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sfa/plc/network.py b/sfa/plc/network.py index b1c72da7..41bae485 100644 --- a/sfa/plc/network.py +++ b/sfa/plc/network.py @@ -2,7 +2,7 @@ from __future__ import with_statement import re import socket from sfa.util.xrn import get_authority -from sfa.util.plxrn import hrn_to_pl_slicename +from sfa.util.plxrn import hrn_to_pl_slicename, hostname_to_urn from sfa.util.faults import * from xmlbuilder import XMLBuilder from lxml import etree @@ -50,6 +50,9 @@ class Node: self.iface_ids = node['interface_ids'] self.sliver = None self.whitelist = node['slice_ids_whitelist'] + auth = self.network.api.hrn + login_base = self.get_site().idtag + self.urn = hostname_to_urn(auth, login_base, self.hostname) def get_primary_iface(self): for id in self.iface_ids: @@ -73,6 +76,8 @@ class Node: with xml.node(id = self.idtag): with xml.hostname: xml << self.hostname + with xml.urn: + xml << self.urn iface = self.get_primary_iface() if iface: iface.toxml(xml) @@ -84,11 +89,11 @@ class Site: def __init__(self, network, site): self.network = network self.id = site['site_id'] - self.idtag = "s%s" % self.id self.node_ids = site['node_ids'] self.node_ids.sort() self.name = site['abbreviated_name'] self.tag = site['login_base'] + self.idtag = site['login_base'] self.public = site['is_public'] self.enabled = site['enabled'] self.links = set() -- 2.43.0