How to use the pybatfish.util.util.get_uuid function in pybatfish

To help you get started, we’ve selected a few pybatfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github batfish / batfish / projects / pybatfish / pybatfish / client / commands.py View on Github external
def bf_init_environment(environmentName=None, interfaceBlacklist=None, nodeBlacklist=None):
    
    _check_base_testrig()
    
    if (environmentName is None):
        environmentName = Options.default_delta_env_prefix + batfishutils.get_uuid()
        
    bf_session.deltaTestrig = bf_session.baseTestrig
    bf_session.deltaEnvironment = environmentName
    bf_logger.info("Delta testrig/environment is now set to %s/%s", bf_session.deltaTestrig, bf_session.deltaEnvironment)
    
    return bf_answer("environmentcreation", environmentName=environmentName, interfaceBlacklist=interfaceBlacklist, nodeBlacklist=nodeBlacklist)
github batfish / batfish / projects / pybatfish / pybatfish / client / commands.py View on Github external
'''
    Initialize a new testrig
    '''

    fileToSend = dirOrZipfile
    
    if (os.path.isdir(dirOrZipfile)):
        tempFile = tempfile.NamedTemporaryFile()
        batfishutils.zip_dir(dirOrZipfile, tempFile)
        fileToSend = tempFile.name

    if (bf_session.container is None):
        bf_init_container()

    if (testrigName is None):
        testrigName = Options.default_testrig_prefix + batfishutils.get_uuid()
    
    jsonData = workhelper.get_data_upload_testrig(bf_session, testrigName, fileToSend)
    resthelper.get_json_response(bf_session, CoordConsts.SVC_UPLOAD_TESTRIG_RSC, jsonData)
    
    if (not doDelta):
        bf_session.baseTestrig = testrigName
        bf_session.baseEnvironment = BfConsts.RELPATH_DEFAULT_ENVIRONMENT_NAME
        bf_logger.info("Base testrig/environment is now set to %s/%s", bf_session.baseTestrig, bf_session.baseEnvironment)
    else:
        bf_session.deltaTestrig = testrigName
        bf_session.deltaEnvironment = BfConsts.RELPATH_DEFAULT_ENVIRONMENT_NAME        
        bf_logger.info("Delta testrig/environment is now set to %s/%s", bf_session.deltaTestrig, bf_session.deltaEnvironment)
    
    workItem = workhelper.get_workitem_parse(bf_session, doDelta)
    answer = workhelper.execute(workItem, bf_session)