Changeset 7a011e9 for fedd/federation
- Timestamp:
- Mar 1, 2010 4:39:36 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- b78c9ea
- Parents:
- 8353ac6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/dragon_access.py
r8353ac6 r7a011e9 109 109 self.trusted_certs = config.get("access", "trusted_certs") or \ 110 110 config.get("globals", "trusted_certs") 111 112 self.call_GetValue= service_caller('GetValue') 113 self.call_SetValue= service_caller('SetValue') 111 114 112 115 self.soap_services = {\ … … 687 690 break 688 691 692 self.log.debug("made reservation %s %s" % (gri, vlan_no)) 693 689 694 if (rv == 0 and gri and vlan_no and status == 'ACTIVE'): 690 695 return gri, vlan_no … … 709 714 "Failed to open /dev/null: %s" % e) 710 715 716 def export_store_info(self, cf, vlan, connInfo): 717 """ 718 For the export requests in the connection info, install the peer names 719 at the experiment controller via SetValue calls. 720 """ 721 722 for c in connInfo: 723 for p in [ p for p in c.get('parameter', []) \ 724 if p.get('type', '') == 'output']: 725 726 if p.get('name', '') != 'vlan_id': 727 self.log.error("Unknown export parameter: %s" % \ 728 p.get('name')) 729 continue 730 731 k = p.get('key', None) 732 surl = p.get('store', None) 733 if surl and k: 734 value = "%s" % vlan 735 req = { 'name': k, 'value': value } 736 print "calling SetValue %s %s" % (surl, req) 737 self.call_SetValue(surl, req, cf) 738 else: 739 self.log.error("Bad export request: %s" % p) 740 741 def import_store_info(self, cf, connInfo): 742 """ 743 Pull any import parameters in connInfo in. We translate them either 744 into known member names or fedAddrs. 745 """ 746 747 for c in connInfo: 748 for p in [ p for p in c.get('parameter', []) \ 749 if p.get('type', '') == 'input']: 750 name = p.get('name', None) 751 key = p.get('key', None) 752 store = p.get('store', None) 753 754 if name and key and store : 755 req = { 'name': key, 'wait': True } 756 r = self.call_GetValue(store, req, cf) 757 r = r.get('GetValueResponseBody', None) 758 if r : 759 if r.get('name', '') == key: 760 v = r.get('value', None) 761 if v is not None: 762 if name == 'peer': 763 c['peer'] = v 764 else: 765 if c.has_key('fedAttr'): 766 c['fedAttr'].append({ 767 'attribute': name, 'value': value}) 768 else: 769 c['fedAttr']= [{ 770 'attribute': name, 'value': value}] 771 else: 772 raise service_error(service_error.internal, 773 'None value exported for %s' % key) 774 else: 775 raise service_error(service_error.internal, 776 'Different name returned for %s: %s' \ 777 % (key, r.get('name',''))) 778 else: 779 raise service_error(service_error.internal, 780 'Badly formatted response: no GetValueResponseBody') 781 else: 782 raise service_error(service_error.internal, 783 'Bad Services missing info for import %s' % c) 784 785 711 786 def StartSegment(self, req, fid): 712 787 err = None # Any service_error generated after tmpdir is created … … 723 798 if not self.auth.check_attribute(fid, auth_attr): 724 799 raise service_error(service_error.access, "Access denied") 800 else: 801 certfile = "%s/%s.pem" % (self.certdir, aid) 725 802 726 803 if req.has_key('segmentdescription') and \ … … 731 808 raise service_error(service_error.req, 732 809 "Request missing segmentdescription'") 810 811 connInfo = req.get('connection', []) 733 812 734 813 cap, src, dest, vlans = self.extract_parameters(topo) … … 765 844 log=alloc_log) 766 845 846 self.export_store_info(certfile, vlan_no, connInfo) 847 767 848 if gri: 768 849 # Grab the log (this is some anal locking, but better safe than … … 777 858 'allocID': req['allocID'], 778 859 'allocationLog': logv, 779 'fedAttr': [780 {'attribute': 'vlan', 'value': '%d' % vlan_no }781 ]782 860 } 783 861 elif err:
Note: See TracChangeset
for help on using the changeset viewer.