summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e48f94f)
* interface :
registry | slicemgr | aggregate | component
* peers (registry and slicemgr only)
dictionary of (hrn => URL)
for supporting introspection
* hrn : well, the hrn associated with this server (registry and slicemgr only)
* tag : the git tag
* hostname :
Example:
~/.sfi-vplc $ sfi.py -d . version -R
peers : {'plc': 128.112.139.90:12345'}
hostname : vplc10.pl.sophia.inria.fr
tag : sfa-1.0-6
hrn : ple
interface : registry
geni_api : 1
sfa : 1
.PHONY: all install clean uninstall
.PHONY: all install clean uninstall
+VERSIONTAG=should-be-redefined-by-specfile
+
+python: version
+
+version: sfa/util/version.py
+sfa/util/version.py: sfa/util/version.py.in
+ sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" sfa/util/version.py.in > $@
xmlbuilder-install:
cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
xmlbuilder-install:
cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
python setup.py install --root=$(DESTDIR)
chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
python setup.py install --root=$(DESTDIR)
chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
+python-clean: version-clean
-.PHONY: python python-install python-clean xmlbuilder-install
+version-clean:
+ rm -f sfa/util/version.py
+
+.PHONY: python version python-install python-clean version-clean xmlbuilder-install
##########
wsdl:
$(MAKE) -C wsdl
##########
wsdl:
$(MAKE) -C wsdl
.PHONY: wsdl wsdl-install wsdl-clean
.PHONY: wsdl wsdl-install wsdl-clean
##########
tests-install:
mkdir -p $(DESTDIR)/usr/share/sfa/tests
##########
tests-install:
mkdir -p $(DESTDIR)/usr/share/sfa/tests
+make VERSION=%{version}-%{taglevel}
%install
rm -rf $RPM_BUILD_ROOT
%install
rm -rf $RPM_BUILD_ROOT
-make install DESTDIR="$RPM_BUILD_ROOT"
+make install VERSION=%{version}-%{taglevel} DESTDIR="$RPM_BUILD_ROOT"
%clean
rm -rf $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
parser.add_option("-s", "--slice", dest="delegate_slice",
help="delegate slice credential", metavar="HRN", default=None)
parser.add_option("-s", "--slice", dest="delegate_slice",
help="delegate slice credential", metavar="HRN", default=None)
+ if command in ("version"):
+ parser.add_option("-R","--registry-version",
+ action="store_true", dest="probe_registry", default=False,
+ help="probe registry version instead of slicemgr")
+
def version(self, opts, args):
def version(self, opts, args):
- server = self.get_server_from_opts(opts)
-
- print server.GetVersion()
+ if opts.probe_registry:
+ server=self.registry
+ else:
+ server = self.get_server_from_opts(opts)
+ for (k,v) in server.GetVersion().items():
+ print "%-20s: %s"%(k,v)
# list instantiated slices
def slices(self, opts, args):
# list instantiated slices
def slices(self, opts, args):
from sfa.plc.network import *
from sfa.plc.api import SfaAPI
from sfa.plc.slices import *
from sfa.plc.network import *
from sfa.plc.api import SfaAPI
from sfa.plc.slices import *
+from sfa.util.version import version_core
+def GetVersion(api):
+ return version_core({'interface':'aggregate',
+ 'testbed':'myplc'})
def __get_registry_objects(slice_xrn, creds, users):
"""
def __get_registry_objects(slice_xrn, creds, users):
"""
hostnames.append(node.hostname)
return hostnames
hostnames.append(node.hostname)
return hostnames
-def get_version():
- version = {}
- version['geni_api'] = 1
- version['sfa'] = 1
- return version
-
def slice_status(api, slice_xrn, creds):
hrn, type = urn_to_hrn(slice_xrn)
# find out where this slice is currently running
def slice_status(api, slice_xrn, creds):
hrn, type = urn_to_hrn(slice_xrn)
# find out where this slice is currently running
from sfa.plc.api import SfaAPI
from sfa.plc.slices import *
from sfa.managers.aggregate_manager_pl import __get_registry_objects, __get_hostnames
from sfa.plc.api import SfaAPI
from sfa.plc.slices import *
from sfa.managers.aggregate_manager_pl import __get_registry_objects, __get_hostnames
+from sfa.util.version import version_core
# VINI aggregate is almost identical to PLC aggregate for many operations,
# so lets just import the methods form the PLC manager
# VINI aggregate is almost identical to PLC aggregate for many operations,
# so lets just import the methods form the PLC manager
from sfa.managers.aggregate_manager_pl import (
start_slice, stop_slice, renew_slice, reset_slice, get_slices, get_ticket)
from sfa.managers.aggregate_manager_pl import (
start_slice, stop_slice, renew_slice, reset_slice, get_slices, get_ticket)
-def get_version():
- version = {}
- version['geni_api'] = 1
- version['sfa'] = 1
- return version
+def GetVersion(api):
+ return version_core({'interface':'aggregate',
+ 'testbed':'myplc.vini'})
def slice_status(api, slice_xrn, creds):
result = {}
def slice_status(api, slice_xrn, creds):
result = {}
from sfa.util.xrn import urn_to_hrn
from sfa.util.plxrn import hrn_to_pl_slicename
from sfa.util.sfaticket import SfaTicket
from sfa.util.xrn import urn_to_hrn
from sfa.util.plxrn import hrn_to_pl_slicename
from sfa.util.sfaticket import SfaTicket
+from sfa.util.version import version_core
+
+def GetVersion(api):
+ return version_core({'interface':'component',
+ 'testbed':'myplc'})
def init_server():
from sfa.server import sfa_component_setup
def init_server():
from sfa.server import sfa_component_setup
sfa_component_setup.get_credential(force=True)
sfa_component_setup.get_trusted_certs()
sfa_component_setup.get_credential(force=True)
sfa_component_setup.get_trusted_certs()
-def get_version():
- version = {}
- version['geni_api'] = 1
- return version
-
def slice_status(api, slice_xrn, creds):
result = {}
result['geni_urn'] = slice_xrn
def slice_status(api, slice_xrn, creds):
result = {}
result['geni_urn'] = slice_xrn
from sfa.trust.credential import Credential
from sfa.trust.certificate import Certificate, Keypair
from sfa.trust.gid import create_uuid
from sfa.trust.credential import Credential
from sfa.trust.certificate import Certificate, Keypair
from sfa.trust.gid import create_uuid
+from sfa.util.version import version_core
-def get_version(api):
- version = {}
- version['geni_api'] = 1
- version['sfa'] = 1
- return version
+# The GENI GetVersion call
+def GetVersion(api):
+ peers =dict ([ (peername,v._ServerProxy__host) for (peername,v) in api.registries.items()
+ if peername != api.hrn])
+ return version_core({'interface':'registry',
+ 'hrn':api.hrn,
+ 'peers':peers})
def get_credential(api, xrn, type, is_self=False):
# convert xrn to hrn
def get_credential(api, xrn, type, is_self=False):
# convert xrn to hrn
return new_cred.save_to_string(save_parents=True)
return new_cred.save_to_string(save_parents=True)
-# The GENI GetVersion call
-def GetVersion():
- version = {}
- version['geni_api'] = 1
- return version
-
def resolve(api, xrns, type=None, full=True):
# load all know registry names into a prefix tree and attempt to find
def resolve(api, xrns, type=None, full=True):
# load all know registry names into a prefix tree and attempt to find
-### $Id: slices.py 15842 2009-11-22 09:56:13Z anil $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/plc/slices.py $
-
import sys
import time,datetime
from StringIO import StringIO
import sys
import time,datetime
from StringIO import StringIO
from sfa.util.threadmanager import ThreadManager
import sfa.util.xmlrpcprotocol as xmlrpcprotocol
import sfa.plc.peers as peers
from sfa.util.threadmanager import ThreadManager
import sfa.util.xmlrpcprotocol as xmlrpcprotocol
import sfa.plc.peers as peers
-
-def get_version():
- version = {}
- version['geni_api'] = 1
- version['sfa'] = 1
- return version
+from sfa.util.version import version_core
+
+def GetVersion(api):
+ peers =dict ([ (peername,v._ServerProxy__host) for (peername,v) in api.aggregates.items()
+ if peername != api.hrn])
+ return version_core({'interface':'slicemgr',
+ 'hrn' : api.hrn,
+ 'peers': peers,
+ })
def slice_status(api, slice_xrn, creds ):
hrn, type = urn_to_hrn(slice_xrn)
def slice_status(api, slice_xrn, creds ):
hrn, type = urn_to_hrn(slice_xrn)
def call(self):
self.api.logger.info("interface: %s\tmethod-name: %s" % (self.api.interface, self.name))
manager = self.api.get_interface_manager()
def call(self):
self.api.logger.info("interface: %s\tmethod-name: %s" % (self.api.interface, self.name))
manager = self.api.get_interface_manager()
-
- return manager.get_version()
-
+ return manager.GetVersion(self.api)
--- /dev/null
+### updated by the toplevel Makefile
+version_tag="@VERSIONTAG@"
+import socket
+
+def version_core (more):
+ core = { 'geni_api':1,
+ 'sfa' : 1,
+ 'tag' : version_tag,
+ 'hostname' : socket.gethostname(),
+ }
+ core.update(more)
+ return core