# Path: capirca/lib/policy_simple.py
# class Field:
# class IntegerField(Field):
# class NamingField(Field):
# class Action(Field):
# class Address(NamingField):
# class Port(NamingField):
# class Comment(Field):
# class Counter(Field):
# class Encapsulate(Field):
# class DestinationAddress(Address):
# class DestinationExclude(Address):
# class DestinationInterface(Field):
# class DestinationPort(Port):
# class DestinationPrefix(Field):
# class DestinationPrefixExcept(Field):
# class DestinationTag(Field):
# class DscpMatch(Field):
# class DscpSet(Field):
# class EtherType(Field):
# class Expiration(Field):
# class FragmentOffset(Field):
# class ForwardingClass(Field):
# class ForwardingClassExcept(Field):
# class IcmpCode(Field):
# class IcmpType(Field):
# class Logging(Field):
# class LossPriority(Field):
# class Option(Field):
# class Owner(Field):
# class NextIP(Field):
# class PacketLength(Field):
# class Platform(Field):
# class PlatformExclude(Field):
# class Policer(Field):
# class Precedence(Field):
# class Protocol(Field):
# class ProtocolExcept(Field):
# class Qos(Field):
# class PANApplication(Field):
# class RoutingInstance(Field):
# class SourceAddress(Address):
# class SourceExclude(Address):
# class SourceInterface(Field):
# class SourcePort(Port):
# class SourcePrefix(Field):
# class SourcePrefixExcept(Field):
# class SourceTag(Field):
# class Target(Field):
# class Timeout(IntegerField):
# class TrafficType(Field):
# class TrafficClassCount(Field):
# class Verbatim(Field):
# class Vpn(Field):
# class Block:
# class Header(Block):
# class Term(Block):
# class BlankLine:
# class CommentLine:
# class Include:
# class Policy:
# class PolicyParser:
#   def __init__(self, value):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def Append(self, value):
#   def ValueStr(self):
#   def __init__(self, value):
#   def __init__(self, value):
#   def ParseString(self, value):
#   def ValidatePart(self, part):
#   def Append(self, value):
#   def ValueStr(self):
#   def ValueStr(self):
#   def __init__(self):
#   def __iter__(self):
#   def __getitem__(self, i):
#   def __str__(self):
#   def AddField(self, field):
#   def FieldsWithType(self, f_type):
#   def Match(self, match_fn):
#   def Name(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, name):
#   def Name(self):
#   def __eq__(self, o):
#   def Describe(self):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, data):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, identifier):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, identifier):
#   def AddMember(self, member):
#   def __str__(self):
#   def __iter__(self):
#   def __getitem__(self, i):
#   def Match(self, match_fn):
#   def MatchFields(self, block_match_fn, field_match_fn):
#   def __init__(self, data, identifier):
#   def Parse(self):
#   def ParseTopLevel(self, line):
#   def ParseCommentLine(self, line):
#   def ParseIncludeLine(self, line):
#   def ParseHeaderLine(self, line):
#   def ParseTermLine(self, line):
#   def ParseInBlock(self, line):
#   def ParseField(self, line):


from absl.testing import absltest
from absl import logging
from capirca.lib import policy_simple
        logging.debug('Testing good "%s".', good)
        _ = policy_simple.NamingField(good)
      except ValueError:
        self.fail('Rejected good NamingField value "%s".' % good)

  def testNamingFieldAppendRejectsBad(self):
    f = policy_simple.NamingField('RFC1918')
    bads = (
        'corp_internal',
        'CORP+INTERNAL',
    )
    for bad in bads:
      logging.debug('Testing bad "%s".', bad)
      self.assertRaises(ValueError, f.Append, bad)

  def testNamingFieldAppendAcceptsGood(self):
    f = policy_simple.NamingField('RFC1918')
    goods = (
        'CORP_INTERNAL',
        'RFC1918',
        'FOO_BAR102.BAZ101',
    )
    for good in goods:
      try:
        logging.debug('Testing good "%s".', good)
        _ = f.Append(good)
      except ValueError:
        self.fail('Rejected good NamingField value "%s".' % good)

  def testNamingFieldDedupes(self):

# Path: capirca/lib/policy_simple.py
# class Field:
# class IntegerField(Field):
# class NamingField(Field):
# class Action(Field):
# class Address(NamingField):
# class Port(NamingField):
# class Comment(Field):
# class Counter(Field):
# class Encapsulate(Field):
# class DestinationAddress(Address):
# class DestinationExclude(Address):
# class DestinationInterface(Field):
# class DestinationPort(Port):
# class DestinationPrefix(Field):
# class DestinationPrefixExcept(Field):
# class DestinationTag(Field):
# class DscpMatch(Field):
# class DscpSet(Field):
# class EtherType(Field):
# class Expiration(Field):
# class FragmentOffset(Field):
# class ForwardingClass(Field):
# class ForwardingClassExcept(Field):
# class IcmpCode(Field):
# class IcmpType(Field):
# class Logging(Field):
# class LossPriority(Field):
# class Option(Field):
# class Owner(Field):
# class NextIP(Field):
# class PacketLength(Field):
# class Platform(Field):
# class PlatformExclude(Field):
# class Policer(Field):
# class Precedence(Field):
# class Protocol(Field):
# class ProtocolExcept(Field):
# class Qos(Field):
# class PANApplication(Field):
# class RoutingInstance(Field):
# class SourceAddress(Address):
# class SourceExclude(Address):
# class SourceInterface(Field):
# class SourcePort(Port):
# class SourcePrefix(Field):
# class SourcePrefixExcept(Field):
# class SourceTag(Field):
# class Target(Field):
# class Timeout(IntegerField):
# class TrafficType(Field):
# class TrafficClassCount(Field):
# class Verbatim(Field):
# class Vpn(Field):
# class Block:
# class Header(Block):
# class Term(Block):
# class BlankLine:
# class CommentLine:
# class Include:
# class Policy:
# class PolicyParser:
#   def __init__(self, value):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def Append(self, value):
#   def ValueStr(self):
#   def __init__(self, value):
#   def __init__(self, value):
#   def ParseString(self, value):
#   def ValidatePart(self, part):
#   def Append(self, value):
#   def ValueStr(self):
#   def ValueStr(self):
#   def __init__(self):
#   def __iter__(self):
#   def __getitem__(self, i):
#   def __str__(self):
#   def AddField(self, field):
#   def FieldsWithType(self, f_type):
#   def Match(self, match_fn):
#   def Name(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, name):
#   def Name(self):
#   def __eq__(self, o):
#   def Describe(self):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, data):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, identifier):
#   def __str__(self):
#   def __eq__(self, o):
#   def __ne__(self, o):
#   def __init__(self, identifier):
#   def AddMember(self, member):
#   def __str__(self):
#   def __iter__(self):
#   def __getitem__(self, i):
#   def Match(self, match_fn):
#   def MatchFields(self, block_match_fn, field_match_fn):
#   def __init__(self, data, identifier):
#   def Parse(self):
#   def ParseTopLevel(self, line):
#   def ParseCommentLine(self, line):
#   def ParseIncludeLine(self, line):
#   def ParseHeaderLine(self, line):
#   def ParseTermLine(self, line):
#   def ParseInBlock(self, line):
#   def ParseField(self, line):


# Path: tests/lib/policy_simple_test.py
from absl.testing import absltest
from absl import logging
from capirca.lib import policy_simple

        logging.debug('Testing good "%s".', good)
        _ = policy_simple.NamingField(good)
      except ValueError:
        self.fail('Rejected good NamingField value "%s".' % good)

  def testNamingFieldAppendRejectsBad(self):
    f = policy_simple.NamingField('RFC1918')
    bads = (
        'corp_internal',
        'CORP+INTERNAL',
    )
    for bad in bads:
      logging.debug('Testing bad "%s".', bad)
      self.assertRaises(ValueError, f.Append, bad)

  def testNamingFieldAppendAcceptsGood(self):
    f = policy_simple.NamingField('RFC1918')
    goods = (
        'CORP_INTERNAL',
        'RFC1918',
        'FOO_BAR102.BAZ101',
    )
    for good in goods:
      try:
        logging.debug('Testing good "%s".', good)
        _ = f.Append(good)
      except ValueError:
        self.fail('Rejected good NamingField value "%s".' % good)

  def testNamingFieldDedupes(self):

    f = policy_simple.NamingField('RFC1918 CORP_INTERNAL RFC1918')