How to use the capirca.lib.policy.Error function in capirca

To help you get started, we’ve selected a few capirca 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 google / capirca / capirca / lib / policy.py View on Github external
"""Error when a option is set for logging."""


class UndefinedAddressError(Error):
  """Error when an undefined address is referenced."""


class NoTermsError(Error):
  """Error when no terms were found."""


class ShadingError(Error):
  """Error when a term is shaded by a prior term."""


class FlexibleMatchError(Error):
  """Error when a term contains an invalid flexible match value."""


class ICMPCodeError(Error):
  """Error when ICMP Codes are used with multiple or invalid types."""


class InvalidTermTTLValue(Error):
  """Error when TTL value is invalid."""


class MixedPortandNonPortProtos(Error):
  """Error when TCP or UDP are used with protocols that do not use ports."""


def TranslatePorts(ports, protocols, term_name):
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when a requested protocol doesn't have any of the requested ports."""


class TermProtocolEtherTypeError(Error):
  """Error when both ether-type & upper-layer protocol matches are requested."""


class TermNoActionError(Error):
  """Error when a term hasn't defined an action."""


class TermInvalidIcmpType(Error):
  """Error when a term has invalid icmp-types specified."""


class InvalidTermActionError(Error):
  """Error when an action is invalid."""


class InvalidTermLoggingError(Error):
  """Error when a option is set for logging."""


class UndefinedAddressError(Error):
  """Error when an undefined address is referenced."""


class NoTermsError(Error):
  """Error when no terms were found."""


class ShadingError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
_MIN_TTL = 0


class Error(Exception):
  """Generic error class."""


class FileNotFoundError(Error):
  """Policy file unable to be read."""


class FileReadError(Error):
  """Policy file unable to be read."""


class RecursionTooDeepError(Error):
  """Included files exceed maximum recursion depth."""


class ParseError(Error):
  """ParseError in the input."""


class TermAddressExclusionError(Error):
  """Excluded address block is not contained in the accepted address block."""


class TermObjectTypeError(Error):
  """Error with an object passed to Term."""


class TermPortProtocolError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when no terms were found."""


class ShadingError(Error):
  """Error when a term is shaded by a prior term."""


class FlexibleMatchError(Error):
  """Error when a term contains an invalid flexible match value."""


class ICMPCodeError(Error):
  """Error when ICMP Codes are used with multiple or invalid types."""


class InvalidTermTTLValue(Error):
  """Error when TTL value is invalid."""


class MixedPortandNonPortProtos(Error):
  """Error when TCP or UDP are used with protocols that do not use ports."""


def TranslatePorts(ports, protocols, term_name):
  """Return all ports of all protocols requested.

  Args:
    ports: list of ports, eg ['SMTP', 'DNS', 'HIGH_PORTS']
    protocols: list of protocols, eg ['tcp', 'udp']
    term_name: name of current term, used for warning messages

  Returns:
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when a term is shaded by a prior term."""


class FlexibleMatchError(Error):
  """Error when a term contains an invalid flexible match value."""


class ICMPCodeError(Error):
  """Error when ICMP Codes are used with multiple or invalid types."""


class InvalidTermTTLValue(Error):
  """Error when TTL value is invalid."""


class MixedPortandNonPortProtos(Error):
  """Error when TCP or UDP are used with protocols that do not use ports."""


def TranslatePorts(ports, protocols, term_name):
  """Return all ports of all protocols requested.

  Args:
    ports: list of ports, eg ['SMTP', 'DNS', 'HIGH_PORTS']
    protocols: list of protocols, eg ['tcp', 'udp']
    term_name: name of current term, used for warning messages

  Returns:
    ret_array: list of ports tuples such as [(25,25), (53,53), (1024,65535)]

  Note:
    Duplication will be taken care of in Term.CollapsePortList
github google / capirca / capirca / lib / policy.py View on Github external
_MIN_TTL = 0


class Error(Exception):
  """Generic error class."""


class FileNotFoundError(Error):
  """Policy file unable to be read."""


class FileReadError(Error):
  """Policy file unable to be read."""


class RecursionTooDeepError(Error):
  """Included files exceed maximum recursion depth."""


class ParseError(Error):
  """ParseError in the input."""


class TermAddressExclusionError(Error):
  """Excluded address block is not contained in the accepted address block."""


class TermObjectTypeError(Error):
  """Error with an object passed to Term."""


class TermPortProtocolError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when a term hasn't defined an action."""


class TermInvalidIcmpType(Error):
  """Error when a term has invalid icmp-types specified."""


class InvalidTermActionError(Error):
  """Error when an action is invalid."""


class InvalidTermLoggingError(Error):
  """Error when a option is set for logging."""


class UndefinedAddressError(Error):
  """Error when an undefined address is referenced."""


class NoTermsError(Error):
  """Error when no terms were found."""


class ShadingError(Error):
  """Error when a term is shaded by a prior term."""


class FlexibleMatchError(Error):
  """Error when a term contains an invalid flexible match value."""


class ICMPCodeError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when a requested protocol doesn't have any of the requested ports."""


class TermProtocolEtherTypeError(Error):
  """Error when both ether-type & upper-layer protocol matches are requested."""


class TermNoActionError(Error):
  """Error when a term hasn't defined an action."""


class TermInvalidIcmpType(Error):
  """Error when a term has invalid icmp-types specified."""


class InvalidTermActionError(Error):
  """Error when an action is invalid."""


class InvalidTermLoggingError(Error):
  """Error when a option is set for logging."""


class UndefinedAddressError(Error):
  """Error when an undefined address is referenced."""


class NoTermsError(Error):
  """Error when no terms were found."""


class ShadingError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
"""Generic error class."""


class FileNotFoundError(Error):
  """Policy file unable to be read."""


class FileReadError(Error):
  """Policy file unable to be read."""


class RecursionTooDeepError(Error):
  """Included files exceed maximum recursion depth."""


class ParseError(Error):
  """ParseError in the input."""


class TermAddressExclusionError(Error):
  """Excluded address block is not contained in the accepted address block."""


class TermObjectTypeError(Error):
  """Error with an object passed to Term."""


class TermPortProtocolError(Error):
  """Error when a requested protocol doesn't have any of the requested ports."""


class TermProtocolEtherTypeError(Error):
github google / capirca / capirca / lib / policy.py View on Github external
"""Error when a option is set for logging."""


class UndefinedAddressError(Error):
  """Error when an undefined address is referenced."""


class NoTermsError(Error):
  """Error when no terms were found."""


class ShadingError(Error):
  """Error when a term is shaded by a prior term."""


class FlexibleMatchError(Error):
  """Error when a term contains an invalid flexible match value."""


class ICMPCodeError(Error):
  """Error when ICMP Codes are used with multiple or invalid types."""


class InvalidTermTTLValue(Error):
  """Error when TTL value is invalid."""


class MixedPortandNonPortProtos(Error):
  """Error when TCP or UDP are used with protocols that do not use ports."""


def TranslatePorts(ports, protocols, term_name):