How to use the pybatfish.util.batfish_exception.BatfishException 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 _check_delta_testrig():
    _check_container()
    if (bf_session.deltaTestrig is None):
        raise BatfishException("Delta testrig is not set")

    if (bf_session.deltaEnvironment is None):
        raise BatfishException("Delta environment is not set")
github batfish / batfish / projects / pybatfish / pybatfish / client / commands.py View on Github external
def _check_base_testrig():
    _check_container()
    if (bf_session.baseTestrig is None):
        raise BatfishException("Base testrig is not set")

    if (bf_session.baseEnvironment is None):
        raise BatfishException("Base environment is not set")
github batfish / batfish / projects / pybatfish / pybatfish / client / resthelper.py View on Github external
response = requests.post(
                session.get_url(resource), 
                data=multipart_data, 
                verify=session.verifySslCerts,
                stream=stream,
                headers={'Content-Type': multipart_data.content_type},
                #uncomment line below if you want http capture by fiddler
                #proxies = {'http': 'http://127.0.0.1:8888', 'https': 'http://127.0.0.1:8888'}
            )
            response.raise_for_status()
            return response
        except ConnectionError, e:
            if (numTries > Options.num_tries_warn_threshold):
                session.logger.info("Could not connect to coordinator at %s. NumTriesLeft = %d", session.get_url(resource), numTriesLeft)
            if (numTriesLeft <= 0):
                raise BatfishException("Failed to connect to Coordinator", cause=BatfishException(e))
            else:
                time.sleep(Options.seconds_to_sleep_between_tries_to_coordinator);
github batfish / batfish / projects / pybatfish / pybatfish / client / commands.py View on Github external
def _check_delta_testrig():
    _check_container()
    if (bf_session.deltaTestrig is None):
        raise BatfishException("Delta testrig is not set")

    if (bf_session.deltaEnvironment is None):
        raise BatfishException("Delta environment is not set")
github batfish / batfish / projects / pybatfish / pybatfish / client / commands.py View on Github external
def bf_init_container(containerPrefix=Options.default_container_prefix):
    '''
    Initialize a new container
    '''
    
    jsonData = workhelper.get_data_init_container(bf_session, containerPrefix)
    jsonResponse = resthelper.get_json_response(bf_session, CoordConsts.SVC_INIT_CONTAINER_RSC, jsonData)
    
    if (jsonResponse[CoordConsts.SVC_CONTAINER_NAME_KEY]):
        bf_session.container = jsonResponse[CoordConsts.SVC_CONTAINER_NAME_KEY]
        bf_logger.info("Container is now set to " + bf_session.container)
    else:
        raise BatfishException("Bad json response in init_container; missing expected key: " + CoordConsts.SVC_CONTAINER_NAME_KEY, jsonResponse);