How to use the pybatfish.util.util 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_answer_str(questionStr, parametersStr="{}", doDelta=False):
    '''
    Answer a question based on json strings for question and parametersJsonStr
    '''
    _check_base_testrig();
    if (doDelta):
        _check_delta_testrig();

    #these conversions verify that the strings are proper json
    _questionJson = json.loads(questionStr)
    _parametersJson = json.loads(parametersStr)
 
    questionName = Options.default_question_prefix + "_" + batfishutils.get_uuid()

    jsonData = workhelper.get_data_answer(bf_session, questionName, questionStr, parametersStr)
    resthelper.get_json_response(bf_session, CoordConsts.SVC_UPLOAD_QUESTION_RSC, jsonData)

    workItem = workhelper.get_workitem_answer(bf_session, questionName, doDelta)
    answer = workhelper.execute(workItem, bf_session)

    return answer