

def validate(self):
    if ('direction' in self.resource):
        direction = self.resource['direction']
        if (direction not in ['ingress', 'egress']):
            raise ValueError('The direction attribute must be either ingress or egress')
    if ('ethertype' in self.resource):
        ethertype = self.resource['ethertype']
        if (ethertype not in ['IPv4', 'IPv6']):
            raise ValueError('The ethertype attribute must be either IPv4 or IPv6')
    if ('protocol' in self.resource):
        protocol = self.resource['protocol']
        if (protocol not in ['tcp', 'udp', 'icmp']):
            raise ValueError('The protocol attribute must be either tcp, udp or icmp')
    if ('remote_mode' in self.resource):
        remote_mode = self.resource['remote_mode']
        if (remote_mode not in ['remote_ip_prefix', 'remote_group_id']):
            raise ValueError('The remote_mode attribute must be either remote_ip_prefix or remote_group_id')
    return True

dataset/ETHPy150Open cloudtools/troposphere/troposphere/openstack/neutron.py SecurityGroupRule.validate/original