Esempio n. 1
0
    def __init__ (self, auth=None, hostname=None, slicename=None, slivername=None, username=None, **kwargs):
        
        if hostname is not None:
            self.type = 'node'
            self.hrn = '.'.join( [auth, Xrn.escape(hostname)] )
            self.hrn_to_urn()

        elif slicename is not None:
            self.type = 'slice'
            self.hrn = '.'.join([auth, slicename])
            self.hrn_to_urn()
        
        elif slivername is not None:
            self.type = 'sliver'
            # Reformat sliver name
            xrn_slivername = clab_slivername_to_xrn_slivername(slivername)
            self.hrn = '.'.join([auth, xrn_slivername])
            self.hrn_to_urn()
            
        elif username is not None:
            self.type = 'user'
            self.hrn = '.'.join([auth, username])
            self.hrn_to_urn()

        else:
            Xrn.__init__ (self, **kwargs)
Esempio n. 2
0
 def __init__ (self, auth=None, hostname=None, slicename=None, email=None, interface=None, **kwargs):
     #def hostname_to_hrn(auth_hrn, login_base, hostname):
     if hostname is not None:
         self.type='node'
         # keep only the first part of the DNS name
         #self.hrn='.'.join( [auth,hostname.split(".")[0] ] )
         # escape the '.' in the hostname
         self.hrn='.'.join( [auth,Xrn.escape(hostname)] )
         self.hrn_to_urn()
     #def slicename_to_hrn(auth_hrn, slicename):
     elif slicename is not None:
         self.type='slice'
         # split at the first _
         parts = slicename.split("_",1)
         self.hrn = ".".join([auth] + parts )
         self.hrn_to_urn()
     #def email_to_hrn(auth_hrn, email):
     elif email is not None:
         self.type='person'
         # keep only the part before '@' and replace special chars into _
         self.hrn='.'.join([auth,email.split('@')[0].replace(".", "_").replace("+", "_")])
         self.hrn_to_urn()
     elif interface is not None:
         self.type = 'interface'
         self.hrn = auth + '.' + interface
         self.hrn_to_urn()
     else:
         Xrn.__init__ (self,**kwargs)
Esempio n. 3
0
File: plxrn.py Progetto: aquila/sfa
 def __init__ (self, auth=None, hostname=None, slicename=None, email=None, interface=None, **kwargs):
     #def hostname_to_hrn(auth_hrn, login_base, hostname):
     if hostname is not None:
         self.type='node'
         # keep only the first part of the DNS name
         #self.hrn='.'.join( [auth,hostname.split(".")[0] ] )
         # escape the '.' in the hostname
         self.hrn='.'.join( [auth,Xrn.escape(hostname)] )
         self.hrn_to_urn()
     #def slicename_to_hrn(auth_hrn, slicename):
     elif slicename is not None:
         self.type='slice'
         # split at the first _
         parts = slicename.split("_",1)
         self.hrn = ".".join([auth] + parts )
         self.hrn_to_urn()
     #def email_to_hrn(auth_hrn, email):
     elif email is not None:
         self.type='person'
         # keep only the part before '@' and replace special chars into _
         self.hrn='.'.join([auth,email.split('@')[0].replace(".", "_").replace("+", "_")])
         self.hrn_to_urn()
     elif interface is not None:
         self.type = 'interface'
         self.hrn = auth + '.' + interface
         self.hrn_to_urn()
     else:
         Xrn.__init__ (self,**kwargs)
Esempio n. 4
0
File: osxrn.py Progetto: tubav/sfa
 def __init__(self, name=None, type=None, **kwds):
     
     config = Config()
     if name is not None:
         self.type = type
         self.hrn = config.SFA_INTERFACE_HRN + "." + name
         self.hrn_to_urn()
     else:
         Xrn.__init__(self, **kwds)   
      
     self.name = self.get_name() 
Esempio n. 5
0
File: osxrn.py Progetto: tubav/sfa
    def __init__(self, name=None, auth=None, **kwds):

        config = Config()
        if name is not None:
            if "type" in kwds:
                self.type = kwds["type"]
            if auth is not None:
                self.hrn = ".".join([auth, cleanup_name(name)])
            else:
                self.hrn = config.SFA_INTERFACE_HRN + "." + cleanup_name(name)
            self.hrn_to_urn()
        else:
            Xrn.__init__(self, **kwds)

        self.name = self.get_name()
Esempio n. 6
0
    def __init__(self, name=None, auth=None, **kwds):

        config = Config()
        self.id = id
        if name is not None:
            Xrn.__init__(self, **kwds)
            if 'type' in kwds:
                self.type = kwds['type']
            if auth is not None:
                self.hrn = '.'.join([auth, cleanup_name(name)])
            else:
                self.hrn = name.replace('_', '.')
            self.hrn_to_urn()
        else:
            Xrn.__init__(self, **kwds)

        self.name = self.get_name()
Esempio n. 7
0
File: osxrn.py Progetto: aquila/sfa
 def __init__(self, name=None, auth=None, **kwds):
     
     config = Config()
     self.id = id
     if name is not None:
         Xrn.__init__(self, **kwds)
         if 'type' in kwds:
             self.type = kwds['type']
         if auth is not None:
             self.hrn='.'.join([auth, cleanup_name(name)]) 
         else:
             self.hrn = name.replace('_', '.')
         self.hrn_to_urn()
     else:
         Xrn.__init__(self, **kwds)   
      
     self.name = self.get_name() 
Esempio n. 8
0
    def __init__ (self, auth=None, hostname=None, login=None,
                                            slicename=None, **kwargs):
        #def hostname_to_hrn(auth_hrn, login_base, hostname):
        if hostname is not None:
            self.type = 'node'
            # keep only the first part of the DNS name
            # escape the '.' in the hostname
            self.hrn = '.'.join( [auth, Xrn.escape(hostname)] )
            self.hrn_to_urn()

        elif login is not None:
            self.type = 'person'
            self.hrn = '.'.join([auth, login])
            self.hrn_to_urn()
        #def slicename_to_hrn(auth_hrn, slicename):
        elif slicename is not None:
            self.type = 'slice'
            slicename = '_'.join([login, "slice"])
            self.hrn = '.'.join([auth, slicename])
            self.hrn_to_urn()
            # split at the first _

        else:
            Xrn.__init__ (self, **kwargs)