当前位置: 首页>>代码示例>>Python>>正文


Python access.MoDirectory类代码示例

本文整理汇总了Python中cobra.mit.access.MoDirectory的典型用法代码示例。如果您正苦于以下问题:Python MoDirectory类的具体用法?Python MoDirectory怎么用?Python MoDirectory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MoDirectory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: apic_login

def apic_login(hostname, username, password):
    """Login to APIC"""
    epoint = EndPoint(hostname, secure=False, port=80)
    lsess = LoginSession(username, password)
    modir = MoDirectory(epoint, lsess)
    modir.login()
    return modir
开发者ID:Kantharaj,项目名称:ACI,代码行数:7,代码来源:createVmmDomain.py

示例2: test_post_tn

 def test_post_tn(self, apics, certobject, userobject):
     apic = apics[0]
     secure = False if apics[1] == 'False' else True
     userobject.pkey = certobject.readFile(
         fileName=certobject.pkeyfile)
     session = CertSession(apic, userobject.certDn, userobject.pkey,
                           secure=secure, requestFormat='xml')
     moDir = MoDirectory(session)
     uni = Uni('')
     fvTenant = Tenant(uni, name='t')
     fvBD = BD(fvTenant, 't-bd')
     fvAp = Ap(fvTenant, 't-app')
     cr = ConfigRequest()
     #cr.subtree = 'full'
     cr.addMo(fvTenant)
     if userobject.user == 'rouser':
         with pytest.raises(RestError) as excinfo:
             r = moDir.commit(cr)
         assert ((excinfo.value.reason == ('user rouser does not have ' +
                                           'domain access to config Mo, ' +
                                           'class fvTenant')) or
                 (excinfo.value.reason == ('user rouser does not have ' +
                                           'domain access to config Mo, ' +
                                           'class fvBD')))
     elif userobject.user == 'rwuser':
         r = moDir.commit(cr)
     else:
         raise NotImplementedError
开发者ID:bischatt78,项目名称:cobra,代码行数:28,代码来源:test_session_CertSession.py

示例3: do_login

def do_login():
    apicUrl = 'https://198.18.133.200'
    loginSession = LoginSession(apicUrl, 'admin', 'C1sco12345')
    active_session = MoDirectory(loginSession)
    active_session.login()
    # print loginSession.cookie
    return active_session
开发者ID:GDT-Labs,项目名称:Nexus9kBUVisit,代码行数:7,代码来源:ACI_cobra_test.py

示例4: login_gui

def login_gui():
    root =Tk()
    root.minsize(700,400)
    root.title("Cisco APIC Login")
    ment_1 = StringVar()
    ment_2 = StringVar()
    ment_3 = StringVar()
    label_1 = Label(root, text = "ip address").pack()
    mentry = Entry(root,textvariable = ment_1 ).pack()
    label_2 = Label(root, text = "username").pack()
    mentry_2 = Entry(root,textvariable = ment_2 ).pack()
    label_3 = Label(root, text = "password").pack()
    mentry_3 = Entry(root, show="*", width=20, bg = "gray",textvariable = ment_3 ).pack()
    frame = Frame(root)
    frame.pack()    
    button = Button(frame,text = "ok", command = lambda: close_device(root), bg = "gray",fg = "black")
    button.pack()
    root.mainloop()    
    apicIP = ment_1.get()
    user = ment_2.get()
    pw = ment_3.get()
    
    try:
        ## login to APIC
        apicUrl = 'https://'+apicIP                                                         # defaulting to https
        loginSession = LoginSession(apicUrl, user, pw,secure=False)
        moDir = MoDirectory(loginSession)
        moDir.login()
    except:
        print "the username and/or password you entered is incorrect"
                
    return apicUrl,moDir
开发者ID:chambear2809,项目名称:find_vlan,代码行数:32,代码来源:find_vlan.py

示例5: apic_login

 def apic_login(self):
     """Login to APIC"""
     lsess = LoginSession('https://' + self.host, self.user, self.password)
     modir = MoDirectory(lsess)
     modir.login()
     print lsess.cookie
     return modir
开发者ID:GDT-Labs,项目名称:Nexus9kBUVisit,代码行数:7,代码来源:test.py

示例6: login_cli

def login_cli(apicUrl, user, password):
    try:
        loginSession = LoginSession(apicUrl,user,password)
        moDir = MoDirectory(loginSession)
        moDir.login()
    except:
        print "the username and/or password you entered is incorrect"    
    return moDir
开发者ID:chambear2809,项目名称:display_if_status,代码行数:8,代码来源:display_if_status.py

示例7: moDir

def moDir(request):
    url, user, password, secure = request.param
    secure = False if secure == 'False' else True
    session = LoginSession(url, user, password,
                           secure=secure, requestFormat='json')
    md = MoDirectory(session)
    md.login()
    return md
开发者ID:bischatt78,项目名称:cobra,代码行数:8,代码来源:test_session_CertSession.py

示例8: apic_login

 def apic_login(self):
     """Login to APIC"""
     if not self.host.startswith(('http', 'https')):
         self.host = 'https://' + self.host
     lsess = LoginSession(self.host, self.user, self.password)
     modir = MoDirectory(lsess)
     modir.login()
     self.modir = modir
开发者ID:bairointernet,项目名称:ACI,代码行数:8,代码来源:createMo.py

示例9: apic_login

def apic_login(hostname, username, password): 
    url = "http://" + hostname
    sess = LoginSession(url, username, password) modir = MoDirectory(sess)
    try:
        modir.login()
    except:
        print 'Login error'
        exit(1)
    return modir
开发者ID:jlopez2,项目名称:ACI_Devops,代码行数:9,代码来源:python1.py

示例10: main

def main(host, username, password, tenant):
    apic = "https://%s" % host
    print("Connecting to APIC : %s" % apic)
    moDir = MoDirectory(LoginSession(apic, username, password))
    moDir.login()
    dn_name = "uni/tn-" + tenant
    print(dn_name)
    dnq = DnQuery(dn_name)
    dnq.subtree = 'children'
    tenantMO = moDir.query(dnq)
    for bdMO in tenantMO.BD:
        print("BD NAME => {", bdMO.name, "}")
开发者ID:gent79reid,项目名称:ACI,代码行数:12,代码来源:list_bd_in_tenant_v1.py

示例11: mo_apic_login

def mo_apic_login(hostname, username, password):
    # Login to the APIC using cobra module
    
    url = hostname
    sess = LoginSession(url, username, password)
    modir = MoDirectory(sess)
    try:
        modir.login()
    except:
        print 'Login error'
        exit(1)
    return modir
开发者ID:mijo77,项目名称:cisco_class,代码行数:12,代码来源:apic_epgStats.py

示例12: test_cleanup_user

 def test_cleanup_user(self, apics, certobject, userobject):
     apic = apics[0]
     user = apics[2]
     password = apics[3]
     secure = False if apics[1] == 'False' else True
     userobject.aaaUser.delete()
     session = LoginSession(apic, user, password, secure=secure)
     moDir = MoDirectory(session)
     moDir.login()
     cr = ConfigRequest()
     cr.addMo(userobject.aaaUser)
     r = moDir.commit(cr)
     assert r == []
开发者ID:bischatt78,项目名称:cobra,代码行数:13,代码来源:test_session_CertSession.py

示例13: apic_login

def apic_login(hostname, username, password):
    '''
    Function that creates a session to communicate with the APIC
    '''
    url = "https://" + hostname
    login_session = cobra.mit.session.LoginSession(url, username, password)
    modir = MoDirectory(login_session)
    print 'connecting to ' + hostname
    try:
        modir.login()
    except:
        print 'Login error'
        exit(1)
    return modir
开发者ID:fancyTyphoonKitty,项目名称:cisco_class,代码行数:14,代码来源:ntp.py

示例14: login_cli

def login_cli(apicIP,userID,pw):
    try:
        ## login to APIC
        if apicIP == False:
            apicIP = raw_input("\nWhat is the APIC IP ? Format xxx.xxx.xxx.xxx\n")
            userID = raw_input("\nUser ID: ")
            pw = getpass.getpass().strip("/\r")
        apicUrl = 'https://'+apicIP                                                        # defaulting to https
        loginSession = LoginSession(apicUrl, userID, pw,secure=False)
        moDir = MoDirectory(loginSession)
        moDir.login()
    except:
        print "the username and/or password you entered is incorrect"
                
    return apicUrl,moDir
开发者ID:chambear2809,项目名称:find_vlan,代码行数:15,代码来源:find_vlan.py

示例15: test_get_tn

 def test_get_tn(self, apics, certobject, userobject):
     apic = apics[0]
     secure = False if apics[1] == 'False' else True
     userobject.pkey = certobject.readFile(
         fileName=certobject.pkeyfile)
     session = CertSession(apic, userobject.certDn, userobject.pkey,
                           secure=secure, requestFormat='xml')
     moDir = MoDirectory(session)
     dnQuery = DnQuery('uni/tn-common')
     #dnQuery.subtree = "full"
     tq = moDir.query(dnQuery)
     assert len(tq) == 1
     tq = tq[0]
     assert str(tq.parentDn) == 'uni'
     assert str(tq.dn) == 'uni/tn-common'
开发者ID:bischatt78,项目名称:cobra,代码行数:15,代码来源:test_session_CertSession.py


注:本文中的cobra.mit.access.MoDirectory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。