Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ValueStr(self):
return self.value
class IntegerField(Field):
def __init__(self, value):
super(IntegerField, self).__init__(value)
try:
_ = int(value)
except ValueError:
raise ValueError('Invalid integer field: "%s"' % str(self))
class NamingField(Field):
"""A naming field is one that refers to names in used in naming.py."""
def __init__(self, value):
super(NamingField, self).__init__(value)
self.value = self.ParseString(value)
def ParseString(self, value):
"""Split and validate a string value into individual names."""
parts = set(value.split())
for p in parts:
self.ValidatePart(p)
return parts
def ValidatePart(self, part):
"""Validate that a string smells like a naming.py name."""
for c in part:
"""A destination-exclude field."""
class DestinationInterface(Field):
"""A destination-interface field."""
class DestinationPort(Port):
"""A destination-port field."""
class DestinationPrefix(Field):
"""A destination-prefix field."""
class DestinationPrefixExcept(Field):
"""A destination-prefix-except field."""
class DestinationTag(Field):
"""A destination tag field."""
class DscpMatch(Field):
"""A dscp-match field."""
class DscpSet(Field):
"""A dscp-set field."""
class EtherType(Field):
"""A source-prefix-except field."""
class SourceTag(Field):
"""A source tag field."""
class Target(Field):
"""A target field."""
class Timeout(IntegerField):
"""A timeout field."""
class TrafficType(Field):
"""A traffic-type field."""
class TrafficClassCount(Field):
"""A traffic-class-count field."""
class Verbatim(Field):
"""A verbatim field."""
class Vpn(Field):
"""A vpn field."""
destination_address_fields = (DestinationAddress, DestinationExclude,
"""An expiration field."""
class FragmentOffset(Field):
"""A fragment-offset field."""
class ForwardingClass(Field):
"""A forwarding-class field."""
class ForwardingClassExcept(Field):
"""A forwarding-class-except field."""
class IcmpCode(Field):
"""A icmp-code field."""
class IcmpType(Field):
"""A icmp-type field."""
class Logging(Field):
"""A logging field."""
class LossPriority(Field):
"""A loss-priority field."""
class Option(Field):
"""A logging field."""
class LossPriority(Field):
"""A loss-priority field."""
class Option(Field):
"""An Option field."""
class Owner(Field):
"""An owner field."""
class NextIP(Field):
"""An owner field."""
class PacketLength(Field):
"""A packet-length field."""
class Platform(Field):
"""A platform field."""
class PlatformExclude(Field):
"""A platform-exclude field."""
class Policer(Field):
return ' ' + '\n'.join(value_buf)
class Action(Field):
"""An action field."""
class Address(NamingField):
"""An address field."""
class Port(NamingField):
"""A port field."""
class Comment(Field):
"""A comment field."""
def ValueStr(self):
# Comments should align with the string contents, after the leading
# quotation mark.
return self.value.replace('\n', '\n ')
class Counter(Field):
"""A counter field."""
class DestinationAddress(Address):
"""A destination-address field."""
"""An ether-type field."""
class Expiration(Field):
"""An expiration field."""
class FragmentOffset(Field):
"""A fragment-offset field."""
class ForwardingClass(Field):
"""A forwarding-class field."""
class ForwardingClassExcept(Field):
"""A forwarding-class-except field."""
class IcmpCode(Field):
"""A icmp-code field."""
class IcmpType(Field):
"""A icmp-type field."""
class Logging(Field):
"""A logging field."""
class LossPriority(Field):
"""A packet-length field."""
class Platform(Field):
"""A platform field."""
class PlatformExclude(Field):
"""A platform-exclude field."""
class Policer(Field):
"""A rate-limit-icmp field."""
class Precedence(Field):
"""A precedence field."""
class Protocol(Field):
"""A Protocol field."""
class ProtocolExcept(Field):
"""A protocol-except field."""
class Qos(Field):
"""A rate-limit-icmp field."""
class PANApplication(Field):
"""A icmp-code field."""
class IcmpType(Field):
"""A icmp-type field."""
class Logging(Field):
"""A logging field."""
class LossPriority(Field):
"""A loss-priority field."""
class Option(Field):
"""An Option field."""
class Owner(Field):
"""An owner field."""
class NextIP(Field):
"""An owner field."""
class PacketLength(Field):
"""A packet-length field."""
class Platform(Field):
"""A rate-limit-icmp field."""
class RoutingInstance(Field):
"""A routing-instance field."""
class SourceAddress(Address):
"""A source-address field."""
class SourceExclude(Address):
"""A source-exclude field."""
class SourceInterface(Field):
"""A source-interface field."""
class SourcePort(Port):
"""A source-port field."""
class SourcePrefix(Field):
"""A source-prefix field."""
class SourcePrefixExcept(Field):
"""A source-prefix-except field."""
class SourceTag(Field):