def _validate_fwr_protocol_parameters(self, fwr):
     protocol = fwr['protocol']
     if protocol not in (constants.PROTO_NAME_TCP,
                         constants.PROTO_NAME_UDP):
         if fwr['source_port'] or fwr['destination_port']:
             raise fw_ext.FirewallRuleInvalidICMPParameter(
                 param="Source, destination port")
 def _validate_fwr_protocol_parameters(self, fwr):
     protocol = fwr.get('protocol', None)
     if protocol not in (nl_constants.PROTO_NAME_TCP,
                         nl_constants.PROTO_NAME_UDP):
         if (fwr.get('source_port', None)
                 or fwr.get('destination_port', None)):
             raise fw_ext.FirewallRuleInvalidICMPParameter(
                 param="Source, destination port")