Ticket #1015: sfa-2.0-9-patch-4.diff

File sfa-2.0-9-patch-4.diff, 3.8 KB (added by xyang@maxgigapop.net, 9 years ago)
  • /usr/lib/python2.6/site-packages/sfa/managers/

    old new class AggregateManagerMax (AggregateMana 
    350350        #TODO: create real CreateSliver response rspec
    351351        ret = self.create_slice(api, slice_xrn, creds, rspec_string, users)
    352352        if ret:
    353             return self.get_rspec(api, creds, slice_xrn)
     353            # wait some time for circuit ID to show up in query
     354            time.sleep(30)
     355            ret = self.get_rspec(api, creds, slice_xrn)
     356            gri = self.get_xml_by_tag(ret, 'globalId')
     357            rest_of_ret = ret
     358            while gri:
     359                tokens = gri.split('<')
     360                gri = tokens[1].split('>')[1]
     361                creatorUrn = Credential(string=creds[0]).gidCaller.get_urn()
     362                creatorEmail = Credential(string=creds[0]).gidCaller.get_email()
     363                sliceEmail = Credential(string=creds[0]).gidObject.get_email()
     364                logger.info("NOCReport{CreateSliver: CircuitID='%s',SliceURN='%s',CreatorUrn='%s',CreatorEmail='%s',SliceEmail='%s'}" % (gri, slice_xrn, creatorUrn, creatorEmail, sliceEmail))
     365                rest_of_ret = rest_of_ret[rest_of_ret.find('<globalId>'+gri)+(10+len(gri)):]
     366                gri = self.get_xml_by_tag(rest_of_ret, 'globalId')
     367            return ret
    354368        else:
    355369            return "<?xml version=\"1.0\" ?> <rspec type=\"manifest\"> Error! </rspec>"
    356370   
  • /usr/lib/python2.6/site-packages/sfa/trust/

    old new class GID(Certificate): 
    6969    uuid = None
    7070    hrn = None
    7171    urn = None
     72    email = None # for adding to the SubjectAltName
    7273
    7374    ##
    7475    # Create a new GID object
    class GID(Certificate): 
    121122            self.decode()
    122123        return self.urn           
    123124
     125    # Will be stuffed into subjectAltName
     126    def set_email(self, email):
     127        self.email = email
     128
     129    def get_email(self):
     130        if not self.email:
     131            self.decode()
     132        return self.email
     133
    124134    def get_type(self):
    125135        if not self.urn:
    126136            self.decode()
    class GID(Certificate): 
    143153        if self.uuid:
    144154            str += ", " + "URI:" + uuid.UUID(int=self.uuid).urn
    145155       
     156        if self.email:
     157            str += ", " + "email:" + self.email
     158
    146159        self.set_data(str, 'subjectAltName')
    147160
    148161       
    class GID(Certificate): 
    166179                        dict['uuid'] = uuid.UUID(val[4:]).int
    167180                    elif val.lower().startswith('uri:urn:publicid:idn+'):
    168181                        dict['urn'] = val[4:]
     182                    elif val.lower().startswith('email:'):
     183                        # FIXME: Ensure there isn't cruft in that address...
     184                        # EG look for email:copy,....
     185                        dict['email'] = val[6:]
    169186                   
    170187        self.uuid = dict.get("uuid", None)
    171188        self.urn = dict.get("urn", None)
    172         self.hrn = dict.get("hrn", None)   
     189        self.hrn = dict.get("hrn", None)
     190        self.email = dict.get("email", None)
    173191        if self.urn:
    174192            self.hrn = urn_to_hrn(self.urn)[0]
    175193
    class GID(Certificate): 
    187205        result += " "*indent + "hrn:" + str(self.get_hrn()) +"\n"
    188206        result += " "*indent + "urn:" + str(self.get_urn()) +"\n"
    189207        result += " "*indent + "uuid:" + str(self.get_uuid()) + "\n"
     208        if self.get_email() is not None:
     209            result += " "*indent + "email:" + str(self.get_email()) + "\n"
    190210        filename=self.get_filename()
    191211        if filename: result += "Filename %s\n"%filename
    192212