def configureBackupPolicy(config):
    fabricInst = aciFabric.Inst(aciPol.Uni(''))
    fileRemotePath = aciFile.RemotePath(fabricInst,
                                        userName=config['path']['user'],
                                        remotePort=config['path']['port'],
                                        protocol=config['path']['protocol'],
                                        name=config['path']['name'],
                                        descr=config['path']['descr'],
                                        userPasswd=config['path']['password'],
                                        host=config['path']['host'],
                                        remotePath=config['path']['remotePath']
                                        )
    aciFile.RsARemoteHostToEpg(fileRemotePath,
                               tDn='uni/tn-mgmt/mgmtp-default/oob-default')
    trigSchedP = aciTrig.SchedP(fabricInst, name=config['schedule']['name'])
    aciTrig.RecurrWindowP(trigSchedP, name=config['schedule']['period'],
                          hour=config['schedule']['hour'])
    configExportP = aciConfig.ExportP(fabricInst, name=config['name'],
                                      descr=config['descr'],
                                      adminSt='triggered')
    aciConfig.RsExportScheduler(configExportP,
                                tnTrigSchedPName=config['schedule']['name'])
    aciConfig.RsRemotePath(configExportP,
                           tnFileRemotePathName=config['path']['name'])
    return fabricInst
示例#2
0
def create_snmp_group_policy(mo, policy):
    # Create new object if needed
    if mo is None:
        mo = aciFabric.Inst(aciPol.Uni(''))

    snmpGroup = snmp.Group(mo, name=policy['name'])

    for dest in policy['snmpTrapDest']:
        trapDest = snmp.TrapDest(snmpGroup,
                                 host=dest['host'],
                                 port=dest['port'],
                                 notifT=dest['notifT'],
                                 ver=dest['ver'],
                                 secName=dest['secName'],
                                 v3SecLvl=dest['v3SecLvl'])
        aciFile.RsARemoteHostToEpg(trapDest,
                                   tDn='uni/tn-mgmt/mgmtp-default/oob-default')

    return mo
示例#3
0
def create_syslog_policy(mo, policy):
    if mo is None:
        mo = aciFabric.Inst(aciPol.Uni(''))

    slGrp = aciSyslog.Group(mo,
                            name=policy['name'],
                            format=policy['format'],
                            includeMilliSeconds=policy['includeMilliSeconds'])

    p = policy['syslogProf']
    aciSyslog.Prof(slGrp, name=p['name'], adminState=p['adminState'])

    p = policy['syslogFile']
    aciSyslog.File(slGrp,
                   adminState=p['adminState'],
                   format=p['format'],
                   severity=p['severity'])

    p = policy['syslogConsole']
    aciSyslog.Console(slGrp,
                      adminState=p['adminState'],
                      format=p['format'],
                      severity=p['severity'])

    # Remote destinations
    for d in policy['syslogRemoteDest']:
        dest = aciSyslog.RemoteDest(slGrp,
                                    name=d['name'],
                                    host=d['host'],
                                    port=d['port'],
                                    adminState=d['adminState'],
                                    format=d['format'],
                                    severity=d['severity'],
                                    forwardingFacility=d['forwardingFacility'])

        aciFile.RsARemoteHostToEpg(dest,
                                   tDn='uni/tn-mgmt/mgmtp-default/oob-default')

    return mo