def get_subnet_length(mask):
 if (not salt.utils.validate.net.netmask(mask)):
  raise SaltInvocationError("'{0}' is not a valid netmask".format(mask))
 return salt.utils.network.get_net_size(mask)

def get_subnet_length ( mask ) : if ( not salt . utils . validate . net . netmask ( mask ) ) : raise SaltInvocationError ( "'{0}' is not a valid netmask" . format ( mask ) ) return salt . utils . network . get_net_size ( mask )
convenience function to convert the netmask to the cidr subnet length cli example: .