Beispiel #1
0
def create_physical_domain(apic, policies):
    mo = aciPol.Uni('')

    vlanPools = apic.lookupByClass('fvnsVlanInstP')
    pools = dict([v.name, v.allocMode] for v in vlanPools)

    for policy in policies:
        physDomP = phys.DomP(mo, name=policy['name'])

        pool = policy['vlan_pool']
        mode = pools[pool]
        vlan_pool_name = 'uni/infra/vlanns-[{0}]-{1}'.format(pool, mode)

        aciInfra.RsVlanNs(physDomP, tDn=vlan_pool_name)

    return mo
def createVmmDomain(moDirectory, vlanPoolDn, vSphereConfig):
    vmmProvP = moDirectory.lookupByDn('uni/vmmp-VMware')
    vmmDomP = vmm.DomP(vmmProvP, name=vSphereConfig['vSwitch'])
    vmmUsrAccp = vmm.UsrAccP(vmmDomP,
                             "{}_credential".format(vSphereConfig['name']),
                             usr=vSphereConfig['user'],
                             pwd=vSphereConfig['password'])
    aciInfra.RsVlanNs(vmmDomP, tDn=vlanPoolDn)
    vmmCtrlrP = vmm.CtrlrP(vmmDomP,
                           vSphereConfig['name'],
                           rootContName=vSphereConfig['datacenter'],
                           dvsVersion=vSphereConfig['version'],
                           hostOrIp=vSphereConfig['ip'])
    vmm.RsAcc(vmmCtrlrP, tDn=vmmUsrAccp.dn)
    vmmVSwitchPolicyCont = vmm.VSwitchPolicyCont(vmmDomP)
    vmm.RsVswitchOverrideCdpIfPol(vmmVSwitchPolicyCont,
                                  tDn=getCdpIntPolicy('CDP_Enable'))
    vmm.RsVswitchOverrideLldpIfPol(vmmVSwitchPolicyCont,
                                   tDn=getLldpIntPolicy('LLDP_Enable'))
    vmm.RsVswitchOverrideLacpPol(vmmVSwitchPolicyCont,
                                 tDn=getLacpIntPolicy('LACP_Active'))
    return vmmDomP
def createPhysDomain(name, vlanPoolName):
    physDomP = phys.DomP(aciPol.Uni(''), name="{}_physDom".format(name))
    aciInfra.RsVlanNs(physDomP,
                      tDn=getStaticVlanPoolDnFromName(vlanPoolName))
    return physDomP
def createL3Domain(name, vlanPoolName=''):
    l3extDomP = aciL3Ext.DomP(aciPol.Uni(''), name="{}_extL3Dom".format(name))
    if vlanPoolName != '':
        aciInfra.RsVlanNs(l3extDomP,
                          tDn=getStaticVlanPoolDnFromName(vlanPoolName))
    return l3extDomP
Beispiel #5
0
        tDn='uni/tn-common/flt-any-any',
        forceResolve='yes',
        tnVzFilterName='any-any')

    # OSPF Area
    #ospf.ExtP(l3outMo, areaCtrl='redistribute,summary', areaType='regular', areaCost='1', areaId='backbone')

    ## Create VlanPool
    vlanPoolMo = fvns.VlanInstP('uni/infra',
                                allocMode='static',
                                name=l3outPoolName)
    vlanEncapBlkMo = fvns.EncapBlk(vlanPoolMo, vlanfield, vlanfield)

    ## Create l3OutDomain
    l3outDomMo = l3ext.DomP(topMo, name=l3outDomainName)
    l3OutVlansMo = infra.RsVlanNs(
        l3outDomMo, tDn='uni/infra/vlanns-[{}]-static'.format(l3outPoolName))

    ##Build AAEP And associate it to l3outdom
    # I only needed to do this once... and we will not need to do it again until we expand to a different set of physical ports/leaf nodes
    #aaepMo=infra.AttEntityP('uni/infra',name=aaEPName)
    #infra.RsDomP(aaepMo,tDn=l3outtDn)
    #aaepmoCfg=request.ConfigRequest()
    #aaepMo.delete()
    #aaepmoCfg.addMo(aaepMo)
    #moDir.commit(aaepmoCfg)

    ##build PortGroup and associate it with AAEP
    # Example query for a portgroup if you needed it
    #portgrouplist=moDir.lookupByClass('infraAccBndlGrp',propFilter='eq(infraAccBndlGrp.name,"{}")'.format(pathEPName))
    #portgroupMo= portgrouplist[0]
    # You have to start at the ill-defined "FuncP"