Esempio n. 1
0
def createPodPolicy(config):
    fabricInst = aciFabric.Inst(aciPol.Uni(''))
    aciDateTime.Format(fabricInst, name='default', tz=config.timezone)
    datetimePol = aciDateTime.Pol(fabricInst, name='default')
    for ntp in config.ntpList:
        datetimeNtpProv = aciDateTime.NtpProv(datetimePol,
                                              preferred=ntp['preferred'],
                                              name=ntp['name'],
                                              descr=ntp['descr'])
        aciDateTime.RsNtpProvToEpg(datetimeNtpProv,
                                   tDn='uni/tn-mgmt/mgmtp-default/oob-default')
    bgpInstPol = aciBgp.InstPol(fabricInst, name='default')
    aciBgp.AsP(bgpInstPol, name='aspn', asn=config.bgpAsn)
    bgpRRP = aciBgp.RRP(bgpInstPol, name='route-reflector')
    for rrNodeId in getRrNodeIdList(config.fabricNodes):
        aciBgp.RRNodePEp(bgpRRP, id=rrNodeId)

    fabricFuncP = aciFabric.FuncP(fabricInst)
    fabricPodPGrp = aciFabric.PodPGrp(fabricFuncP,
                                      name='default-PodPolicyGroup')
    aciFabric.RsPodPGrpBGPRRP(fabricPodPGrp, tnBgpInstPolName='default')
    aciFabric.RsTimePol(fabricPodPGrp, tnDatetimePolName='default')
    aciFabric.RsPodPGrpIsisDomP(fabricPodPGrp, tnIsisDomPolName='default')
    aciFabric.RsPodPGrpCoopP(fabricPodPGrp, tnCoopPolName='default')
    aciFabric.RsCommPol(fabricPodPGrp, tnCommPolName='default')
    aciFabric.RsSnmpPol(fabricPodPGrp, tnSnmpPolName='default')
    fabricPodP = aciFabric.PodP(fabricInst, name='default')
    fabricPodS = aciFabric.PodS(fabricPodP, type='ALL', name='default')
    aciFabric.RsPodPGrp(fabricPodS, tDn=fabricPodPGrp.dn)
    return fabricInst
Esempio n. 2
0
def create_bgp_policy(mo, policy, nodes):
    """
  If nodes is passed, it's a dictionary of "name": "id" info for the
  fabric nodes (non-controller)
  """
    # Create new object if needed
    if mo is None:
        mo = aciFabric.Inst(aciPol.Uni(''))

    # Create top level BGP policy
    bgpInstPol = aciBgp.InstPol(mo, name=policy['name'])

    # Add ASN daughter
    aciBgp.AsP(bgpInstPol, asn=policy['bgpAsP']['asn'])

    # Add BGP (Internal) RR Fabric Policy
    aciRRP = aciBgp.RRP(bgpInstPol)

    # Add BGP (Internal) RR node
    podId = policy['bgpRRP']['podId']
    for rr in policy['bgpRRP']['bgpRRNodePEp']:
        nodeId = nodes[rr]
        aciBgp.RRNodePEp(aciRRP, id=nodeId, podId=podId)

    return mo