def validate(CopiesPerParent, TargetTagList, TemplateXml, TemplateXmlFileName,
             TagPrefix, AutoExpandTemplate, EnableLoadFromFileName,
             StmTemplateMix, Weight, RulesFileName, StreamsPerRule, ConformToAccept):
    global acl
    plLogger = PLLogger.GetLogger('Methodology')
    plLogger.LogDebug('LoadTrafficRulesCommand.validate()')
    # msg = base.validate(CopiesPerParent, TargetTagList, TemplateXml, TemplateXmlFileName,
    #                     TagPrefix, AutoExpandTemplate, EnableLoadFromFileName,
    #                     TrafficMix, Weight)
    # if msg != '':
    #     return msg

    if StreamsPerRule == 0:
        return 'StreamsPerRule cannot be zero.'

    acl = AccessControlList(ConformToAccept)
    return acl.import_rules_file(RulesFileName)
Пример #2
0
def test_acl_import_content():
    acl = AccessControlList(True)
    msg = acl.import_content(good_rules1())
    assert msg == ''
    assert acl.count() == 2
    acl = AccessControlList(True)
    msg = acl.import_content(bad_rules1())
    assert msg != ''
    assert acl.count() == 0
    msg = acl.import_content(bad_rules2())
    assert msg != ''
    assert acl.count() == 1
    return