From 73b163a7ea35209e0675a7c7cef367946928a96f Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Mon, 26 Oct 2009 18:31:09 +0000 Subject: [PATCH] Changed Rspec --> RSpec throughout. --- INSTALL.txt | 2 +- docs/pythondoc-registry.html | 2 +- sfa/client/genidump.py | 2 +- sfa/client/getNodes.py | 6 +++--- sfa/client/sfi.py | 6 +++--- sfa/plc/nodes.py | 10 +++++----- sfa/plc/slices.py | 10 +++++----- sfa/rspecs/aggregates/rspec_manager_max.py | 14 +++++++------- sfa/rspecs/aggregates/rspec_manager_openflow.py | 4 ++-- sfa/rspecs/aggregates/rspec_manager_vini.py | 8 ++++---- sfa/rspecs/aggregates/vini/rspec.py | 6 +++--- sfa/rspecs/aggregates/vini/utils.py | 2 +- sfa/util/rspec.py | 6 +++--- sfa/util/specdict.py | 2 +- sfatables/runtime.py | 2 +- sfatables/xmlrule.py | 2 +- 16 files changed, 42 insertions(+), 42 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 93cf41ca..08c38e2b 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -118,7 +118,7 @@ At this stage you should be able to run sfi command. Some sample outputs are: (e) # sfi.py resources - + ------ 6) Federation configuration: diff --git a/docs/pythondoc-registry.html b/docs/pythondoc-registry.html index ba1891e4..5bc665e5 100644 --- a/docs/pythondoc-registry.html +++ b/docs/pythondoc-registry.html @@ -286,7 +286,7 @@ a ticket. There are two parts to this information: attributes and rspec. Attributes are non-resource items, such as keys and the initscript -Rspec is a set of resource specifications

+RSpec is a set of resource specifications

record
diff --git a/sfa/client/genidump.py b/sfa/client/genidump.py index 5ba11e49..2cca0cd1 100644 --- a/sfa/client/genidump.py +++ b/sfa/client/genidump.py @@ -13,7 +13,7 @@ from sfa.trust.credential import Credential from sfa.util.geniclient import GeniClient from sfa.util.record import GeniRecord -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec def determine_sfa_filekind(fn): cert = Certificate(filename = fn) diff --git a/sfa/client/getNodes.py b/sfa/client/getNodes.py index 4d34a43e..b87fa407 100644 --- a/sfa/client/getNodes.py +++ b/sfa/client/getNodes.py @@ -6,7 +6,7 @@ from optparse import OptionParser from pprint import pprint from types import StringTypes -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec def create_parser(): command = sys.argv[0] @@ -57,10 +57,10 @@ def main(): parser = create_parser(); (options, args) = parser.parse_args() if not options.infile: - print "Rspec file not specified" + print "RSpec file not specified" return - rspec = Rspec() + rspec = RSpec() try: rspec.parseFile(options.infile) except: diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 79efeecf..b3dbf35e 100755 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -13,7 +13,7 @@ from sfa.trust.certificate import Keypair, Certificate from sfa.trust.credential import Credential from sfa.util.geniclient import GeniClient from sfa.util.record import * -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec from sfa.util.xmlrpcprotocol import ServerException import sfa.util.xmlrpcprotocol as xmlrpcprotocol from sfa.util.config import Config @@ -691,7 +691,7 @@ class Sfi: def display_rspec(self,rspec, format = 'rspec'): if format in ['dns']: - spec = Rspec() + spec = RSpec() spec.parseString(rspec) hostnames = [] nodespecs = spec.getDictsByTagName('NodeSpec') @@ -703,7 +703,7 @@ class Sfi: hostnames.append(nodespec['name']) result = hostnames elif format in ['ip']: - spec = Rspec() + spec = RSpec() spec.parseString(rspec) ips = [] ifspecs = spec.getDictsByTagName('IfSpec') diff --git a/sfa/plc/nodes.py b/sfa/plc/nodes.py index 29668b72..3fb3e984 100644 --- a/sfa/plc/nodes.py +++ b/sfa/plc/nodes.py @@ -49,7 +49,7 @@ class Nodes(SimpleStorage): self.refresh_nodes_smgr() def refresh_nodes_aggregate(self): - rspec = Rspec() + rspec = RSpec() rspec.parseString(self.get_rspec()) # filter nodes according to policy @@ -109,7 +109,7 @@ class Nodes(SimpleStorage): aggregates = Aggregates(self.api) rspecs = {} networks = [] - rspec = Rspec() + rspec = RSpec() credential = self.api.getCredential() for aggregate in aggregates: try: @@ -129,7 +129,7 @@ class Nodes(SimpleStorage): print >> log, "%s" % (traceback.format_exc()) # create the rspec dict resources = {'networks': networks, 'start_time': start_time, 'duration': duration} - resourceDict = {'Rspec': resources} + resourceDict = {'RSpec': resources} # convert rspec dict to xml rspec.parseDict(resourceDict) return rspec @@ -257,9 +257,9 @@ class Nodes(SimpleStorage): resources = {'networks': networks, 'start_time': start_time, 'duration': duration} # convert the plc dict to an rspec dict - resourceDict = RspecDict(resources) + resourceDict = RSpecDict(resources) # convert the rspec dict to xml - rspec = Rspec() + rspec = RSpec() rspec.parseDict(resourceDict) return rspec.toxml() diff --git a/sfa/plc/slices.py b/sfa/plc/slices.py index ca4d3162..f059136e 100644 --- a/sfa/plc/slices.py +++ b/sfa/plc/slices.py @@ -345,7 +345,7 @@ class Slices(SimpleStorage): peer = self.get_peer(hrn) sfa_peer = self.get_sfa_peer(hrn) - spec = Rspec(rspec) + spec = RSpec(rspec) # Get the slice record from sfa slicename = hrn_to_pl_slicename(hrn) slice = {} @@ -385,12 +385,12 @@ class Slices(SimpleStorage): return 1 def create_slice_smgr(self, hrn, rspec): - spec = Rspec() - tempspec = Rspec() + spec = RSpec() + tempspec = RSpec() spec.parseString(rspec) slicename = hrn_to_pl_slicename(hrn) specDict = spec.toDict() - if specDict.has_key('Rspec'): specDict = specDict['Rspec'] + if specDict.has_key('RSpec'): specDict = specDict['RSpec'] if specDict.has_key('start_time'): start_time = specDict['start_time'] else: start_time = 0 if specDict.has_key('end_time'): end_time = specDict['end_time'] @@ -405,7 +405,7 @@ class Slices(SimpleStorage): for netspec in netspecs: net_hrn = netspec['name'] resources = {'start_time': start_time, 'end_time': end_time, 'networks': netspec} - resourceDict = {'Rspec': resources} + resourceDict = {'RSpec': resources} tempspec.parseDict(resourceDict) rspecs[net_hrn] = tempspec.toxml() diff --git a/sfa/rspecs/aggregates/rspec_manager_max.py b/sfa/rspecs/aggregates/rspec_manager_max.py index 2de9181a..e4ff71a7 100644 --- a/sfa/rspecs/aggregates/rspec_manager_max.py +++ b/sfa/rspecs/aggregates/rspec_manager_max.py @@ -1,6 +1,6 @@ #!/usr/bin/python -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec import sys import pdb from sfa.util.misc import * @@ -27,7 +27,7 @@ class GeniOutOfResource(GeniFault): faultString = "Interface " + interface + " not available" GeniFault.__init__(self, 100, faultString, '') -class GeniNoPairRspec(GeniFault): +class GeniNoPairRSpec(GeniFault): def __init__(self, interface, interface2): faultString = "Interface " + interface + " should be paired with " + interface2 GeniFault.__init__(self, 100, faultString, '') @@ -36,7 +36,7 @@ class GeniNoPairRspec(GeniFault): # i -> node,i_peer def get_interface_map(): - r = Rspec() + r = RSpec() r.parseFile(SFA_MAX_DEFAULT_RSPEC) rspec = r.toDict() capacity = rspec['rspec']['capacity'] @@ -267,7 +267,7 @@ def create_slice(api, hrn, rspec_xml): # Check if everything in rspec is either allocated by hrn # or not allocated at all. - r = Rspec() + r = RSpec() r.parseString(rspec_xml) rspec = r.toDict() @@ -290,7 +290,7 @@ def create_slice(api, hrn, rspec_xml): if (a not in current_hrn_interfaces and a in current_interfaces): raise GeniOutOfResource(a) if (topology[a][1] not in requested_interfaces): - raise GeniNoPairRspec(a,topology[a][1]) + raise GeniNoPairRSpec(a,topology[a][1]) # Request OK # Allocations to delete @@ -316,13 +316,13 @@ def rspec_to_allocations(rspec): for l in ifspecs: ifs.extend([(l['name'].replace('tns:',''),l['ip'])]) except KeyError: - # Bad Rspec + # Bad RSpec pass return ifs def main(): t = get_interface_map() - r = Rspec() + r = RSpec() rspec_xml = open(sys.argv[1]).read() #get_rspec(None,'foo') create_slice(None, "plc.princeton.sap0", rspec_xml) diff --git a/sfa/rspecs/aggregates/rspec_manager_openflow.py b/sfa/rspecs/aggregates/rspec_manager_openflow.py index adc56799..df1cf785 100755 --- a/sfa/rspecs/aggregates/rspec_manager_openflow.py +++ b/sfa/rspecs/aggregates/rspec_manager_openflow.py @@ -1,6 +1,6 @@ from sfa.util.faults import * from sfa.util.misc import * -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec from sfa.server.registry import Registries from sfa.util.config import Config from sfa.plc.nodes import * @@ -157,7 +157,7 @@ def fetch_context(slice_hrn, user_hrn, contexts): return base_context def main(): - r = Rspec() + r = RSpec() r.parseFile(sys.argv[1]) rspec = r.toDict() create_slice(None,'plc',rspec) diff --git a/sfa/rspecs/aggregates/rspec_manager_vini.py b/sfa/rspecs/aggregates/rspec_manager_vini.py index a8370ff3..2875a404 100644 --- a/sfa/rspecs/aggregates/rspec_manager_vini.py +++ b/sfa/rspecs/aggregates/rspec_manager_vini.py @@ -1,6 +1,6 @@ from sfa.util.faults import * from sfa.util.misc import * -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec from sfa.server.registry import Registries from sfa.plc.nodes import * from sfa.rspecs.aggregates.vini.utils import * @@ -166,10 +166,10 @@ def create_slice(api, hrn, xml): else: raise PermissionError("%s not in VINI whitelist" % hrn) - rspec = Rspec(xml) + rspec = RSpec(xml) topo = Topology(api) - topo.nodeTopoFromRspec(rspec) + topo.nodeTopoFromRSpec(rspec) # Check request against current allocations topo.verifyNodeTopo(hrn, topo, maxbw) @@ -197,7 +197,7 @@ def fetch_context(slice_hrn, user_hrn, contexts): return base_context def main(): - r = Rspec() + r = RSpec() r.parseFile(sys.argv[1]) rspec = r.toDict() create_slice(None,'plc',rspec) diff --git a/sfa/rspecs/aggregates/vini/rspec.py b/sfa/rspecs/aggregates/vini/rspec.py index 12b7b449..fb08c1ad 100644 --- a/sfa/rspecs/aggregates/vini/rspec.py +++ b/sfa/rspecs/aggregates/vini/rspec.py @@ -1,12 +1,12 @@ -from sfa.util.rspec import Rspec +from sfa.util.rspec import RSpec from sfa.rspecs.aggregates.vini.utils import * import sys SFA_VINI_DEFAULT_RSPEC = '/etc/sfa/vini.rspec' -class ViniRspec(Rspec): +class ViniRSpec(RSpec): def __init__(self, xml = None, xsd = None, NSURL = None): - Rspec.__init__(self, xml, xsd, NSURL) + RSpec.__init__(self, xml, xsd, NSURL) if not xml: self.parseFile(SFA_VINI_DEFAULT_RSPEC) diff --git a/sfa/rspecs/aggregates/vini/utils.py b/sfa/rspecs/aggregates/vini/utils.py index 4d74f165..c3118877 100644 --- a/sfa/rspecs/aggregates/vini/utils.py +++ b/sfa/rspecs/aggregates/vini/utils.py @@ -481,7 +481,7 @@ class Topology: return link return None - def nodeTopoFromRspec(self, rspec): + def nodeTopoFromRSpec(self, rspec): if self.nodelinks: raise Error("virtual topology already present") diff --git a/sfa/util/rspec.py b/sfa/util/rspec.py index 903365ce..fab1b57e 100644 --- a/sfa/util/rspec.py +++ b/sfa/util/rspec.py @@ -8,7 +8,7 @@ import httplib from xml.dom import minidom from types import StringTypes, ListType -class Rspec: +class RSpec: def __init__(self, xml = None, xsd = None, NSURL = None): ''' @@ -363,7 +363,7 @@ class Rspec: -class RecordSpec(Rspec): +class RecordSpec(RSpec): root_tag = 'record' def parseDict(self, rdict, include_doc = False): @@ -376,7 +376,7 @@ class RecordSpec(Rspec): record_dict = rdict if not len(rdict.keys()) == 1: record_dict = {self.root_tag : rdict} - return Rspec.dict2dom(self, record_dict, include_doc) + return RSpec.dict2dom(self, record_dict, include_doc) # vim:ts=4:expandtab diff --git a/sfa/util/specdict.py b/sfa/util/specdict.py index 59608870..7a6ff97a 100644 --- a/sfa/util/specdict.py +++ b/sfa/util/specdict.py @@ -120,7 +120,7 @@ class NetSpecDict(SpecDict): 'nodes': 'nodes', 'links': 'links'} -class RspecDict(SpecDict): +class RSpecDict(SpecDict): type = 'RSpec' fields = {'start_time': '', 'duration': '', diff --git a/sfatables/runtime.py b/sfatables/runtime.py index 0ed38e06..b76ec0a8 100644 --- a/sfatables/runtime.py +++ b/sfatables/runtime.py @@ -55,7 +55,7 @@ class SFATablesRules: def add_request_context_to_rspec(self, doc): p = doc.xpathNewContext() - context = p.xpathEval("//Rspec") + context = p.xpathEval("//RSpec") if (not context): raise Exception('Request is not an rspec') else: diff --git a/sfatables/xmlrule.py b/sfatables/xmlrule.py index 97940de2..1a31711e 100644 --- a/sfatables/xmlrule.py +++ b/sfatables/xmlrule.py @@ -57,7 +57,7 @@ class XMLRule: def add_rule_context_to_rspec(self, doc): p = doc.xpathNewContext() - context = p.xpathEval("//Rspec") + context = p.xpathEval("//RSpec") if (not context): raise Exception('Request is not an rspec') else: -- 2.43.0